Friday, March 31, 2017

CSS Rules and Selectors

Hello world 
welcome back to edankeun.com

Now we going to CSS Syntax CSS is composed of style rules that the browser interprets and then applies to the corresponding elements in your document.
A style rule has three parts: selector, property, and value.
For example, the headline color can be defined as: h1 { color: blue; }Type Selectors The most common and easy to understand selectors are type selectors.
This selector targets element types on the page. For example, to target all the paragraphs on the page: p { color: red; font-size:130%; } id and class Selectors id selectors allow you to style an HTML element that has an id attribute, regardless of their position in the document tree. Here is an example of an id selector: The HTML:
This paragraph is in the intro section.
This paragraph is not in the intro section.
The CSS: #intro { color: white; background-color: gray; } lass selectors work in a similar way. The major difference is that IDs can only be applied once per page, while classes can be used as many times on a page as needed. In the example below, both paragraphs having the class "first" will be affected by the CSS: The HTML:
This is a paragraph
This is the second paragraph.
This is not in the intro section
The second paragraph is not in the intro section.
The CSS: .first {font-size: 200%;} Descendant Selectors These selectors are used to select elements that are descendants of another element. When selecting levels, you can select as many levels deep as you need to. For example, to target only elements in the first paragraph of the "intro" section: The HTML:
This is a paragraph.
This is the second paragraph.
This is not in the intro section.
The second paragraph is not in the intro section.
The CSS: #intro .first em { color: pink; background-color:gray; } i think just this our material thanks for your attention see you next time

Related Posts

CSS Rules and Selectors
4/ 5
Oleh