Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fastest way to use css for html table without affecting another html table

Tags:

html

css

My css is located at http://sillybean.net/css/seaglass.css and i want to use this css for only one of html table, On the same page i have multiple html tables so i do not want to affect other html tables. What is the fastest way to do it with less modification on http://sillybean.net/css/seaglass.css ?

like image 565
cometta Avatar asked Jun 19 '09 05:06

cometta


People also ask

Can you use CSS to style an HTML table?

CSS provides a number of attributes for styling tables. These attributes allow you to—among other things—separate cells in a table, specify table borders, and specify the width and height of a table. This tutorial will discuss, with examples, how to style a table using CSS.

What is the advantage of using tables in CSS compared to using tables in HTML?

HTML tables are exclusively for tabular data you want to implement into your site. This was the original intention behind their design. CSS styling is needed to enhance the table on an HTML website correctly. Table tags only assemble words or media into a grid pattern and do not have grid lines by default.

Can you make an HTML table responsive?

You can just wrap your <table> tag inside of <div class="table-responsive"></div> since you're using bootstrap. Just like this: (use <table> instead of grid system (e.g. col-xs-1 etc.)) .. That's it!


1 Answers

Can you just apply a class to the table you want to affect, then use that class in your CSS?

In your HTML, you can put:

<table class="mytable">
... CONTENT OF THE TABLE, AS NORMAL ...
</table>

And then, add the class selector to your CSS:

table.mytable { border-collapse: collapse; border: 1px solid #839E99;
                background: #f1f8ee; font: .9em/1.2em Georgia, "Times New Roman", Times, serif; color: #033; }
.mytable caption { font-size: 1.3em; font-weight: bold; text-align: left; padding: 1em 4px; }
.mytable td,
.mytable th { padding: 3px 3px .75em 3px; line-height: 1.3em; }
.mytable th { background: #839E99; color: #fff; font-weight: bold; text-align: left; padding-right: .5em; vertical-align: top; }
.mytable thead th { background: #2C5755; text-align: center; }
.mytable .odd td { background: #DBE6DD; }
.mytable .odd th { background: #6E8D88; }
.mytable td a,
.mytable td a:link { color: #325C91; }
.mytable td a:visited { color: #466C8E; }
.mytable td a:hover,
.mytable td a:focus { color: #1E4C94; }
.mytable th a,
.mytable td a:active { color: #fff; }
.mytable tfoot th,
.mytable tfoot td { background: #2C5755; color: #fff; }
.mytable th + td { padding-left: .5em; }
like image 130
MiffTheFox Avatar answered Sep 24 '22 03:09

MiffTheFox