Monday, October 24, 2016

Interview Questions for CSS -2- Answers



Back

Q1. Answer: The class selector is used to specify a style for a group of elements.

Q2. Answer: The class selector uses the HTML class attribute and it is define with a ".".

Example: All HTML elements with class="centre" will be centre aligned

.centre{text-align:center;}

Q3. Answer: Inline Style is used the style attribute in the relevant tag. The style attribute can contain any CSS property.

Example: <p style="color:red;margin-left:15px;">This is an Inline Style.</p>

Q4. Answer: An internal style sheet should be used when a single document has a unique style. An internal style sheet is used in the head section of an HTML page. It define in the <Style> tag.

Example: <head>
                     <style>
                                   hr{color:red;}
                                   p{margin-left:15px;}
                  </style>
                  </head>
Q5. Answer: An External Style sheet is a file which save with ".css" extension. All style format write in it for all web page and access in HTML page through <link>tag. This file should not contain any HTML tags.

Example: The <link> tag goes inside the head section:
                 <head>
                   <link rel="stylesheet" type="text/css" href="ssheet.css">
                  </head>
                   In CSS ssheet.css
                       hr{color:red;}
                       p{margin-left:15px;}

No comments:

Post a Comment