Forum Moderators: not2easy

Message Too Old, No Replies

uncooperative spacing

can you spot the elusive cascade?

         

sldesigns

3:48 am on Nov 10, 2006 (gmt 0)

10+ Year Member



Going nuts here. Below is a spot of code for a box with text, links and a button. The text in .red and .button styles are adjusting too far down. Padding, line-height, margin don't seem to be working for me. What needs to happen to pull the text up to proper position?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#bottombox {
background-color:#e3d8bf;
position:relative;
width:156px;
font: normal 14px/17px Arial, Helvetica, sans-serif;
}
#bottombox p {
padding:12px 12px 0 12px;
font-size:12px;
line-height:15px;
}
p, h1, h2, h3 {
margin:0;
padding:0;
}
.button {
color:#800;
background-image: url(images/pagebutton.jpg);
background-repeat: no-repeat;
width:150px;
height:28px;
font-size:12px;
font-weight:bold;
}
.button a {
color:#800;
text-decoration:none;
padding:0;
}
.red, .red a {
color:#800;
font-weight:bold;
}
.red a:hover {
color:#000;
}
-->
</style>
</head>
<body>
<div id="bottombox">
<p>Blah blah exciting text in this box. Blah blah exciting text in this
box. Blah blah exciting text in this box.</p>
<p class="red"><a href="#">url link</a></p>
<p class="red">phone number</p>
<p class="button"><a href="#">contact someone &raquo;</a></p></div>
</body>
</html>

Geoffrey james

4:11 pm on Nov 10, 2006 (gmt 0)

10+ Year Member



Im no expert but i might be inclined to say your problem is here, in this section css browsers may think you are setting the paragrapth margins as you have #bootombox p here and then p further down.
If this padding is required for the div then place these within #bottombox

here maybe your prob:
#bottombox p {
padding:12px 12px 0 12px;
font-size:12px;
line-height:15px;
}

get rid of this and change #bottombox to this:

#bottombox {
background-color:#e3d8bf;
position:relative;
width:156px;
padding:12px 12px 0 12px;
line-height:15px;
font: normal 14px/17px Arial, Helvetica, sans-serif;
}
[[ps: not sure why you have selected 2 diff font sizes!]]

Try these changes

<p class=red> to <span class="red"> in your html, with this you can still use .red, .red a in your css

this way you dont need 2 p selectors

Geoff

ps: place this at the top of your css as a general rule i do

*{margin:0px; padding:0px;}

this sets all padding and margins to 0 then you can select if you need any within the css for each div's

sldesigns

6:03 pm on Nov 17, 2006 (gmt 0)

10+ Year Member



Thanks! You were right, it was the extra p in the css making it screwy. The font setting by the way is font size/leading size. A little fudging with .button for padding and margin and voila == perfect box!
I appreciate your extra eyes for this.