By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,846 Members | 1,803 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,846 IT Pros & Developers. It's quick & easy.

CSS DIV width problems

P: n/a
Hope someone can help with this i've set this code below

<table width="160">
<tr>
<td><div class="mystyle">some text here</div></td>
</tr>
<tr><td>...some other stuff...</td></tr>
</table>

The div style sets padding, background colour, font colour and a
background image that's aligned to the right hand side;

.mystyle {
font-size: 10px;
font-weight: bold;
color: #FFFFFF;
background: #003366;
padding: 6px;
white-space: nowrap;
}

The problem is that the div fills the <td>'s 160px width rather than
constraining itself to the with of its content, i've tried adding a
minimum width of say 10px which seems to work in IE on PC but nothing
else. How can i get it to reliably follow the widths of the content
and padding??
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Els


James wrote:
Hope someone can help with this i've set this code below

<table width="160">
<tr>
<td><div class="mystyle">some text here</div></td>
</tr>
<tr><td>...some other stuff...</td></tr>
</table>

The div style sets padding, background colour, font colour and a
background image that's aligned to the right hand side;

.mystyle {
font-size: 10px;
font-weight: bold;
color: #FFFFFF;
background: #003366;
padding: 6px;
white-space: nowrap;
}

The problem is that the div fills the <td>'s 160px width rather than
constraining itself to the with of its content, i've tried adding a
minimum width of say 10px which seems to work in IE on PC but nothing
else. How can i get it to reliably follow the widths of the content
and padding??


url?
--
Els

Sonhos vem. Sonhos vo. O resto imperfeito.
- Renato Russo -

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.