css11.How to select all paragraph elements with a lang attribute?
p[lang] : Selects all paragraph elements with a lang attribute.

12.How to select all paragraph elements whose lang attribute contains the word “fr”?

p[lang~=”fr”] – Selects all paragraph elements whose lang attribute contains the word “fr”.

13.How to select all paragraph elements whose lang attribute contains values that are exactly “en”, or begin with “en-“?
p[lang|=”en”] – Selects all paragraph elements whose lang attribute contains values that are exactly “en”, or begin with “en-“.

14.What are the various ways of using CSS in an HTML page?
There are four ways to associate styles with your HTML document. Most commonly used methods are inline CSS and External CSS.

Embedded CSS − The <style> Element: You can put your CSS rules into an HTML document using the <style> element.

Inline CSS − The style Attribute: You can use style attribute of any HTML element to define style rules.

External CSS − The <link> Element: The <link> element can be used to include an external stylesheet file in your HTML document.

Imported CSS − @import Rule: @import is used to import an external stylesheet in a manner similar to the <link> element.

15.How CSS style overriding works?
Following is the rule to override any Style Sheet Rule −

Any inline style sheet takes highest priority. So, it will override any rule defined in <style>…</style> tags or rules defined in any external style sheet file.

Any rule defined in <style>…</style> tags will override rules defined in any external style sheet file.

Any rule defined in external style sheet file takes lowest priority, and rules defined in this file will be applied only when above two rules are not applicable.

16.What is the purpose of % measurement unit?
% – Defines a measurement as a percentage relative to another value, typically an enclosing element.

p {font-size: 16pt; line-height: 125%;}

17.What is the purpose of cm measurement unit?
cm − Defines a measurement in centimeters.

div {margin-bottom: 2cm;}

18.What is the purpose of em measurement unit?
em − A relative measurement for the height of a font in em spaces. Because an em unit is equivalent to the size of a given font, if you assign a font to 12pt, each “em” unit would be 12pt; thus, 2em would be 24pt.

p {letter-spacing: 7em;}

19.What is the purpose of ex measurement unit?
ex − This value defines a measurement relative to a font’s x-height. The x-height is determined by the height of the font’s lowercase letter.

p {font-size: 24pt; line-height: 3ex;}

20.What is the purpose of in measurement unit?
in − Defines a measurement in inches.

p {word-spacing: .15in;}

 

You may also like

Leave a Comment