Jump to content

Newbie question


wesleyholmes

Recommended Posts

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

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

CSS cannot add content(text,etc)

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...