Explain about style sheets in HTML.


    Explain about style sheets in HTML.
A Stylesheet is a command or set of commands used to control the appearance and
layout of various elements on webpages, as well as simplify webpage design by
avoiding redundancy. Using stylesheets you can set the color and font of text,
the size of form textboxes, the margin between various elements on a webpage,
and much more.
The various stylesheet commands

Stylesheet commands are what actually makes stylesheets work - they control the appearance and layout of elements on a webpage.

Stylesheet Commands
Command
Usage
Possible values
color
sets the color of text
any color value in hexadecimal preceded by the # sign (ex. #FFFFFF) or words (ex. green),.
text-align
sets the alignment of text
left, right, center, or justify
font-family
denotes a list of font-family names
font-family name or generic-family (such as Verdana, Helvetica, Courier)
font-size
denotes the size of text
small, medium, large, length(pt), (in), (cm), (px), or % preceded by a numeric value.
background-color
sets the background color of elements
any color value in hexadecimal preceded by the # sign (ex. #FFFFFF) or words (ex. green)
background-image
denotes a background image
the word url preceded by the url of the image in parentheses, the word none for no image


Cascading Style Sheets (CSS) describe how documents are presented on screens, in print, or perhaps how they are pronounced. W3C has actively promoted the use of style sheets on the Web since the consortium was founded in 1994.
Cascading Style Sheets (CSS) provide easy and effective alternatives to specify various attributes for the HTML tags. Using CSS, you can specify a number of style properties for a given HTML element. Each property has a name and a value, separated by a colon (:). Each property declaration is separated by a semi-colon (;).
Example
First let's consider an example of HTML document which makes use of tag and associated attributes to specify text color and font size −
   
      HTML CSS
   
   
      Hello, World!
   
We can re-write above example with the help of Style Sheet as follows −
   
      HTML CSS
   
   
      
Hello, World!
   

You can use CSS in three ways in your HTML document −

·        External Style Sheet − Define style sheet rules in a separate .css file and then include that file in your HTML document using HTML tag.
·        Internal Style Sheet − Define style sheet rules in header section of the HTML document using

Related

Web Technology 455369544871013528

Post a Comment

emo-but-icon

Follow Us

item