Click here to Skip to main content
15,902,114 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<style>
table.skinned tr th.name {
        width: 400px;
    }
</style>

in the above code i am not able to understand the use of .name. in the remaining code these is no keyword is used with name. can you please suggest what is the purpose of .name
Posted

It's really very simple, and likely something you'll have no trouble searching for later on.
What that rule basically says is:

a) target a table/tables with the class='skinned'
b) inside that/those tables, apply the style to the th element that has the class='name'

Basically -
■ If there's no dot (.) or hash (#) you target an element type (E.g: a, p, td, div etc)

■ If there's a dot (.) you target an element with the class that follows the dot. (E.g: .active, .someClass, .hilighted)

■ If there's a hash (#) you target an element with the id that follows the hash (E.g: #myOutput, #idOfSingleElement, #resetBtn, etc, etc)


Where you have something like
table.skinned, you're looking for a table element with the class of skinned

When you have table tr th, you're looking for a th element that is contained in a tr element that's contained in a table element - This could reasonably be simplified to th

In your case, the css is also a little verbose - you could target the exact same elements (no more and no less) with the following:
<table>table.skinned th.name - the rationale being that you only want th elements with a specific class, _so long as_ they exist in a table element with the class of skinned. Since th elements have to exist in a tr element, and you don't want specific tr elements, you don't need to specify the <cod>tr - it's implied or assumed.
 
Share this answer
 
Did you find the following in your html code?
<th class="name">

It is fine if it is not found, then you can remove th.name from the css.
Refer: css_selectors[^]
 
Share this answer
 
v5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900