473,672 Members | 2,604 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Generalized Side by Side Divs

I've been trying to wean myself off of tables. I've been reading about
the float property, and have implemented a couple of sites using divs
instead of tables, and generally I'm happy with the results.

Still, I'm having problems constructing a generalized approach to
laying divs side by side without being very specific about the width of
each div. The code below makes 3-columns of content, but unfortunately
if the visitor resizes the page large enough eventually the 3rd column
drops down below the second. I had hoped that the nowrap on the
bounding div would stop the problem.

Can anyone point me in the direction of how to do this? Ultimately I'd
like to be able to have 23 side by side columns if I like with the
assurance that they'll remain locked side by side. Any online
tutorials I might have missed would be extremely helpful - I've read
many so far, and also the float section in the Schengili/Roberts "Core
CSS" book but I can't find a clear answer on how to approach this
problem.

Thanks!
philz

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Upcomi ng Events &amp; Workshops</title>
<style type="text/css" title="test">
<!--
BODY {
background-color: #000000
text-color: #ffffff;
color: #ffffff;
font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: small;
}

div
{
margin: 0px;
padding: 0px;
}

..columnOne {
float: left;
padding: 4px;
border: none;
color: #ffffff;
margin-left: 0px;
p\osition: relative;
}
..columnRight {
float: left;
padding: 4px;
border: none;
color: #ffffff;
margin-left: 4px;
margin-right: 4px;
p\osition: relative;}

..zTextLarge {
color: #ffffff;
font-size: large;
font-family: Arial, Verdana, Helvetica, sans-serif;
font-weight: bold;
}
-->
</style></head>
<body text="#FFFFFF" bgcolor="#00000 0" link="#0000FF" vlink="#551A8B"
alink="#0000FF" >

<p>
This is a test of CSS Float properties
</p>

<br><br>
<br><br>

<div style="nowrap" align="left">
<div class="columnOn e">
<span class="zTextLar ge"><u>Performa nces</u></span>
<br><br>
content 1<br>
content 1<br>
content 1<br>
content 1<br>
content 1<br>
</div>

<div class="columnRi ght">
<span class="zTextLar ge"><u>Vocal Workshops</u></span>
<br><br>
content 2<br>
content 2<br>
content 2<br>
content 2<br>
content 2<br>
</div>
<div class="columnRi ght">
<span class="zTextLar ge"><u>Other Workshops</u></span>
<br><br>
content 3<br>
content 3<br>
content 3<br>
content 3<br>
content 3<br>
content 3<br>
</div>
</div>

</body>
</html>
Jul 21 '05 #1
5 8385
On Fri, 01 Apr 2005 10:57:32 -0500, squidco
<za*****@squidc oRemoveMe.com> wrote:
Ultimately I'd
like to be able to have 23 side by side columns if I like with the
assurance that they'll remain locked side by side.


floats will drop if there is not enough room to contain all of them
so
set the width of the containing div to be larger than 100%, try 200 or
250%

people with low resolutions(800 ) will have a long horizontal scroll,
people with high resolution (1600) will be able to see everything side
by side.

but there is no assurance with floats. People who browse in
non-maximized windows will see a blank space somewhere.
cheers
johnSteve
Jul 21 '05 #2
Thanks johnSteve, that did the trick...

I'm curious what you mean by non-maximized windows, do you mean older
browsers? I don't see any unexpected blank space with Firefox, IE or
Safari on the Mac, modern versions all - this looks like exactly the
solution I was looking for.

philz
In article <k4************ *************** *****@4ax.com>, johnSteve
<st****@bresnan .net> wrote:
On Fri, 01 Apr 2005 10:57:32 -0500, squidco
<za*****@squidc oRemoveMe.com> wrote:
Ultimately I'd
like to be able to have 23 side by side columns if I like with the
assurance that they'll remain locked side by side.


floats will drop if there is not enough room to contain all of them
so
set the width of the containing div to be larger than 100%, try 200 or
250%

people with low resolutions(800 ) will have a long horizontal scroll,
people with high resolution (1600) will be able to see everything side
by side.

but there is no assurance with floats. People who browse in
non-maximized windows will see a blank space somewhere.
cheers
johnSteve

Jul 21 '05 #3
squidco <za*****@squidc oRemoveMe.com> wrote:
Ultimately I'd like to be able to have 23 side by side columns if I
like with the assurance that they'll remain locked side by side.

If it's tabular data, then use a table. If it isn't tabular data, then why
worry about having 23 columns "locked" into one particular configuration?

squidco <za*****@squidc oRemoveMe.com> wrote: I'm curious what you mean by non-maximized windows, do you mean older
browsers?


No, not at all. Even the newest browsers come with non-maximized windows by
default. They're just windows that don't take up the full display. For
example, my default browser windows are about 600x800 (yes, taller than
they are wide) on a display that's configured for 1280x1024 resolution.
--
Darin McGrew, mc****@stanford alumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp. com, http://www.HTMLHelp.com/

"I can take one day at a time, but sometimes several days attack me at once."
Jul 21 '05 #4
squidco <za*****@squidc oRemoveMe.com> wrote:
Ultimately I'd like to be able to have 23 side by side columns if I
like with the assurance that they'll remain locked side by side.


Sounds like tabular data. If this is the case, use a table for it.

Bye,
Martin
Jul 21 '05 #5
In article <d2**********@b lue.rahul.net>, Darin McGrew
<mc****@stanfor dalumni.org> wrote:
squidco <za*****@squidc oRemoveMe.com> wrote:
Ultimately I'd like to be able to have 23 side by side columns if I
like with the assurance that they'll remain locked side by side.

If it's tabular data, then use a table. If it isn't tabular data, then why
worry about having 23 columns "locked" into one particular configuration?


This is really more of a theoretical issue for me - I've had some
arguments recently with a web developer who refused to put some data
into a table even though we were having serious cross-browser layout
problems that could have been easily solved by tables. Eventually he
agreed with me and reverted to a table, but his comment was that "I
stopped using tables a couple of years ago". This led me to my
question, and to a change in my development practices to try to reduce
the number of tables I use and to rely on CSS more to simplify my
layouts.

What's not theoretical is a site I'm working on now that is using two
columns of text. I found a reliable way of laying them out using fixed
widths, but I became interested in whether this problem could be solved
without fixed widths, and then to this question, whether I could
generalize the solution for any number of columns.

So generally, yes, if my layout required 23 columns I'm sure I'd use a
table, but it's very interesting to see that there is a CSS solution.
The solution itself is a bit weird - I generally don't like to declare
widths like 200%, which sounds like a kludge that might get "fixed" at
some point in the future. Still, that seems to be the state of CSS
still, and why I've done less with it than I might have over the last
few years: there are a lot of tricks to get around browser
implementations , and parameters like float are kind of flakey.

squidco <za*****@squidc oRemoveMe.com> wrote:
I'm curious what you mean by non-maximized windows, do you mean older
browsers?


No, not at all. Even the newest browsers come with non-maximized windows by
default. They're just windows that don't take up the full display. For
example, my default browser windows are about 600x800 (yes, taller than
they are wide) on a display that's configured for 1280x1024 resolution.


Doh! Of course I should have known what you mean, even though I'm a
Mac developer... I just don't really think about maximized width, just
browser width. I always check pages as though I had a tiny browser
window or a huge window, resize the fonts on every page up and down,
etc. to flush out potential layout flaws.

philz
Jul 21 '05 #6

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

Similar topics

9
4576
by: Preston Crawford | last post by:
I know this is probably a dumb question so please be patient with me. I've been doing HTML since 1994, but mostly for projects that had to be as completely compatible as possible and mostly existing projects. So that meant dealing with the traditional table layouts (i.e. using tables for the entire structure of a page). I'm just not getting to use DIVs solely for the layout of a page. The one problem I'm having is that I'm trying to setup...
4
10217
by: Aaron | last post by:
I have the following divs: <div style="background-image: url(images/house_01.jpg); width: 249px; height: 346px;"></div> <div style="background-image: url(images/house_02.jpg); width: 251px; height: 346px;"></div> Since by default, the display property is set to block, they show up on different lines. Since each div contains half of a complete background image, I need then to show up side-by-side. The thing is, when I set the
2
6062
by: Jamie Jackson | last post by:
I'd like to get a couple of divs centered in a container (let's say the container is a td, but it could also be a div). Here's what I have now (div2 and div3 are floated left): +---------------------------+ |+----+ +-------+ | ||div2| | div3 | | || | | | | || | | | | || | | | |
6
38814
by: Mel | last post by:
i need to have as many as 5 divs side by side on the same line without a break. if browser displays a horizontal scrollbar, its ok with my users and they can resize it. something like the following: X X X X X where each 'X' is a div with my stuff inside them and i dont want it to look like
9
4265
by: Screwball | last post by:
Hi, I'm having problems getting 2 divs to display side-by-side correctly. I've done the google bit, but cannot find anything which is similar enough to what I want. Most of the descriptions I've found seem to use individual ID= (versus class=) - I don't understand how "cascading" works in those circumstances. :( Anyway, I have two specific questions.
4
5684
by: Rick Brandt | last post by:
Sorry, I don't have a sample web page, but hopefully the crude illustration below will suffice. Given that the space within the dashed upper and lower lines is a div across the entire width of the page and that the areas are spans that sit on the left side of that div, is there a simple CSS way to make the "additional span" be justified to the right side of the containing div? I have been experimenting with different strategies and...
2
4234
by: Wes Groleau | last post by:
I have a huge pile of open-source PHP, far too big for me to wrestle it into submission. It generates nested tables MANY layers deep. What I am trying to do is extract several small pieces from it and put each of those in a box (in a new file) and arrange those boxes my way. The layout I want is (you'll need fixed width font): +-----+-----+-----+-----+
5
4469
by: Mike P | last post by:
How would I show or hide a div that is using client side Javascript based upon a server side variable? Here are my divs : <div id="idButton5" class="otherLeftBarLink" onmouseover="javascript: changeStylesMouseOver('5');" onmouseout="javascript: changeStylesMouseOut('5');" onclick="location='/AddProject.aspx'"> <div class="leftBarLinkText"> Add Project
2
4818
by: jeddiki | last post by:
How do I get these 2 divs to be side by side ? I have been trying to apply the float logic to a couple of divs on the same screen, but without success. There is a main div that holds two sub-divs The LHS sub-div ( class= listerTop) is a listing and the RHS sub-div i( class=ad_big_box ) is a set of images.
0
8506
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8423
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,...
1
8649
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
8701
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7482
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...
0
5725
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
4251
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
4447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2847
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 we have to send another system

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.