473,396 Members | 1,935 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

CSS DIV width problems

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
1 6600
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 vão. O resto é imperfeito.
- Renato Russo -

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

157
by: Dennis | last post by:
Is there some way --using, say, DOM or javascript-- to detect the current pixel width and/or height of a relatively sized table or of one of its columns or rows. I'm going to be writing javascript...
8
by: BiNZGi | last post by:
Hi I have reduced the problem to this code: <form> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td><input type="text" style="width: 100%;" value="Lorem ipsum dolor...
25
by: Sune A | last post by:
Hi All! I'm having problems with www.suneworld.com The thing is that I'd like to lock the width of the page, so that it won't adjust dynamically. Any CSS people out there that can help me? ...
4
by: Alex Meier | last post by:
I have the following problem: I need a simple, tabular layout in a webshop. - left column: navigation column with approx. 170px width - right column: content area the goal: the left column...
5
by: Jean Pion | last post by:
Dear readers, Can anyone explain how to set column width of a table in ccs. I use the following style in an external stylesheet: table.tbl { table-layout:fixed; border-top: 5px solid #333;...
1
by: Jeronimo Bertran | last post by:
I am creating a table and inserting an iframe inside a cell for which the width depends on the screen size. The table has 7 columns and the fourth column is resized depeding on the screen...
1
by: chr.aleksander | last post by:
Hey, I need a solution to two problems: #1 I use a three column layout, where the right and left columns are 150px wide and floated. The center column is not floated, with margins 150px on each...
1
by: Jeff | last post by:
ASP.NET 2.0 I've got problems with the Width of the ImageMap below. The problem is that the ImageMap's Width doesn't have any effect in my GridView, the width are determine by width of the...
4
by: p.numminen | last post by:
Is it possible, with CSS, to determine a certain _maximum_ width for a text, paragraph, division, etc.?
2
by: gentsquash | last post by:
(If my question is too much CSS, please point me elsewhere and I'll post there. My tests have been on Firefox on MacOS, and I'd settle for just getting this to work there.) I'm writing a game...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.