Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<style> tag issues

Status
Not open for further replies.

tmcneil

Technical User
Nov 17, 2000
294
US
I found some code that creates a scrollable table that is formatted using a <style> tag. The problem is, the <style> tag formats other tags on the page that I do not want it to. I only want it to format the scrollable table. Is there a way around it to get it to do what I want?

Code:
<style>
    table {
        text-align: left;
        font-size: 12px;
        font-family: verdana;
        background: #c0c0c0;
        }

    table thead  {
        cursor: pointer;
        }

    table thead tr,
    table tfoot tr {
        background: #c0c0c0;
        }

    table tbody tr {
        background: #f0f0f0;
        }

    td, th {
        border: 1px solid white;
        }
</style>

Thanks,
Todd
 
Thanks johnwm,

I was able to use that link and figure it out to get it to do what I want.

Code:
<style type="text/css">
    table.scrollTable {
	text-align: left;
	font-size: 12px;
	font-family: verdana;
	background: #c0c0c0;
        }

    table.scrollTable thead.tHead  {
	cursor: pointer;
	}
    
    table.scrollTable thead.tHead tr.tR,
    table.scrollTable tfoot.tFoot tr.tR {
	background: #c0c0c0;
	}

    table.scrollTable tbody.tBody tr.tR {
	background: #f0f0f0;
	}

    table.scrollTable tbody.tBody tr.tR td.tD,
    table.scrollTable thead.tHead tr.tR th.tH {
	border: 1px solid white;
	}
</style>

Thanks and I just learned something new today. :)
Todd
 
You don't have to add a class to everything, just the <table> should be enough:
Code:
    table.scrollTable {
        text-align: left;
        font-size: 12px;
        font-family: verdana;
        background: #c0c0c0;
        }

    table.scrollTable thead  {
        cursor: pointer;
        }

    table.scrollTable thead tr,
    table.scrollTable tfoot tr {
        background: #c0c0c0;
        }

    table.scrollTable tbody tr {
        background: #f0f0f0;
        }

    table.scrollTable td, table.scrollTable th {
        border: 1px solid white;
        }
For example, the last rule applies a white border to <th> and <td> elements only when they are within a <table class="scrollTable"> element.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top