Author Topic: IE 8.0: would like top and bottom padding  (Read 457 times)

0 Members and 1 Guest are viewing this topic.

Offline bulrushTopic starter

  • Enthusiast
  • Posts: 184
  • Gender: Male
    • View Profile
IE 8.0: would like top and bottom padding
« on: September 07, 2010, 11:56:49 AM »
I would like to put a little padding above and below a text element, but not enough for a whole line (I don't want to use <p>). PLEASE NOTE: there are multiple rows of text in this single table cell.

I have created a CSS class like this:

.modelnumcat {
	
font-style:italic;
	
/*padding-top:8px;
	
padding-bottom:8px; */
	
margin-top:8px;
	
margin-bottom:8px;
}


The style.css file is included in my html file like this:

<head>
  <
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <
title>Print Draft Report like Catalog v.10d</title>
  <
link rel="stylesheet" type="text/css" href="style.css" />
</
head>


I call it out like this:

<tr><td valign="top"><b>Product name goes here</b><br/>
Subname goes here<br/>
<
span class="modelnumcat">34 5/8`` blah blah blah offset this text with a little space above and below</span><br/>


I have also tried using the class in a <br> tag:

<br class="modelnumcat">34 5/8`` blah blah blah offset this text with a little space above and below</br>


But it doesn't work. The italics work but not the padding. In my CSS I have tried using "padding" and "margin" but neither works. Does it matter that I am inside a table?

Thanks.
« Last Edit: September 07, 2010, 12:01:41 PM by bulrush »

Offline haku

  • Guru
  • Freak!
  • *
  • Posts: 5,707
  • Old Man
    • View Profile
Re: IE 8.0: would like top and bottom padding
« Reply #1 on: September 08, 2010, 02:50:31 AM »
Span tags are inline elements, and will not take padding as-is. You will need to set:

Code: [Select]
display:block;
to the CSS for the span tag before your padding will work.

Offline bulrushTopic starter

  • Enthusiast
  • Posts: 184
  • Gender: Male
    • View Profile
Re: IE 8.0: would like top and bottom padding
« Reply #2 on: September 08, 2010, 08:15:57 AM »
Thank you. This appears to be working. The working CSS code is now:

.modelnumcat {
	
font-style:italic;
	
padding-top:6px;
	
padding-bottom:6px
	
display:block;
}