Techie Weblog

Web Hosting & Network Security Guide

How to Write Inline CSS Rules

If you like the post, Please Share

Facebooktwittergoogle_pluspinterestlinkedin

How to Write Inline CSS Rules

How to Write Inline CSS Rules

What is Inline CSS.

How to Write Inline CSS Rules

How to Write Inline CSS Rules

Almost everyone in the world of computer knows what is CSS as it stands for  stands for Cascading Style Sheets. It’s a style sheet in which it it defined  how to display HTML elements. Inline CSS has the highest priority out of the three ways you can use CSS: external, internal, and inline. An inline style loses many of the advantages of style sheets by mixing content with presentation. To use inline styles we use the style attribute in the relevant tag. The style attribute can contain any CSS property. Details can be found at  HTML CSS – W3Schools

How to Write Inline CSS Rules

If you use Internal CSS, the page size increases but it helps only to Designers while working offline but when the website goes online it consumers much time as compared to offline. Though, there are less HTTP Request but by using the Internal CSS the page load slow as compared to Inline and External CSS. So, it is a good practice to move all the inlines CSS rules into an external file in order to make your page “lighter” in weight and decrease the code to text ratio.

  • check the HTML code of your page and identify all style attributes
  • for each style attribute found you must properly move all declarations in the external CSS file and remove the style attribute

For example:

<!–this HTML code with inline CSS rule:–>

<p style=”color:red; font-size: 12px”>some text here</p>

<!–would became:–>

<p>some text here</p>

<!–and the rule added into your CSS file:–>

p{color:red; font-size: 12px}

But remember one thing – While using CSS inline you should not to use quotations within your inline CSS. If you use quotations the browser will wrongly interpret that it is the end of your style value, eventually, the inline CSS code will not work!

***How to Write Inline CSS Rules***

Updated: January 8, 2016 — 2:46 pm

The Author

Sukanta Dutta

The author is writing technical blog for last few years. He shares his knowledge on Computer Networks, Database Technologies, Security Aspects of Network and Database etc. He also likes to hear from the reader of this blog to learn more, so he welcomes guest writing for this blog.

Leave a Reply

Your email address will not be published. Required fields are marked *

Techie Weblog © 2015-2016 Frontier Theme