Solved

adding css to certains rows of a html table

Posted on 2016-07-15
5
66 Views
Last Modified: 2016-07-16
I have a html table called Table 1

#Table1 td {     border: 1px solid #0000ff; }

That css says color the border of every column in the table.

How would i do the following?

Color the border of every column in Table 1 that is not in row 1
Color the border this color #0000ff
0
Comment
Question by:maqskywalker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 7

Expert Comment

by:Thomas Wheeler
ID: 41713561
you want to use
tr > td:first-child 

Open in new window

check this out https://jsfiddle.net/wgrk1xpf/
0
 
LVL 7

Assisted Solution

by:Thomas Wheeler
Thomas Wheeler earned 250 total points
ID: 41713567
after rereading I may have miss understood. Here is an update
https://jsfiddle.net/wgrk1xpf/1/
0
 
LVL 20

Accepted Solution

by:
Russ Suter earned 250 total points
ID: 41713639
Put this in your CSS
#table1 tr:nth-child(n+2) td
{
   border: 1px solid #0000ff;
}

Open in new window

This will set the border of any <td> element inside any <tr> element that is the 2nd or greater child of the <table id="table1"> element.
It will ignore the 1st row and no other CSS is needed to format your table this way.
Here's a handy website that gives you a fairly thorough set of examples of what the nth-child CSS selector can do: http://nthmaster.com/
0
 
LVL 1

Author Closing Comment

by:maqskywalker
ID: 41714822
Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question