Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Padding not Working?

Tags:

css

Why does the search box here not have 15px padding to the right? This is the CSS:

#element_right {
padding: 120px 15px 0px 0px;
color:#161514;
font-family:helvetica, sans-serif, Arial;
font-size: 13px;
background: #f4f4f4;
width: 270px;
height: 100%;
float: right;
}

I'm using Chrome

like image 336
Tara Avatar asked May 08 '11 08:05

Tara


2 Answers

This should work (if that's what you're really trying to achieve):

#element_right {
padding: 120px 35px 0px 0px;
color: #161514;
font-family: helvetica, sans-serif, Arial;
font-size: 13px;
background: #F4F4F4;
width: 270px;
height: 100%;
float: right;
}

enter image description here

like image 117
slhck Avatar answered Oct 14 '22 01:10

slhck


To reach your effect, setting margin is a more suitable way.

Of course, it would be in conflict with the width as your child element with 280px of width break the entire structure.

I suggest you to remove the width in child element and make width effect at #element_right with a 295px of width the same with boxes below.

So the search box's width and horizontal position would exactly be identical to the boxes below besides the border and box shadow.

EDIT: Delete misleading answer.

like image 22
tytsim Avatar answered Oct 14 '22 00:10

tytsim