wesleyholmes Posted January 10, 2006 Share Posted January 10, 2006 Hello,I am new to CSS and ive been trying to define a table in an external CSS fileto be used on a HTML page. Here is the example of what im doing.HTML------<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Table Layout</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><link href="global.css" rel="stylesheet" type="text/css" /></head><body bgcolor="#FFFFFF" text="#333333" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><table class="layout"> </table></body></html>CSS-----table.layout { width: 100px; border: 1px; cellspacing: 1px; cellpadding: 1px; summary: "This table is for layout purposes";}Im simply trying to define a table 100px in width and link it to the HTML page.When I view the page in a browser the table can be seen in the corner,very small. It doesn't use the dimensions made in the CSS file.Can anyone tell me if this can be done or am I doing this completely wrong?ThanksWes Link to comment Share on other sites More sharing options...
aspnetguy Posted January 10, 2006 Share Posted January 10, 2006 CSS cannot fill in the TR and TD tags for you or add content(text,etc)CSS can define dimensions, padding, margins, color, etc.try thishtml <html xmlns="http://www.w3.org/1999/xhtml"><head><title>Table Layout</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><link href="global.css" rel="stylesheet" type="text/css" /></head><body bgcolor="#FFFFFF" text="#333333" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><table class="layout" cellpadding="0" cellspacing="0" summary=""><tr><td> </td><tr></table></body></html> CSS table.layout { width: 100px; border: 1px solid #000; }/*need to deal with the cells serperate from the table*/table.layout td{ padding: 1px; margin: 1px; /*spacing*/} Link to comment Share on other sites More sharing options...
Eric Posted January 10, 2006 Share Posted January 10, 2006 CSS cannot add content(text,etc)<{POST_SNAPBACK}> Well, in CSS2 you can add some content, however it doesn't work in IE but does in the other browsers (hopefully IE7 gets better CSS support)table:before { content: content here;}table:after { content: content here;}IE currently doesn't reconize the :before and :after which also means it doesn't reconize 'content'. Link to comment Share on other sites More sharing options...
aspnetguy Posted January 10, 2006 Share Posted January 10, 2006 Even if IE7 fully supports CSS2 (which it does) it will be a long time before the majority of IE users upgrade from IE6. IE7 also will not be available until fall 2006. Link to comment Share on other sites More sharing options...
wesleyholmes Posted January 10, 2006 Author Share Posted January 10, 2006 Thanks aspnetguy, I understand that now and it works. Thanks for that. Link to comment Share on other sites More sharing options...
aspnetguy Posted January 10, 2006 Share Posted January 10, 2006 you're very welcome Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now