Question about tables.

liunx

Guest
A friend of mine has a journal on <!-- m --><a class="postlink" href="http://www.woohu.com">http://www.woohu.com</a><!-- m --> and used css to change the style of her page. The only problem was, that whatever style she put for the tables affected all of the tables in the document. Is there any way that she can assign a specific css style or html code to that particular table? <br />
<br />
This is what she used:<br />
<br />
table {border: solid #000000 1px; background-color: transparent }<!--content-->it's likely she defined the style within the head which will take effect on all table tags within the document (like you are seeing now)<br />
<br />
to get around this, specify the table with an inline style or try a name assignment for the style/table<br />
<br />
hope it helps!<br />
chris<pixelmonkey>:monkey:<!--content-->She could, as Pixelmonkey stated, apply an inline style:<br />
<br />
<table style="border: none; color: red;"><br />
<br />
but this is only any good if it is only going to be different once. If she will need to use the changed style in other tables then she should create a pseudo class in her stylesheet:<br />
<br />
.newStyle {border:none; color:red;}<br />
<br />
and then specify it in the table tag where she wants to apply it:<br />
<br />
<table class="newStyle"><!--content-->Using classes is the best solution as it allows you to update the document by changing the style sheet rather than having to edit inline styles in multiple places.<br />
<br />
<br />
Additionally, you should export the CSS to an external file and call it with instructions in the <head> section of the HTML file. Most people use this one, but it can cause problems:<br />
<br />
<link type="text/css" rel="stylesheet" src=http://www.htmlforums.com/archive/index.php/"/path/file.css"><br />
<br />
It is better to use this slightly longer version of this, again placed in the <head> section of the HTML file:<br />
<br />
<meta http-equiv="Content-Style-Type" content="text/css"><br />
<br />
<style type="text/css"><br />
@import url(path/file.css);<br />
</style><br />
<br />
This version hides the CSS from older versions of Netscape that cannot handle CSS. This stops those versions from displaying a corrupted page with overlapping elements.<br />
<br />
<br />
<br />
External stylesheets mean you can apply the same style to the whole website, editing one stylesheet file changes everything, rather than having to edit each page individually.<!--content-->
 
Back
Top