473,379 Members | 1,379 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,379 software developers and data experts.

div CSS Width Setting

Hi, I have a question about setting the widths of divs with CSS that I have a feeling will be answered simply with a "no".

I have some divs that I want to have conform to the right hand side of their content but I don't want to arbitrarily set their widths to a set measurement or percentage. However if I don't specify a width it defaults to 100% of the page width. Is there any way I can set the width to automatically shrink to that of the content?

Cheers

Phil
Nov 8 '06 #1
6 2190
drhowarddrfine
7,435 Expert 4TB
Yes, the answer is no.
Nov 8 '06 #2
Yes, the answer is no.
Thought so, thanks for that.

If anyone has found a neat way of doing this is CSS rather than having to go back to tables, I'd appreciate an overview, and if I work out an alternative I'll post it here.

Cheers

Phil
Nov 9 '06 #3
drhowarddrfine
7,435 Expert 4TB
In what way does tables do that without setting a width?
Nov 9 '06 #4
In what way does tables do that without setting a width?
I'm referring to the effect you can get with a table with the border set to 0 and a background colour so that if its width is less than the page width it will only take up however much room it actually requires, and no more, so it looks like a "frame". As I'm moving to CSS, I don't want to (ab)use tables for these sort of layout purposes any more.
Nov 10 '06 #5
drhowarddrfine
7,435 Expert 4TB
I'm not sure I'm correctly picturing what you want to do. Do you have a screenshot or link? I think you can do what I think you want.
Nov 10 '06 #6
I'm not sure I'm correctly picturing what you want to do. Do you have a screenshot or link? I think you can do what I think you want.
Is it possible to upload local images to this server (I'm guessing not as the IMG tag looks like it only serves online images) as I don't have anywhere I can load images up to, to create links to?
Nov 13 '06 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Kai Grossjohann | last post by:
I would like to put a text input field (in the sense of <input type="text">) and an image next to each other, where I know the size in pixels of the image, and I know the total width in em. I...
5
by: Robert Downes | last post by:
I'm using the following in a page that I'm testing in Mozilla: p.actionLinkBlock {border: 1px #000000 dashed; padding: 0.2cm; width: auto} But the dashed border is extending to the right-edge...
4
by: Matt | last post by:
Hi, Got an unordered list with 100% width, with 5 list items of 20% width styled to fill the width of the container element. Renders fine in Mozilla, but when you change the size of the window...
2
by: Paresh Dhakan | last post by:
Hi ! I am facing a wierd problem in setting the width of a form to 20. Suppose I create two forms Form1 and Form2. Form1 is the container, meaning this.IsMdiContainer = true; Form2 is...
4
by: Hiwj | last post by:
I am having a problem with a cell in a table in ASP.NET which used to work OK in classic ASP. I have one cell in a row where the width should be 22 pixels and the other cell should take up the...
50
by: Shadow Lynx | last post by:
Consider this simple HTML: <!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>...
4
by: Man-wai Chang | last post by:
-- iTech Consulting Co., Ltd. Expert of ePOS solutions Website: http://www.itech.com.hk (IE only) Tel: (852)2325 3883 Fax: (852)2325 8288
4
by: p.numminen | last post by:
Is it possible, with CSS, to determine a certain _maximum_ width for a text, paragraph, division, etc.?
5
by: mohaaron | last post by:
OK, I have now gone through lots of posts, and there are lots, looking for a anwer as to why I can't set the width of the columns in my gridview. So far I have tried the following methods to set...
2
by: paul | last post by:
I have a JS function to change the width of a <divthat works great in Firefox, but not at all in IE7. In IE an error message occurs: Line: 92 Char: 5 Error: Invalid Argument Code: 0 Firefox...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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...

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.