Demo: http://jsfiddle.net/DerekL/gNkKx/
I am trying to push up the text in a div
by 50%, and I tried
padding-bottom: 50px; /*div is 100px high*/
But it does not work.
padding-top: -50px;
This does not work too. Any work-around?
So, type the open <marquee> tag before the text we want to move and close the <marquee> tag just after that text. Step 3: By default, the text moves from right to left direction on the web page. If we want to specify the direction, then we have to specify the direction attribute in the <marquee> tag.
If you want to move the text down, use padding-top.
Using the Line-Height Property In most cases, you can also center text vertically in a div by setting the line-height property with a value that is equal to the container element's height.
line-height:0px;
pushes it up some, but I don't know how much and it's apparently not 50px as you want.
You can wrap the element in another container and position it like so:
HTML
<div class="container">
<div class="block">龍</div>
</div>
CSS (only showing modifications from your style)
.container{
position: relative;
}
.block {
position: absolute;
top: -50px;
}
DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With