473,472 Members | 2,191 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

A div that tries to be 300px but is willing to compromise?


Here is what I want to say in CSS:

Dear div, please try to be 300px wide. If for some reason there's a
table inside of you that's 400 px wide, go ahead and expand to envelop
it, RATHER THAN A) holding your boundary and letting it spill over the
edge, B) cutting the table off at your edge, or C) making scrollbars.
In other words, act just like tables do in this situation by default.

How do I do that in a CSS class definition, that will work across major
browsers?

In other words, none of the options for "overflow" sound like what I
want. I'm about to give up and go back to tables why do I bother.

Jul 21 '05 #1
3 1377
MrKrinkle wrote:

Here is what I want to say in CSS:

Dear div, please try to be 300px wide. If for some reason there's a
table inside of you that's 400 px wide, go ahead and expand to envelop
it, RATHER THAN A) holding your boundary and letting it spill over the
edge, B) cutting the table off at your edge, or C) making scrollbars.
In other words, act just like tables do in this situation by default.

How do I do that in a CSS class definition, that will work across major
browsers?

In other words, none of the options for "overflow" sound like what I
want. I'm about to give up and go back to tables why do I bother.

Would 'min-width' work the way you need it?
IE does not really support it, but the implementation of 'width' in IE is
broken too and works just like 'min-width' should do.
So a hack like:

yourSelector { min-width: XXX }
* html yourSelector { width: XXX }

could work for you.

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
Jul 21 '05 #2
Op 25 Jun 2005 18:52:28 -0700 schreef "MrKrinkle"
<yu******@hotmail.com>:

Here is what I want to say in CSS:

Dear div, please try to be 300px wide. If for some reason there's a
table inside of you that's 400 px wide, go ahead and expand to envelop
it, RATHER THAN A) holding your boundary and letting it spill over the
edge, B) cutting the table off at your edge, or C) making scrollbars.
In other words, act just like tables do in this situation by default.

How do I do that in a CSS class definition, that will work across major
browsers?

In other words, none of the options for "overflow" sound like what I
want. I'm about to give up and go back to tables why do I bother.


Use min-width: it sets the minimum width of an element (except
non-replaced inline elements and tables).
Problem is AFAIK that it's use is not very well supportd by IE...

Bart
--
Bart Broersma
br*********************@tiscali.nl
(ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)
Jul 21 '05 #3
in comp.infosystems.www.authoring.stylesheets, Benjamin Niemann wrote:
Dear div, please try to be 300px wide. If for some reason there's a
table inside of you that's 400 px wide, go ahead and expand to envelop
it,
How do I do that in a CSS class definition, that will work across major
browsers?

I'm about to give up and go back to tables why do I bother.
Would 'min-width' work the way you need it?
Propably
yourSelector { min-width: XXX }
* html yourSelector { width: XXX }

could work for you.


Setting display:table works as well, but bit differently: if the content
is table without width, it will be tried to put inside 300px, and only
streches it if that fails. IANM, that matches IE bug.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Kohtuuhintainen yksiö/huone haussa Oulusta syyskuusta eteenpäin.
Searching places to sleep on axis Bonn - Tsech - Poland - baltic sea in
july
Jul 21 '05 #4

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

Similar topics

0
by: RT | last post by:
Hello I am starting to do more work with Dreamweaver MX ­ Php & MySql and I find myself in need of help in the little things( writing good code for one) I¹m looking for someone who would be...
7
by: Minnie | last post by:
Hi everyone, I was trying to use a script called PHPrint, but I think the reason it's not working is because I have register globals off. This decision is not under my control, and I am not...
4
by: Mark | last post by:
Hi Forum, I'm new to ASP.NET and have a basic question. If someone is willing to lay it out for me in an easy way to understand, I have a huge list of tasks I'm willing to pay to get...
1
by: ABCL | last post by:
Hi All, I am working on the situation where 2 different Process/Application(.net) tries to open file at the same time....Or one process is updating the file and another process tries to access...
1
by: yellowtek | last post by:
Hi, I display some information (actually a table of data) within a <div> which height is constrained, making display a vertical scrollbar: <div style='overflow: auto height:300px;'> I need to...
1
by: s33k3r | last post by:
hi all I've been assigned the task of designing a distributed application from scratch. I have no legacy applications to integrate or support. But I'm faced with the question : Is visual c++.net...
12
by: lovecreatesbea... | last post by:
K&R say in the preface of their 2nd edition, "We used Bjarne Stroustrup's C++ translator extensively for local testing of our programs". I don't know where they used the C++ in projects or only...
19
by: jim | last post by:
(from http://www.news.com/8301-13578_3-9798715-38.html ) October 16, 2007 5:56 PM PDT RIAA tries to pull plug on Usenet. Seriously. Posted by Declan McCullagh The Recording Industry Association...
0
by: Gabriel Genellina | last post by:
En Sat, 24 May 2008 15:32:56 -0300, garywood <woodygar@sky.comescribió: How would you count that if you were playing the game "for real"? I'd say that you start (mentally) at 0 and count one...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.