473,503 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Swap two columns

I have a two column layout - this is the regular story about a sidebar
and a column containing the main content.

In the HTML source I've put the main content div first and the sidebar
div second - This is an important point. I do this because I would
like the main content of the site to be at the top of the HTML source
(to please screen readers and search bots)

But in the browser I would like to show the sidebar to the left of the
main content.

How do I achieve this?

If you use the Firefox Developer Toolbar and can edit CSS "run-time",
you can see/use the example page here:
http://tws.name/resources/2008/02/sw...-elements.html
(out-of-the-box the two columns are just rendered in their normal
flow, I've done no effort to render the sidebar to the left, since I'm
totally out of ideas)

/thomas
Feb 14 '08 #1
9 5456
In article
<c7**********************************@c4g2000hsg.g ooglegroups.com>,
Thomas Watson <w@tson.dkwrote:
I have a two column layout - this is the regular story about a sidebar
and a column containing the main content.

In the HTML source I've put the main content div first and the sidebar
div second - This is an important point. I do this because I would
like the main content of the site to be at the top of the HTML source
(to please screen readers and search bots)

But in the browser I would like to show the sidebar to the left of the
main content.

How do I achieve this?
The following style sheet does this, for both 2- and 3-column
layouts:
http://webhost.bridgew.edu/etribou/l.../skidoo_redux/

Check out some of the other layouts on that site too - very
useful!
Feb 14 '08 #2
Thomas Watson wrote on 14 feb 2008 in
comp.infosystems.www.authoring.stylesheets:
I have a two column layout - this is the regular story about a sidebar
and a column containing the main content.

In the HTML source I've put the main content div first and the sidebar
div second - This is an important point. I do this because I would
like the main content of the site to be at the top of the HTML source
(to please screen readers and search bots)

But in the browser I would like to show the sidebar to the left of the
main content.

How do I achieve this?
Float the main div to the right.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Feb 14 '08 #3
On Feb 14, 2:49 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
Float the main div to the right.
I want the main column to be as far left as possible, only of cause
leaving room for the left sidebar. The problem with the float:right
solution is that the main column then goes all the way to the right of
the browser viewport.

I guess this could be handled by giving the main column a fixed size,
but with a layout that increases horizontally depending on the users
browser size this is unfortunately not possible.

/thomas
Feb 14 '08 #4
On Feb 14, 1:42 pm, David Stone <no.em...@domain.invalidwrote:
The following style sheet does this, for both 2- and 3-column
layouts:
http://webhost.bridgew.edu/etribou/l.../skidoo_redux/

Check out some of the other layouts on that site too - very
useful!
Thanks a lot... This is what I'm looking for.

Just a few questions:

I see that you use three nested div-containers around all your
columns. How come a single doesn't do the trick?

I've tried to mimic your code, with only two columns here:
http://tws.name/resources/2008/02/sw...elements2.html
I've color-coded the three containers. If I remove the CSS for the two
inner once, it seems stil to work. Are they necessary?

/thomas
Feb 14 '08 #5
On Feb 14, 5:41 pm, David Stone <no.em...@domain.invalidwrote:
I'm slowly getting a better understanding of the CSS and how it works;
some of it is included to make the layout work with IE 5 & 6, as well
as IE:Mac 5.x and other early browsers. I restricted my concerns mostly
to IE >= 6, FF >=2, and Safari >=2.
I'll do a couple of tests across browsers and see what the minimum
requirements are...

@berg: Thnx for the simplified version :)

I've created a 3rd version of the test page with the result:
http://tws.name/resources/2008/02/sw...elements3.html

I'm using an empty div at the bottom of the container that has a
clear:both rule. This is not important in this simple example, but if
you have an outer container that needs to graphically wrap the entire
container and its divs you need this to make the outer container
follow the flow of the columns.

This solves my first issue. But I actually have a second related one:
How do I make the left column variable in width?

I've created another example page that in the left column has a series
of tabs. The tabs can be of variable width and I don't know the number
of tabs. Just to the right of the tabs I have the main/right column.
This column needs to flow naturally after the last tab. In the below
example I've set the left column to a fixed width of 400px - how do I
make it variable?
http://tws.name/resources/2008/02/tabs-with-text2.html

Thanks for all your help :)

/thomas
Feb 14 '08 #6
In article
<c7**********************************@c4g2000hsg.g ooglegroups.com
>,
Thomas Watson <w@tson.dkwrote:
I have a two column layout - this is the regular story about a sidebar
and a column containing the main content.

In the HTML source I've put the main content div first and the sidebar
div second - This is an important point. I do this because I would
like the main content of the site to be at the top of the HTML source
(to please screen readers and search bots)

But in the browser I would like to show the sidebar to the left of the
main content.

How do I achieve this?
With difficulty and complication. Just look at what has been
offered to you in response, tricks and tricks galore.

How strong is this argument about pleasing screen readers and
search bots? So simple is it to put the nav first in the html,
width it, float it left, margin-left the main by about the width
of the nav and let Bob be your uncle, that the argument better be
pretty strong indeed.

--
dorayme
Feb 14 '08 #7
On Feb 14, 10:46 pm, dorayme <doraymeRidT...@optusnet.com.auwrote:
With difficulty and complication. Just look at what has been
offered to you in response, tricks and tricks galore.

How strong is this argument about pleasing screen readers and
search bots? So simple is it to put the nav first in the html,
width it, float it left, margin-left the main by about the width
of the nav and let Bob be your uncle, that the argument better be
pretty strong indeed.
The other posters actually helped me a lot... I have to areas where
this is an issue. One where I have the regular two column layout -
this is now fixed. But I was just wondering if I could use this new
input to also solve another problem that I've been having: Where I
need a text to flow just after the last tab, as explained.

/thomas
Feb 15 '08 #8
In article
<6e**********************************@s12g2000prg. googlegroups.co
m>,
Thomas Watson <w@tson.dkwrote:
On Feb 14, 10:46 pm, dorayme <doraymeRidT...@optusnet.com.auwrote:
With difficulty and complication. Just look at what has been
offered to you in response, tricks and tricks galore.

How strong is this argument about pleasing screen readers and
search bots? So simple is it to put the nav first in the html,
width it, float it left, margin-left the main by about the width
of the nav and let Bob be your uncle, that the argument better be
pretty strong indeed.

The other posters actually helped me a lot... I have to areas where
this is an issue. One where I have the regular two column layout -
this is now fixed. But I was just wondering if I could use this new
input to also solve another problem that I've been having: Where I
need a text to flow just after the last tab, as explained.
Perhaps I was a bit harsh about what you have been offered in the
context of simple cases. Perhaps a more detailed url of what you
are wanting might be useful to determine the relative merits of
things.

Not sure what you are asking in the last bit, last tab? Maybe my
newsreader is not getting up all the posts in the thread?

--
dorayme
Feb 16 '08 #9
Thomas Watson wrote:
I have a two column layout - this is the regular story about a sidebar
and a column containing the main content.

In the HTML source I've put the main content div first and the sidebar
div second - This is an important point. I do this because I would
like the main content of the site to be at the top of the HTML source
(to please screen readers and search bots)

But in the browser I would like to show the sidebar to the left of the
main content.
I am not a CSS expert, not even close.
But for what it's worth, at
http://www.NorthwestAllenTrails.org/
I have the main content preceding the nav bar in the HTML,
but the sidebar stays on the left.

--
Wes Groleau

Ostracism: A practice of sticking your head in the sand.
Feb 17 '08 #10

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

Similar topics

6
9557
by: Doug Baroter | last post by:
What is a good method/mechanism to swap the position of multiple columns? For instance, tblXZY has the followings columns and respective positions: tblXZY ====== xyzUUID 1 fn 2 ln 3...
1
1343
by: Mat | last post by:
Please do i swap dbgrid columns in runtime from code? i want to do the samething like when user move columns Thanks you
0
2412
by: Kevin Bartz | last post by:
-----Original Message----- From: Kevin Bartz Sent: Monday, August 09, 2004 10:37 AM To: 'mike@thegodshalls.com' Subject: RE: Out of swap space & memory Thanks for your reply, Mike!...
4
4087
by: Niels Dekker (no reply address) | last post by:
When calling swap as follows (as recommanded in Effective C++, 3rd Edition, by Scott Meyers), what swap is chosen to be called? using std::swap; swap(a, b); Suppose there is a global ::swap...
8
2034
by: Andy Mabbett | last post by:
I have an HTML document which has a long table, with five columns. I want to swap the order of columns four and five, without breaking (indeed, without otherwise altering) the valid markup. Is...
1
5956
by: Phil | last post by:
Is it possible to swap rows and columns in select query output so that each record's data is displayed in a column? I want to collect data each day and display it in a query with each day's date...
8
10999
by: silversnake | last post by:
hi all, I'm trying to swap two array location within a 2d array using the swap function. I know that how to swap with in a 1d array eg " swap(array, inner, inner+1); " but how do I use swap within a...
0
1004
by: Rich Raffenetti | last post by:
I want to display the subitems column to the left side of the items column in a details listview. It's easy to drag the columns to swap their display in the listview window. Is it possible to do...
5
4815
by: dmf1207 | last post by:
Hi All! I'm new to javascript and need a little help with a simple puzzle im trying to design. I have a 600x100 pixel picture that I have sliced into 6 100x100 rectangles making a table of of 6...
0
7199
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
7273
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,...
0
7322
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
6982
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
7451
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
3161
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
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
374
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.