Alcott
Alcott

Reputation: 18575

how to change <p>'s position inside a <div>?

I got a

tag inside a :

#in .css file
div.box {
    width: 50px;
    height: 30px;
}

#in .html file
<div class="box">
    <p>Here</p>
</div>

and it looks like this:

------------
|          |
|   Here   |
|          |
------------

but I want to put <p> at the bottom of <div>, like this:

------------
|          |
|          |
|   Here   |
------------

How?

Upvotes: 5

Views: 8579

Answers (1)

mgraph
mgraph

Reputation: 15338

add this

div.box {
    width: 50px;
    height: 30px;
    position:relative;
}
div.box p{
  margin:0;
  padding:0;
  position:absolute;
  bottom:0;
}

Upvotes: 8

Related Questions