Must see Examples

 

W3 schools provide most important web based functionalities please see the below link

https://www.w3schools.com/howto

Advertisements

CSS most Important Questions

Explain what elements will match each of the following CSS selectors:

  1. div, p
  2. div p
  3. div > p
  4. div + p
  5. div ~ p

 

  1. div, p – Selects all <div> elements and all <p> elements
  2. div p – Selects all <p> elements that are anywhere inside a <div> element
  3. div > p – Selects all <p> elements where the immediate parent is a <div> element
  4. div + p – Selects all <p> elements that are placed immediately after a <div> element
  5. div ~ p – Selects all <p> elements that are anywhere preceded by a <div> element

 

2. Explain the CSS “box model” and the layout components that it consists of.

Provide some usage examples.

 

The CSS box model is a rectangular layout paradigm for HTML elements that consists of the following:

Content – The content of the box, where text and images appear
Padding – A transparent area surrounding the content (i.e., the amount of space between the border and the content)
Border – A border surrounding the padding (if any) and content
Margin – A transparent area surrounding the border (i.e., the amount of space between the border and any neighboring elements)
Each of these properties can be specified independently for each side of the element (i.e., top, right, bottom, left) or fewer values can be specified to apply to multiple sides. For example:

/* top right bottom left */
padding: 25px 50px 75px 100px;

/* same padding on all 4 sides: */
padding: 25px;

/* top/bottom padding 25px; right/left padding 50px */
padding: 25px 50px;

/* top padding 25px; right/left padding 50px; bottom padding 75px */
padding: 25px 50px 75px;

 

3. Given the following HTML:

div id=”page”>
h1>Heading Title</h1>
h2>Subheading Title</h2>
h2>Subheading Title</h2>
h1>Heading Title</h1>
h2>Subheading Title</h2>
h1>Heading Title</h1>
/div>

How could you use CSS to achieve the following automatic numbering:

1) Heading Title
1.1) Subheading Title
1.2) Subheading Title

2) Heading Title
2.1) Subheading Title

3) Heading Title

 

The following CSS will achieve this type of automatic numbering:

#page {
  counter-reset: heading;
}

h1:before {
  content: counter(heading)") ";
  counter-increment: heading;
}

h1 {
  counter-reset: subheading;
}

h2:before {
  content: counter(heading)"." counter(subheading)") ";
  counter-increment: subheading;
}

 

4. In CSS3, how would you select:

  • Every <a> element whose href attribute value begins with “https”.
  • Every <a> element whose href attribute value ends with “.pdf”.
  • Every <a> element whose href attribute value contains the substring “css”.

 

In CSS3, how would you select:

  • Every <a> element whose href attribute value begins with “https”.
  • Every <a> element whose href attribute value ends with “.pdf”.
  • Every <a> element whose href attribute value contains the substring “css”.