I am looking for a way to effectively achieve negative padding in CSS.
Problem
I have an element h1on my webpage that currently has the following code associated with it:
h1 {
background-color: #375E97;
color: #FFFFFF;
font-size: 50px;
font-family: 'Righteous', cursive;
text-transform: uppercase;
text-align: center;
padding: 0;
margin: 0 auto;
height: 49px;
}
<head>
<link href="https://fonts.googleapis.com/css?family=Righteous|Roboto:400,700,400i" rel="stylesheet">
</head>
<body>
<h1>Lorem Ipsun Al</h1>
</body>
Run codeYou can see that, as I added:, the height: 49px;text looks as if it merges into the rest of the page. I want to achieve this look, but also for the top of the text, and not just for the bottom.
What i tried
I tried:
- Set
h1values paddingand marginin 0. - A game with different meanings for
vertical-align. - Setting
heightfor different values. h1 padding margin 0.
, , , , ( ) . , , .