|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Enthusiast
![]() Join Date: Mar 2004
Location: Farmington
Posts: 64
|
Padding or Margin does not work within a div
I am trying to apply padding-top or margin-top to 'style2' and 'style6' definitions but it is not working. What am I doing wrong ?
<div class="FeatureLeft"> <img src="/pic1.jpg" name="photo" width="84" height="68" border="0" id="photo" /> </div> <div class="FeatureRightMsg"> <span class="style2"><a href="/message1.html" >Message 1</a><br /></span><span class="style6">Message By</span> </div> Here is my CSS definition. .FeatureLeft { float: left; margin: 3px 0px 0px 0px; height: 68px !important; } .FeatureRightMsg { background-color:#526284; float: right; width: 132px !important; height: 68px !important; margin: 3px 0px 0px 0px; } .style2 {color: #FFFFFF; font-weight: bold; margin-top:10px;} .style6 {color: #FFFFFF; padding-top:10px;} |
|
|
|
|
|
#2 |
|
CSS Consultant/Ninja-I'm fast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Oct 2008
Location: Whiteford, MD
Posts: 10,083
|
Hi, becauase the <span> is an inline element it doesn't acccept vertical padding/margins.
Giving display:block; should work, however if you need thigs on the same line still you can add float:left; to the span.
Edit: You have a <br> after each span, so remove the <br> and just give display:block; to the spans |
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 23:00.










Linear Mode
