Internal stylesheets in css

web development

Thursday 11 March 2021
Hacker

web development

INTERNAL STYLE SHEETS IN CSS

Inline CSS : Main Tips

  • The inline CSS helps you apply style rules to specific and single HTML elements.
  • In html web page , The style attribute specifies properties and values of CSS.
Internal stylesheets in css




Introduction to Inline CSS

An inline CSS is used to apply a unique style to a particular single HTML element.

An inline CSS uses the <style> attribute of an HTML tag.

Syntax:

  1. <htmltag style="cssproperty1:value; cssproperty2:value;"> </htmltag> 

The following example sets the text color of the <h1> element to blue, and the text color of the <p> element to red:

Example

<h1 style="color:blue;">A Blue Heading</h1>

<p style="color:red;">A red paragraph.</p>

We can apply CSS style in a single element by inline CSS technique.

The inline CSS ( cascading stylesheets ) is also a method to insert style sheets in HTML page or document. This method mitigates some advantages of css style sheets.

If you want to use inline CSS, you should use it by the style attribute to the relevant tag.

Advantages of Inline CSS

  1. An Inline CSS styles will always override style properties determined in external or Internal style sheets.

Disadvantages of Inline CSS

  • You can't use quotations within inline CSS. If you were use quotations the browser will interpret this as an end of your inline style value.
  • These CSS styles cannot be reused anywhere else.
  • These styles is tough to be edit because they are not store at a single place.
  • In Inline CSS , It is not possible to style pseudo classes and pseud codes with inline CSS.
  • Inline CSS doesn't provide browser cache benefits.




web development

No comments:

Post a Comment

web development

web development