I have added a table style in my stylesheet that uses borders and padding.

table {

Now I want to use a table but with none of the styles set in the stylesheet. Can I overload these styles without having to explicitly set each one?



1 answer

Tony B 86

Just add an ID or class to the table that you want to style and create the appropriate CSS in your stylesheet. Try this:

#table1 { border:1px solid #000; }
.table1 { border:1px solid #000; }

and in your html just add:

<table id="table1"> or <table class="table1">

This way you are targeting a specific table instead of every table. I recommend reading up on specificity and the benefits of using IDs and classes.

Answered over 8 years ago by Tony B