SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Jan 2004
    Location
    New York
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is css truly independant of html?

    I'm wondering if html has some say in layout. For example:

    HTML Code:
    <div class="1">blah</div>
    <div class="2">blah</div>
    <div class="3">blah</div>
    lets say I made it so it shows 1, 2, and 3 left to right in 3 columns. Can I change just the CSS file so that columns are arranged different (in a liquid layout, no pixel counting) while the html is left alone? Say, 3, 1, then 2?

  2. #2
    Are You There? KDesigns's Avatar
    Join Date
    Oct 2003
    Location
    Your Monitor
    Posts
    1,146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It could be sort of independent of HTML is you are using CSS-Positioning. You can absolutely position the different elements in your CSS file, completely independent of HTML.

    However, CSS can't really do it's job without HTML to show the style.
    ChooseDaily.com - Follow on Twitter
    Top Resources for Web Designers and Developers Every Day!

  3. #3
    Caveat surfer Buddy Bradley's Avatar
    Join Date
    May 2003
    Location
    Cambridge, UK
    Posts
    2,366
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Atealtha
    I'm wondering if html has some say in layout. For example:

    HTML Code:
    <div class="1">blah</div>
    <div class="2">blah</div>
    <div class="3">blah</div>
    lets say I made it so it shows 1, 2, and 3 left to right in 3 columns. Can I change just the CSS file so that columns are arranged different (in a liquid layout, no pixel counting) while the html is left alone? Say, 3, 1, then 2?
    Absolutely, yes it could.

    There are obviously restrictions on what you can do (or how complicated it becomes to do what you want) with CSS and the order that elements appear in the HTML source, but most stuff can be accomplished if you try hard enough.

    Of course, it's usually easier to just switch the order in the HTML source if at all feasible.

  4. #4
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    UK
    Posts
    245
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes it gets complicated, but you can truly place anything almost anywhere in the page with the CSS See the CSS Zen garden for example. Each page uses the exactly the same HTML code only the CSS changes.

  5. #5
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,355
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    As all the others have said above css can completely change the order and display of all elements.

    CSS makes no assumptions about how an element should look and where it should appear on the page. Nearly all elements can be changed with the exception of some windowed controls.

    However in most pages you would want a logical flow of the document anyway but css will allow you to place the items where you want.

    There are limitations and rules to follow as you can't really absolutely place everything in a fluid layout and floats need to come first in the html before the element they must float around. So there would be problems re-ordering layout where floats are concerned.

    As mediaman said above just look at the zen garden to see what can be accomplished without a single line of html being changed.

    Paul


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •