Derek 朕會功夫 Derek 朕會功夫 - 6 months ago 32
CSS Question

How to push up text in CSS?

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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download