You are currently viewing the CSS Cascading Style Sheets section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .

2. Class name. Identify the tag's class that the style applies to. For this you need to specify the class in the element's markup (<TD class="RedBG">):
.RedBG{
background-color: #FF0000;
}

3. Object ID. Identifies a specific element by ID to which the style applies. For this you specify the tags ID attribute (<span id="PageHeader">):
#PageHeader{
font-size: 36px;
color: #00FF00;
}
Usually, you would have only one element with that ID on the page otherwise you'd have a ID conflict that could cause other problems.

You can combine style identifiers to be more specific:

TABLE#MasterLayout{}
TD.Header{}

and chain them together to create complex styles with simple style syntax:

TABLE#MasterLayout TD.Header{}

In this case, the "TD.Header" style will be different for TD tags with the "Header" class when they exist under a table with the "MasterLayout" ID.

CSS stands for Cascading Style Sheets. CSS was invited by Hakon Wium Lie on October 10, 1994 and maintained through a group of people within the W3C called the CSS Working Group. The CSS Working Group creates documents called specifications. When a specification has been discussed and officially ratified by W3C members, it becomes a recommendation. css tutorials pdf CSS is used to define styles for your web pages, including the design, layout and variations in display for different devices and screen sizes. CSS describes how HTML elements are to be displayed on screen, paper, or in other media. CSS is easy to learn and understand but it provides powerful control over the presentation of an HTML document. Most commonly, CSS is combined with the markup languages HTML or XHTML.

CSS files are termed “cascading” stylesheets because of two reasons: one stylesheet can cascade, or have influence over, multiple pages. Similarly, many CSS files can define a single page. We can apply CSS in 3 ways such as Internal CSS, Inline CSS and External CSS.

CSS is designed primarily to enable the separation of document content from document presentation, including aspects such as the layout, colors, and fonts. This separation can improve content accessibility, provide more flexibility and control in the specification of presentation characteristics, enable multiple HTML pages to share formatting by specifying the relevant CSS in a separate .css file, and reduce complexity and repetition in the structural content. Separation of formatting and content makes it possible to present the same markup page in different styles.https://en.wikipedia.org/wiki/Cascading_Style_Sheets

In the HTML document, you can give a particular id to an HTML element. For example, you have many <h2> on your page. You want to style one particular <h2> with red color when someone clicks a button on the page. This effect is achieved using JavaScript.
To get this effect, you have to give an ID to identify the particular <h2>. you can give an id like redheading.

You can call this particular <h2> in CSS and JavaScript, using this ID.

To do that you have to use the # symbol followed by the id name. This targets the <h2> with that ID.