Ask Experts Questions for FREE Help !
Ask
    jduke44's Avatar
    jduke44 Posts: 407, Reputation: 44
    Full Member
     
    #1

    May 15, 2006, 12:52 PM
    Css vs. html
    Ok, I thought there was a thread onthis but I couldn't find it. I wanted to know when I should use CSS and when I should use HTML? I noticed websites that are using CSS are still using HTML, psecifically tables, to do some of there layout. I thought that was a no, no since CSS came out.

    I am trying to do a very simple webpage with 4 pictures and a discription for for each. I found it is easier to set up tables for this since I am new to CSS and want to get this up quick. Is this proper to do? I tried in CSS but am having a little trouble getting the text to position correctly as opposed to the images.

    I took a class in CSS so I am familiar with it. Thanks for your help.
    LTheobald's Avatar
    LTheobald Posts: 1,051, Reputation: 127
    Ultra Member
     
    #2

    May 16, 2006, 01:26 AM
    It isn't a case of CSS or HTML. They work alongside each other.

    For a standards compliant page you only want to be using tables for tabular data. Contents tables, budgets, cash flows - those sort of things. For positioning things you really want to be using something else. Divs (short for division) are a good solution.

    Try the following code. There's two parts. The HTML and the CSS to go in either your external CSS file or in the style tags on the HTML page itself.

    HTML
    Code:
    <div class="picture">
        <img src="blank.gif" alt="picture"/>
        <p>Description Here</p>
    </div>
    <div class="picture">
        <img src="blank.gif" alt="picture"/>
        <p>Description Here</p>
    </div>
    <div class="picture">
        <img src="blank.gif" alt="picture"/>
        <p>Description Here</p>
    </div>
    <div class="picture">
        <img src="blank.gif" alt="picture"/>
        <p>Description Here</p>
    </div>
    <br class="clearleft"/>
    This will give you a row of 4 pictures with the descriptions underneath. The <br> at the end clears the left floats I applied to the divs. Without this content underneath would appear in the row with the pictures.

    CSS
    Code:
    .picture {
        float: left;
    }
    
    .clearleft {
        clear: left;
    }
    There's a lot more you can do to these to make it a bit nicer. For example, adding borders & padding to the elements to make them line up nicer. If you want me to run through some of this with you, let me know.
    jduke44's Avatar
    jduke44 Posts: 407, Reputation: 44
    Full Member
     
    #3

    May 16, 2006, 06:12 AM
    Thanks LT. I will try this and fool around with other ideas. If I need help I will surely let you know. I am taking it that other people don't really know how to use CSS in conjunction with HTML because I see a lot of table work for creating columns for images and text. I see this even with big name websites also. I will let you know how I make out. Thanks.
    RickJ's Avatar
    RickJ Posts: 7,762, Reputation: 864
    Uber Member
     
    #4

    May 16, 2006, 06:26 AM
    I'm an old fart who does not know css. Laying out what you describe in tables is quick and easy.

    ... but definitely give LT's instructions a whirl. He's been an awesome help for me many times here for the "beyond html" stuff.
    jduke44's Avatar
    jduke44 Posts: 407, Reputation: 44
    Full Member
     
    #5

    May 16, 2006, 01:07 PM
    Yep, it is easier but I am learning it slowly but surely so everyone can see any webpages I might do (which isn't many). I actually did it with tables in 2 minutes as opposed to not getting it quite right in about 30 minutes. But with LT's help, I think I will be able to do it quite quickly.
    LTheobald's Avatar
    LTheobald Posts: 1,051, Reputation: 127
    Ultra Member
     
    #6

    May 17, 2006, 04:16 AM
    If you are doing any kind of site that will be accessed by a wide audience, you really need to ditch the tables. It makes things a lot harder for those with disabilities, using screen readers etc.

    Part of the WAI compliance involves items like not using tables for layout, adding alt text to all your images etc. This will make it easier for the disabled users out there.
    jduke44's Avatar
    jduke44 Posts: 407, Reputation: 44
    Full Member
     
    #7

    May 17, 2006, 02:21 PM
    LT, I am not disagreeing with you but this goes along with my question. Did you ever look at the source to www.w3schools.com? They seem to use tables for their whole layout. Would you be able to explain why? Maybe I am not getting the big picture.
    LTheobald's Avatar
    LTheobald Posts: 1,051, Reputation: 127
    Ultra Member
     
    #8

    May 18, 2006, 03:46 AM
    It could be for a number of reasons. I guess W3Schools hasn't changed because it's a big site and would involve a lot of work. They might not feel they have the resources to do it yet.

    Or they might simply just not want to!
    jduke44's Avatar
    jduke44 Posts: 407, Reputation: 44
    Full Member
     
    #9

    May 24, 2006, 12:14 PM
    LT, is there anything I can do to simulate what the screen readers will be seeing? I just thought then I would know how my site looks to them.
    LTheobald's Avatar
    LTheobald Posts: 1,051, Reputation: 127
    Ultra Member
     
    #10

    May 25, 2006, 01:15 AM
    If you have Firefox installed, try Fangs. Otherwise, try the demo version of Jaws.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Help with HTML. [ 6 Answers ]

okay. So I have my webpage at index.htm and I start building the structure. <html><head><title>my homepage of ittle</title></head> <body> <center><b><u><h1><font color=red> WELCOME! <br size=5 color=pink> now I have a matrix animation using javascript. Then I have a button that says home so...

Html help ! [ 5 Answers ]

?? I have a website for my in laws villa in Florida which I will shortly be updating, I have seen whilst browsing the net another site: - www.users.waitrose.com/~elainenicol When you click on 'the cottage' you are presented with a floor plan, by clicking on the room you then move to the...

Html [ 2 Answers ]

hi, I want to create web pages which should independent of screen resolution, i.e. I develop the page in the screen size 800x600 but when I viewing it in the screen resolution 1024 x 764 then positioning of the page and component on it changes i.e layout changes. How can I prenevt this. Please...

HTML question [ 4 Answers ]

Hello, I would like my website to display the date automatically (without me having to update the page each day) , can anyone let me have HTML to do this ? I can understand that putting the time on the page could be more complicated allowing for time zones but hopefully the date is a bit...

Html [ 1 Answers ]

Howdy I have some files, all of which are .jpg I have FTP them to an AOL web server. Questions: What extension do they now have? If not HTML, how do they get to be HTML which is What I am wanting? And, yes, I am new at this.


View more questions Search