HTML Inline Styles, Adding Styles

Inline styles have the highest priority and outer style sheets have the lowest priority.
A style code you write in the HTML page overrides the code you create in the css file. The priority is in the style tag in the code.

At the same time, you can write a style in this field in order to add features to your css file.

The Style attribute contains a number of CSS properties and value pairs. attribute: value; it is separated by a semicolon () as you type in an embedded or external style sheet. However, they must all be on one line, that is, there is no line break after the semicolon.
<!-- Basic Usage -->

<h2 style = "color: # 222; font-size: 30px;"> Header </h2>
<p style = "color: gray; font-size: 14px;"> We have defined this font for gray color and 14 pixel font size. </p>
<div style = "color: green; font-size: 18px;"> Many labels can be styled. span, p, a, i, div etc. </div>

<!-- You can use embedded style codes when defining multiple styles to an item -->
<div class = "blog" id = "sonblog" style = "color:red;">
  <p> The div element we wrote above contains class id and style. </p>
</div>

Attention Here

Using inline styles is generally considered a bad practice. The style rules are embedded directly in the html tag, making the presentation confuse with the content of the document, making it very difficult to update or maintain a website.

It is also an undesirable element by search engines.
It is difficult to change the embedded codes when you want to make a responsive site. So if you use an external css configuration, you can edit your styles according to mobile resolution.
E.Albayrak

0 Yorum

Soru & Yorum


Web Tasarım

Renkli Kare

Web Tasarım Ajansı