472,993 Members | 2,543 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,993 software developers and data experts.

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 5344
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
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
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
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
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
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
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
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
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
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
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.