Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Control <span> width in IE and FF

Posted on 2010-08-15
3
Medium Priority
?
426 Views
Last Modified: 2012-06-21
I'm editing someone else's code to insert headings on colored rectangle backgrounds, that are 3 rows deep and NOT to go the full width of the table cell.

As the code below shows, I've used <span> and multiple &nbsp; to complete the create this effect. It seems an amateurish way to go about it [I'm not a CSS expert] but it works in IE8. The right hand sides of each row line up nicely. However, in FireFOX the same code produces a ragged right hand side to the rectangle with each row a different length. [Apple Safari could be a problem too.]

As an alternative I've tried using a <div> style but I have trouble limiting its height, and limiting its width to less than the table cell width.
<td width="311" class="column2">
      <table border="0" cellspacing="0" cellpadding="0" width="301">
         <tr> 
          <td height="50" align="left" valign="top" bgcolor="#ffcc00"> 

	<p><span style="color: #FFFFFF; background: #666666; height:17">
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
              <b>TOP OVERALL</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;	  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;			  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span></p>

Open in new window

0
Comment
Question by:NEILPH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 1000 total points
ID: 33442550
Is this anywhere close to what you want?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>Untitled</title>
</head>
<body>

      <table border="0" cellspacing="0" cellpadding="0" width="301">
         <tr> 
          <td style="background-color: #ffcc00;height: 50px;padding: 16px;"><b>TOP OVERALL</b></td></tr>
</table>
</body>
</html>

Open in new window

0
 
LVL 7

Assisted Solution

by:jhp333
jhp333 earned 1000 total points
ID: 33442632
How about this?
<!DOCTYPE html>
<table><tr>
	<td style="width:311px;background-color:#ffcc00;vertical-align:top" class="column2">
		<p style="width:95%;color:#FFFFFF;background:#666666;text-weight:bold">
			<br>
			TOP OVERALL<br>
			<br>
		</p>
	</td>
</tr></table>

Open in new window

0
 

Author Closing Comment

by:NEILPH
ID: 33442905
Thanks guys. Below is what I ended up doing. It's a bit from both of you plus allowing for other factors on the page.

     
         
         
                  TOP OVERALL

               

 
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question