10th Class Computers Working with CSS Inserting a Style Sheet

Inserting a Style Sheet

Category : 10th Class

*   Inserting a Style Sheet

 

 

CSS enables three ways to insert a style sheet:

  • Inline style
  • External style sheet
  • Internal style sheet  

 

* Inline style

Use this method carefully because it mixes the content with presentation. To use inline style you need to use the style attributes in the relevant tag. The following code snippet shows how to change the colour and right margins of given text: lndia is the greatest country.  

India is the greatest country.

 

* External style sheet

An external CSS style sheet contains CSS style rules. These rules are applied to HTML element on Web pages.  

 

* To add an external CSS style sheet: 

  • Select the Web project.
  • On the Project menu, click Add New Item to open the Add New Item dialog box.
  •  Select the Web Project Items in the left pane.
  •  Select the Style Sheet icon in the right pane.
  •  Enter a name for your new style sheet in the Name field.
  •  Select Open.

The following code snippet shows how to add external style sheet: 

<head>

<link rel="stylesheet" type=" totaltext/css" href="p.css">

</head>

 

* Internal style sheet

CSS allows using internal style sheet when a single document teas a unique style. For this you need to define internal styles in the head sector with the  <style>tag. The following code snippet shows how to use internal style sheet:

<head>

<style type="text/css">

 

 

 

 

Question.jpg    

 

 CSS enables three ways to insert a style sheet. It allows using __usingsheet when a single document has a unique style.

(A) Internal style                                             

(B) External style

(C) Inline style                                                  

(D) All of these

(E) None of these  

 

Answer: (a)

Explanations

Correct Option:

(A) CSS allows using internal style sheet when a single document has a unique style.

Incorrect Options:

Therefore, option (A) is correct and rest of the options s incorrect.    

 

 

 ID selector is used for specifying single, unique elements. An ID selector is assigned by using assigned by using the indicator...... to precede a name.

(A) "#"                                                                 

(B) #

(C) *                                                                     

(D) "*"

(E) None of these  

 

Answer: (a)

Explanations

Correct Option:

(A) An ID selector is assigned by using the indicator "#" to precede a name.

Incorrect Options:

Therefore, option (A) is correct and rest of the options is incorrect            

 

 

 Which one of the following statements is true about cascading order?

(A) If two rules have the equal weight, the last specified rule wins

(B) If two rules have the equal weight, the first specified rule wins

(C) If two rules have the equal weight, then both are destroyed

(D) All of these

(E) None of these  

 

Answer: (a)

Explanations

Correct Option:

(A) If two rules have the equal weight, the last specified rule wins.

Incorrect Options:

Therefore, option (A) is correct and rest of the options is incorrect.  

 

 

You Know.jpg 

  • CSS was proposed by Hakon Wium Lie in October 1994.
  • CSS level 1 was published in December 1996.
  • CSS level 3 is currently under development.  

 

 

Important.jpg 

  • CSS Comments: Are used to explain your code line by line.
  • Class Selector: Is used to specify a style for a group of elements.
  • ID Selector: Is used for specifying single, unique elements.  

 

 

Summary.jpg 

  • A style sheet is a set of style rules that tell a browser how to present a document.
  • The CSS comment starts with "/*", and ends with "*/".
  • Class selectors have different classes allowing the same element to have different styles.
  • CSS grouping allows you to minimize the code.

You need to login to perform this action.
You will be redirected in 3 sec spinner

Free
Videos