473,626 Members | 3,265 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Triky Layout with CSS

SJ
Dear supeior CSS persons, I need some help!

Here is what I have :
[text][select][select][select]

If the user shrinks the window, I would like it to fold in like this:

[text][select][select]
[select]

and if further shrunk

[text][select]
[select]
[select]

Notice that the margin is preserved. Can this be done with CSS? maybe
some cobination of float and margin?
I dont want to use a table if I dont absolutely have to.

Thanks,
-SJ

Jan 18 '07 #1
2 2118
On 2007-01-18, SJ <sj******@gmail .comwrote:
Dear supeior CSS persons, I need some help!

Here is what I have :
[text][select][select][select]

If the user shrinks the window, I would like it to fold in like this:

[text][select][select]
[select]

and if further shrunk

[text][select]
[select]
[select]

Notice that the margin is preserved. Can this be done with CSS? maybe
some cobination of float and margin?
I dont want to use a table if I dont absolutely have to.
If you put a float, with width and height set explicitly on it, in the
content directly after the first [text], you should get the effect you
want in Firefox and I think IE7.

Setting the height of the float is the hard part. Too high and it will
overflow the container and disrupt later inline boxes, too low and some
of the [select]s might find their way back to the left margin.

In Opera and Konqueror, putting the float after the first [text] may
have the result of indenting the first line as well-- not what you want.

This is because Opera and Konqueror align a float with the top of the
current line box where that doesn't break any of the other float rules
(this was discussed recently in this NG).

So you can put the [text] itself in a span, float that left, and give
the other float also clear: left.

Like this:

<span style="float: left">text</span>
<span style="float: left; clear: left; width: 4em; height: 12em">
</span>
<input type="select">
<input type="select">
<input type="select">
<input type="select">
<input type="select">

For the first float we're relying on CSS 2.1 rules for auto width
floats, but that should be OK, I don't know of a browser that still
implements the CSS 2 rules. Possibly older versions of IE do (I'm not
familiar with IE), so you'll have to check that.
Jan 18 '07 #2
SJ
Ben, you are brillant. Thank you for the detailes response!!!

-SJ

Ben C wrote:
On 2007-01-18, SJ <sj******@gmail .comwrote:
Dear supeior CSS persons, I need some help!

Here is what I have :
[text][select][select][select]

If the user shrinks the window, I would like it to fold in like this:

[text][select][select]
[select]

and if further shrunk

[text][select]
[select]
[select]

Notice that the margin is preserved. Can this be done with CSS? maybe
some cobination of float and margin?
I dont want to use a table if I dont absolutely have to.

If you put a float, with width and height set explicitly on it, in the
content directly after the first [text], you should get the effect you
want in Firefox and I think IE7.

Setting the height of the float is the hard part. Too high and it will
overflow the container and disrupt later inline boxes, too low and some
of the [select]s might find their way back to the left margin.

In Opera and Konqueror, putting the float after the first [text] may
have the result of indenting the first line as well-- not what you want.

This is because Opera and Konqueror align a float with the top of the
current line box where that doesn't break any of the other float rules
(this was discussed recently in this NG).

So you can put the [text] itself in a span, float that left, and give
the other float also clear: left.

Like this:

<span style="float: left">text</span>
<span style="float: left; clear: left; width: 4em; height: 12em">
</span>
<input type="select">
<input type="select">
<input type="select">
<input type="select">
<input type="select">

For the first float we're relying on CSS 2.1 rules for auto width
floats, but that should be OK, I don't know of a browser that still
implements the CSS 2 rules. Possibly older versions of IE do (I'm not
familiar with IE), so you'll have to check that.
Jan 18 '07 #3

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

Similar topics

82
10666
by: Peter Diedrich | last post by:
The site design is pretty simple: ============================================ | Head | ============================================ | | | | | | | | | left | center | right | | | | | | | | |
39
5670
by: Zak McGregor | last post by:
Hi all Are there any good solutions to aligning form field names and input boxes without resorting to tables? I am struggling to do this nicely at the moment. Thanks Ciao Zak
47
9122
by: Neal | last post by:
Patrick Griffiths weighs in on the CSS vs table layout debate in his blog entry "Tables my ass" - http://www.htmldog.com/ptg/archives/000049.php . A quite good article.
20
24988
by: Tammy | last post by:
What would be a good alternative to using frames? I need something that will section my webpage into two halves and can change both frames on a single click. Thanks in Advance, Tammy
10
5179
by: Volker Lenhardt | last post by:
For a QApplication (PyQt) on the small screen of my Zaurus 5500 PDA I try to layout my data output in a QScrollView as the central widget. I'd prefer to use QGridLayout, but cannot add it to the scroll view. sc=QScrollView(self) layout=QGridLayout(..., sc.viewport()) sc.addChild(layout) results in a TypeError.
10
9195
by: Luke | last post by:
Hi. I am trying to make correct layout, here is an example of (dynamically generated content via jsp): http://localhost/www/layout.htm Most outer div is positioned absolute (if not then it will not grow when content inside div.body is greater than width of window of user agent), anyway anyone knowlegable can see it in sources...
3
1537
by: Samuel Shulman | last post by:
I am looking for good guidance for positioning controls on the form.document, it is absolute nightmare and I don't know where to begin Thank you, Samuel Shulman
5
2664
by: Jeff User | last post by:
Hi all I am writing program/framework to server a web site dynamically based on stored web page data with C#, .net1.1 What is the preferred means of controlling page layout, frames or table(s) ? Benefits or problems related to using one or the other ?
5
1621
by: Ed Sproull [MSFT] | last post by:
First I'm pretty new to ASP.NET and I'm having a simple problem. I have small website with a header, sidebar and the the content. I want my content to appear beside my sidebar which seems to be a pretty standard layout. However when ever I resize my browser the content resizes below the sidebar. I've been digging through example websites can't seem to stop this behaviour. I had one person suggest Tables but I see a few posts that say...
53
4111
by: brave1979 | last post by:
Please check out my javascript library that allows you to create any layout for your web page, nested as deep as you like, adjusting to width and height of a browser window. You just describe it in javascript object and that's all. No need to know CSS hacks, no need to clutter your html with tables. http://www.bravelayout.scarabeo.biz/Quickstart
0
8196
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8364
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7193
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5574
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4197
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1808
muto222
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.