Styles in HTML

Styles in HTML

Style sheets describe the presentation of elements of a web page on screens, in print, or any other media and are actively promoted by W3C.

Cascading Style Sheets (CSS) is a style sheet mechanism which is used for this purpose.

In CSS, a number of style properties of a element can be specified. Each property has a name and a value, separated by a colon (:) and each property declaration is separated by a semi-colon (;).

<h1 style=”font-size:24px; color:red “>Vskills</h1>

Using Styles

Styles can be applied in three ways in a webpage as

External Style Sheet – A separate file stores all the style sheet rules and is included in all the web pages on which styles is to be applied. <link> tag is used to include a style sheet file in a web page in the head region as

<head>

<link rel=”stylesheet” type=”text/css” href=”style.css”>

</head>

Internal Style Sheet – To apply style rules to a single web page then they can be given in the web page’s head section enclosed in the opening and closing <style> tag as

<head>

<style type=”text/css”>

h1{background-color: pink;}

h2{color:blue; 20px;font-size:24px;}

</style>

</head>

Inline Style Sheet – Style rules can directly be applied to an element in web page by placing the style attribute with appropriate style rules. It is used to make a change in particular element only. The style attribute is used for applying it as shown

<h1 style=”color:blue;font-size:23px;”>Vskills</h1>

Share this post
[social_warfare]
HTML Colors
Scripts in HTML

Get industry recognized certification – Contact us

keyboard_arrow_up