Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

html

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?

like image 277
Alcott Avatar asked Dec 29 '11 13:12

Alcott


1 Answers

add this

div.box {
    width: 50px;
    height: 30px;
    position:relative;
}
div.box p{
  margin:0;
  padding:0;
  position:absolute;
  bottom:0;
}
like image 135
mgraph Avatar answered Oct 03 '22 20:10

mgraph