HTML documents are based on the hierarchy of elements that can be graphically represented in the form of a tree. HTML elements may be the parent, child, parent element, child elements as shown in the ITIL 4 Course.
An element is the parent of another element if the hierarchical structure of the document is placed directly over it. An element is an ancestor of another element, if the hierarchical structure of the document it is somewhere above an item.
For example, a document contains two paragraphs p, including the font and bold b. Then the elements of b are children of its parent element p, and the descendants of their ancestors body. In turn, the p body element will be the only parent. Besides, these two elements will be p elements having the same parent – body.
As well as the type of elements that are the first child of another element. Also in CSS, there are four pseudo : the first letter of the first line, the use of special styles before and after the element.
The rules of construction for Cascading Style Sheets (CSS)
In the first three cases, each of the CSS style sheet has two main parts – the selector unit and announcements. The selector is located on the left side which determines which parts of the document are the rule.
Declaration block is located at the right side of the rule. It is placed in braces, and, in turn, consists of one or more ads, separated by ‘ ; ‘. Each ad is a combination of CSS properties and values, separated by ” : “. Selectors can be grouped in a single line separated by commas. This property applies to t each of them as shown in the ITIL 4 Course.
Also, there are so-called CSS universal selector indicating any element found in the document. For example, * {color: red;}. Before any selector that specifies a class or ID, you can put the sign of the universal selector, the result is an equivalent expression, for example,. First {…} and *. First {…} have the same meaning.
Priorities styles
Applying Cascading Style Sheets (CSS) to HTML documents based on the principles of inheritance and cascading. The principle of inheritance is that the properties of CSS, declared for the ancestor elements are inherited by the descendants of the elements.
But, not all Cascading Style Sheets properties are inherited – for example, if a paragraph p tag comes with a CSS given frame, it will not be inherited by any tag. But if p section has CSS font color (eg , color: green ;), then the property will be inherited by each element, tag, located in a paragraph.
Leave a Reply