Sei sulla pagina 1di 2

Font Style

The Iont-style property is mostly used to


speciIy italic text.
This property has three values:
O normal - The text is shown
normally
O italic - The text is shown in italics
O oblique - The text is "leaning"
(oblique is very similar to italic,
but less supported)
Example
p.normal Iont-style:normal;}
p.italic Iont-style:italic;}
p.oblique Iont-style:oblique;}

Font Family
The Iont Iamily oI a text is set with the
Iont-Iamily property.
Note: II the name oI a Iont Iamily is more
than one word, it must be in quotation
marks, like Iont-Iamily: "Times New
Roman".
More than one Iont Iamily is speciIied in
a comma-separated list:
Example
pIont-Iamily:"Times New Roman",
Times, seriI;}

Set Font Size With Pixels
Setting the text size with pixels, gives you
Iull control over the text size:
Example
h1 Iont-size:40px;}
h2 Iont-size:30px;}
p Iont-size:14px;}

Different List Item
Markers
The type oI list item marker is speciIied
with the list-style-type property:


Example
ul list-style-type: circle;}
ul list-style-type: square;}

ol list-style-type: upper-roman;}
ol list-style-type: lower-alpha;}
The id Selector
The id selector is used to speciIy a style
Ior a single, unique element.
The id selector uses the id attribute oI the
HTML element, and is deIined with a "#".
The style rule below will be applied to the
element with id"para1":
Example
#para1

text-align:center;
color:red;
}
The class Selector
The class selector is used to speciIy a
style Ior a group oI elements. Unlike the
id selector, the class selector is most oIten
used on several elements.
This allows you to set a particular style
Ior many HTML elements with the same
class.
The class selector uses the HTML class
attribute, and is deIined with a "." In the
example below, all HTML elements with
class"center" will be center-aligned:
Example
.center text-align:center;}



hLml
head
sLyle LypeLexL/css
#para1

LexLallgncenLer
colorred

/sLyle
/head
body
p ldpara1Pello World!/p
p1hls paragraph ls noL affecLed by Lhe
sLyle/p
/body
/hLml
















hLml
head
sLyle LypeLexL/css
cenLer

LexLallgncenLer

/sLyle
/head

body
h1 classcenLerCenLerallgned
headlng/h1
p classcenLerCenLerallgned
paragraph/p
/body
/hLml

Potrebbero piacerti anche