1 reply [Last post]
Owen Densmore
Offline
newbie
Last seen: 18 years 15 weeks ago
Joined: 2004-08-16
Posts: 1
Points: 0

I'm just learning xhtml and css, being an old timer who learned html1. I'm delighted how clean the results are!

So I presumed only content would be in the html file. But because the layout rules work, I find myself forced to pre-design my site by nesting <div>s in order to the the right parent nesting.

But I'd prefer just to have a flat <div> space, using css to lay everything out, so the site can be completely redesigned via css.

Here's a concrete example: I'd like to be able to move my search form from the sidebar to the footer. I can see no way, other than *extreme* absolute layout, to achieve this! .. or possibly rely on site wide includes or other dynamic stunts.

I.e. the html would have to change from:
<div id="top">...</div>
<div id="sidebar"> <div id="search">...</div> ...</div>
<div id="content">...</div>
<div id="footer">...</div>
to:
<div id="top">...</div>
<div id="sidebar"> ... </div>
<div id="content">...</div>
<div id="footer"><div id="search">...</div>...</div>
This in my mind violates the css goal of separating content from layout and styling.

Is there a way to have no nesting of <div>s yet still be able to have a flexible way to relocate where the <div>s occur in the page?

Thanks!

Owen

co2
co2's picture
Offline
Leader
UK
Last seen: 14 years 33 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

Nested &lt;div&gt;s == format??

I think maybe you've got the concept slightly twisted?

Undoubtedly HTML is for content, however, it also governs the structure of the content.

CSS shouldn't be used for shifting of HTML elements. Visually it can do this with absolute position and relative positioning, but, in code terms, nothing changes in the HTML (only visually). So, CSS cannot amend the positioning blocks of code within the source.

The next sentence is true. The previous sentence is false. Discuss...