Ask Experts Questions for FREE Help!
  Advanced
Register  |  Log in  
   Ask    
 Answer  
  Help  

Ask QuestionsprogressAnswer QuestionsprogressBuild ReputationprogressBecome an Expert
 
Free Answers in 3 Easy Steps

Register Now
3 Steps

At Ask Me Help Desk you can ask questions in any topic and have them answered for free by our experts. To ask questions or participate in answering them you must register for a free account. By registering you will be able to:
  • Get free answers from experts in any of our 300+ topics.
  • Accept money for answers that you provide.
  • Communicate privately with other members (PM).
  • See fewer ads.

Home > Computers & Technology > Programming > Markup Languages > HTML   »   CSS vs. HTML

 
Thread Tools Display Modes
Question
 
 
#1  
Old May 15, 2006, 11:52 AM
jduke44
Full Member
jduke44 is offline
 
Join Date: May 2005
Posts: 401
jduke44 See this member's comment history on his/her Profile page.
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.

Reply With Quote
 
     

Answers
 
 
Old May 16, 2006, 12:26 AM   #2  
Ultra Member
LTheobald is offline
 
LTheobald's Avatar
 
Join Date: Feb 2004
Location: Cambridge, UK
Posts: 1,047
LTheobald See this member's comment history on his/her Profile page.LTheobald See this member's comment history on his/her Profile page.
Call LTheobald via Skype™ Send a message via MSN to LTheobald
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.

Comments on this post
RickJ agrees: Awesome help as usual!
  Reply With Quote
 
     
 
 
Old May 16, 2006, 05:12 AM   #3  
Full Member
jduke44 is offline
 
Join Date: May 2005
Posts: 401
jduke44 See this member's comment history on his/her Profile page.
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 conjuction with HTML bc I see alot 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.
  Reply With Quote
 
     
 
 
Old May 16, 2006, 05:26 AM   #4  
Administrator
RickJ is offline
 
RickJ's Avatar
 
Join Date: Aug 2005
Location: Cave 4, Qumran
Posts: 6,981
RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.RickJ See this member's comment history on his/her Profile page.
I'm an old fart who does not know css. Laying out what you describe in tables is quick and easy.

...but definately give LT's instructions a whirl. He's been an awesome help for me many times here for the "beyond html" stuff.
  Reply With Quote
 
     
 
 
Old May 16, 2006, 12:07 PM   #5  
Full Member
jduke44 is offline
 
Join Date: May 2005
Posts: 401
jduke44 See this member's comment history on his/her Profile page.
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.
  Reply With Quote
 
     
 
 
Old May 17, 2006, 03:16 AM   #6  
Ultra Member
LTheobald is offline
 
LTheobald's Avatar
 
Join Date: Feb 2004
Location: Cambridge, UK
Posts: 1,047
LTheobald See this member's comment history on his/her Profile page.LTheobald See this member's comment history on his/her Profile page.
Call LTheobald via Skype™ Send a message via MSN to LTheobald
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.

Comments on this post
jduke44 agrees: That's true
  Reply With Quote
 
     
 
 
Old May 17, 2006, 01:21 PM   #7  
Full Member
jduke44 is offline
 
Join Date: May 2005
Posts: 401
jduke44 See this member's comment history on his/her Profile page.
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.
  Reply With Quote
 
     
 
 
Old May 18, 2006, 02:46 AM   #8  
Ultra Member
LTheobald is offline
 
LTheobald's Avatar
 
Join Date: Feb 2004
Location: Cambridge, UK
Posts: 1,047
LTheobald See this member's comment history on his/her Profile page.LTheobald See this member's comment history on his/her Profile page.
Call LTheobald via Skype™ Send a message via MSN to LTheobald
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!
  Reply With Quote
 
     
 
 
Old May 24, 2006, 11:14 AM   #9  
Full Member
jduke44 is offline
 
Join Date: May 2005
Posts: 401
jduke44 See this member's comment history on his/her Profile page.
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.
  Reply With Quote
 
     
 
 
Old May 25, 2006, 12:15 AM   #10  
Ultra Member
LTheobald is offline
 
LTheobald's Avatar
 
Join Date: Feb 2004
Location: Cambridge, UK
Posts: 1,047
LTheobald See this member's comment history on his/her Profile page.LTheobald See this member's comment history on his/her Profile page.
Call LTheobald via Skype™ Send a message via MSN to LTheobald
If you have Firefox installed, try Fangs. Otherwise, try the demo version of Jaws.
  Reply With Quote
 
     


Thread Tools
Display Modes

 
Similar Sponsors

Similar Threads
Question Asker Forum Answers Last Post
Help with HTML. ittle HTML 6 Jun 26, 2006 11:02 AM
html help ! chrisbaker4937 HTML 5 Jun 27, 2004 11:26 PM
html kausikporel HTML 2 May 18, 2004 02:23 AM
HTML question chrisbaker4937 HTML 4 Apr 10, 2003 02:44 AM
HTML urbisoler HTML 1 Feb 23, 2003 07:06 PM




Copyright ©2003 - 2007, Ask Me Help Desk.
All times are GMT -8. The time now is 09:17 PM.