The HTML style
is used to change or add some style on HTML element. Giving style by ourself will overwrite the default style of the elements.
Some basic css properties are - color
, background-color
,
text-align
, font-size
etc.
These are the three methods of implementing styling information to the HTML document.
style
attribute in the HTML tag itself.<style>
tag inside the <head>
section of the document.<link>
tag, to add an external CSS file in the webpage.Inline CSS style is applied directly within the tag itself by using the style
attribute. The style
attribute is applied in the opening tag of the paired tags, and anything b/w opening-closing tag will get the specified style.
The style attribute gives multiple pairs of property: value
separated by a
semicolon (;
) in a single line.
Embedded or internal style sheets only works on the webpage they are embedded in.
It can be defined anywhere in the webpage within <html>
tags, but usually are defined in the <head>
section of an HTML document using the <style>
tag. Try the example below-
This is a paragraph.
An external style sheet is used when we have to apply the same css style to different webpages. An external style sheet holds all the style rules in a separate document that you can link to any HTML file. This way only one file can be used multiple times, and only a simple change in that file can make changes in all the pages it is linked to.
This is a Paragraph.
The font-size
property defines the different font size to be used for an HTML element
This is a Paragraph.
Follow Us: