473,402 Members | 2,046 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,402 software developers and data experts.

Two Divs on same line

I'm trying to get two divs on the same line....the problem I have is
when the browser window gets smaller, the second div is being pushed
below the first div....I want them to stay on the same line. Here is
my code:

<div style="white-space:nowrap">
<div style="float:left">
Left Column
</div>
<div style="float:left;margin-left:10px">
Right Column
</div>
</div>
Jun 27 '08 #1
7 7803
In article
<4b**********************************@56g2000hsm.g ooglegroups.com>,
rcw1983 <rw*****@gmail.comwrote:
I'm trying to get two divs on the same line....the problem I have is
when the browser window gets smaller, the second div is being pushed
below the first div....I want them to stay on the same line. Here is
my code:

<div style="white-space:nowrap">
<div style="float:left">
Left Column
</div>
<div style="float:left;margin-left:10px">
Right Column
</div>
</div>
Set a width of a bit less than 50% on each (to allow for
a margin between the two), then float them left and right,
respectively?

Of course, if your users tend to use large default font sizes
with very narrow windows, it will look ugly as all get out!
Jun 27 '08 #2
rcw1983 <rw*****@gmail.comwrites:
I'm trying to get two divs on the same line....the problem I have is
when the browser window gets smaller, the second div is being pushed
below the first div.
Fluid layout is not a problem, it's a *solution* to the problem that web
browser windows can change size.

If you're looking for a format where everything is nailed firmly into place,
PDF might be more appropriate.

sherm--

--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net
Jun 27 '08 #3
On 7 May, 15:21, rcw1983 <rwie...@gmail.comwrote:
I'm trying to get two divs on the same line....the problem I have is
when the browser window gets smaller, the second div is being pushed
below the first div....I want them to stay on the same line.
Then use a <table>

If you _really_ want them to stay in their relative position,
regardless of whether they still fit into the window, then <tableis
the appropriate code to use.

You could use position:absolute as well, but that's even more
restrictive and problematic.
Jun 27 '08 #4
Thanks for the replies....

Setting the divs to width of 50% won't work because once the content
inside the divs gets to be wider than 50% of the browser window the
divs again wrap.

I am trying to use div's as an alternative to tables for Section 508
compliance

Sherman, you were a big help
Jun 27 '08 #5
On Wed, 7 May 2008 09:15:46 -0700 (PDT), rcw1983 <rw*****@gmail.com>
wrote:
>I am trying to use div's as an alternative to tables for Section 508
compliance
Section 508 doesn't require you to avoid tables, only the inappropriate
mis-use of tables.

If you care about accessibility, go to a fluid design that re-arranges
your boxes when they're too wide to both fit the window. This is
probably the best solution all round.

If you _must_ avoid the boxes re-arranging, even at the cost of
scrolling, stick with the table. This isn't contrary to 508.
Jun 27 '08 #6
Andy, thanks for the comments.....I don't know the exact reason my
company has decided to avoid tables at all costs, they claim that even
though it is technically compliant it is still more difficult for
screen readers.....they have created a company-wide rule that tables
are to be used only for data.....I was trying to do this as divs for
the sake of surviving a code review, but I might end up using tables
anyways

Our pages are split into 3 sections and I'm working with a narrow part
of the screen....when the browser window is maximized its not a
problem, but if the screen gets resized my content should not wrap to
the next line and that seciton of the page should have
scrollbars....this is what they want....I think tables might be my
best option

Thanks
Jun 27 '08 #7
In article
<55**********************************@f36g2000hsa. googlegroups.com>,
rcw1983 <rw*****@gmail.comwrote:
Andy, thanks for the comments.....I don't know the exact reason my
company has decided to avoid tables at all costs, they claim that even
though it is technically compliant it is still more difficult for
screen readers.....they have created a company-wide rule that tables
are to be used only for data.....I was trying to do this as divs for
the sake of surviving a code review, but I might end up using tables
anyways

Our pages are split into 3 sections and I'm working with a narrow part
of the screen....when the browser window is maximized its not a
problem, but if the screen gets resized my content should not wrap to
the next line and that seciton of the page should have
scrollbars....this is what they want....I think tables might be my
best option
Can you not set min-width? Works in IE7, and there are JS routines
to make it work in IE 6.
Jun 27 '08 #8

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

Similar topics

6
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...
2
by: tasman.hayes | last post by:
I'm experimenting with converting a site from a table layout to CSS. I'm floating three DIVs in a row for the top of a website (a logo, navigation buttons and a email list signup box). The DIVs...
8
by: rfox | last post by:
My parade of IE problems continues. I have two divs in the banner area of my website, one containing a photograph, the other the title and logo for the program. (Please see...
2
by: Arnost Sobota | last post by:
Hello, Suppose I want to play with DIVs as if they were type characters. I have a series of fixed-height (width is of no importance) blocks which must follow one another from left to right, with...
7
by: massic80 | last post by:
Hi everybody! I'm making a page for an exam at uni. In two DIV blocks of it there should appear (and disappear) some "icons", due to XML messages, so I dunno how many of them should I can obtain;...
14
by: Daniel | last post by:
Hi i have a requirement for the following layout in my masterpage: 1 div for header 1 div for footer Between those divs i want a div for the left menu, then a div for the content in the...
4
by: Adam | last post by:
I have four roughly square DIVs, all the same height, which I need to line up horizontally across the page. What would be the best way to do this? At the moment I have a very botched solution where...
7
by: maya | last post by:
hi, I got this unusual design (well, not so unusual anymore, I guess..) for an input text field for a search form in top of page.. http://www.mayacove.com/design/search/search.html I can't...
0
by: Berlin Brown | last post by:
I have two DIVs on the same line, a left navigation frame and the right content. I want both of those items on the same line. Lets say the left nav content is 140pixels and the right content is...
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: 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...
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
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
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...
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,...

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.