7 TH
7 TH
- The paragraph element
defines a paragraph in HTML. Browsers insert some spaces before and after each paragraph. The paragraph element starts with
(ON tag) and ends with
(OFF tag). HITMLS, the align attribute of thetag is not supported. Horizontal Rule élement
‘element should be in #D2691E
color
text-align: right
justify
pee
aoN
line~ ] mal (Default) line-height; >
meigne | ae oe ae | pumber (a number that will | 14ne-heighe oi
| be multiplied with the current
| font size to set the line height)
| length (a fixed line height in
| Px, pt, cm)
| percentage value (the line
| height in percentage of
current value)
~ [see none (default; defines normal | text-decoration, =
| decoration | decorations that are | text) text-decoration, .
added to the text underline (defines a line
| — underlining, line | below the text)
| through, etc. coverline (defines a line above
the text)
line-through (defines a line
b | through the text)
text~ | Specifies alist of | none/Color name/Color value | text-shadow: 2 > =|
shadow shadow effects to be oy
f { applied to the text
text- | Controls the none (default; the text appears | text-transform: Capital;
| transform | capitalization of text _| as itis)
capitalize (the first character
of each word in uppercase)
‘uppercase (all characters in
uppercase)
lowercase (all characters in
lowercase)
Let us discuss these properties in detail.
The Color Property -_
This property specifies the for
following ways:
Predefined color names Predefined colour names like, green,
etc., can be used for colour specification in CSS, For example,
Hexadecimal color values Hexadecimal color values are sp
(green), and BB (blue) are the components of the colour and
example, color: #00FF00
RGB color values RGB color values are sp
and blue should be from 0 to 255 ora
(165, 42,42) and color: rgb (08,1008,
red, blue, aqua, grey, maroon, yelo%
reground colour of the text. The colours can be defined in ‘one of the
and color: navy
BB, where RR (red), 6
between 0 and FF."OO —<— =
i” ign Property
the following example code t¢
» 10 Set the toxt, ij
pe eyner"eent/onn"> Ne toxtalign property (or different HTML elements
al
eee justify) ( Old you Know? @
acstnse: ener —
align: left oper assigned he value “us
—" , tach line i stretched to ensure eal
4 (textratign: right) ‘width, asin che ease of newspapers
N nage
ejatyle?
hove code tells the browser thatthe
Teste lyre atthe paragraph text is justified, heading level two is centre-aligned,
ancl heading level four is rightealigned.
ie tine-height Property
Consider the following code to set the line-height property for the paragraph tag:
eatyle types “text/cas">
p (line-height: 10px}
his code specifies that the line height for the paragraph has been set to 10 px.
ther values that can be assigned to this property are given below:
Normal This specifies a normal line height. This is the default value,
Length This specifies a fixed line height in px, pt, or cm.
The line height is in percentage of the current font size.
-decoration Property
ing example code will make you understand the text-decoration property, for the heading tag:
type= “text/css”> i ag
decoration: underline)
“The underline ..
coration: overline} ‘no longer valid in HTMLS. Instead the
property text-decoration is
oration: line-through} ‘used now.
h the heading level one will be unetined heading level wo will havea line above
three will have a line through it.
erty
applies shadow to the text ‘The syntax for this property is:
y v-shadow color
wmjorizontal shadow
where
alow
; ion of h
h-shadlow specifies the position of He
y-shadow specifies the position of vertical s
» shadow
color specifies the colour of the shado
For example,
adow, 2px specifies the Posi
text-shadow: 4px 2px gree! ion of horizontal sh
In the above example, 4px specifies the positior
he shadow.
vertical shadow, and green specifies the color of th erty for different HTML elements,
Consider the following code to set the text-shadow prop :
The Text-transform Property .
lowercase. Consider the following Code}
This property can have values — none, capitalize, uppercase,
set the text-transform property for different HTML elements:
Democracy is a form of the
their rulers. In a democracy, only leaders elected Py
the country. People have the freedom to express views,
organise and freedom to protest. Heading level six
Comment Tag
HTML comments are not displaye' r
Comments are usually written to provide Poa al
Very useful for understanding the code by anyone who a
-->. This is how a comment Is entered:
1d by the browser. Any text placed as a comment will be ignored.
bout the HTML code. These comments would be
ccesses it in future.
The comment tags are 1e text on a Web page. For examp|
TEHT FORMATTING TAGS
or you may want it to appea,
Text formatting allows you to change the
> a word by making it bold
lable in HTMLS
appearance of th
or underlining it,
are discussed below.
le
* You
May
ie fou
\want to empha
Various text formatting tags avail:
Bold and Italics Tags .
The tags for eee text as bold and italics are and respectively. They are containg,
elements. For example,
This text is in bold
This text is in italics
You can even combine these tags. For example,
write it like this:
This text is in bold and is also in italics
if you wish to make the text bold and italic, You ¢.
7 YOU can
The output would be:
This text is in bold and is also in Italics
More Text Formatting Tags
‘Some more tags for formatting the text are explained in Table 7.1.
Table 7.1 More text formatting tags
Tag Description Example Output a
tag / The tag defines | Foundation | Foundation of Information Technol
the title ofa book,a | of Information by Oxford University Press, India
movie, a song, etc. Technology :
by Oxford |
University Press, |
India.
tag _| This tag is used to Emphasized
emphasize the text. | Text Emphasized Text
| Defines important Strongly “yl
tas
8 text and emphasizes Emphasized Text Strongly Emphasized Text
strongly than the | |
tag J
tag | Defines a piece of
This is a “9
computer code Computer Code This is a Computer Code |
mae
‘n> tag | Defines a defini —~?
re lefinition
She sings | She sings
She sings | z
ae she sings
sings ae
sings
TEHT PROPERTIES USING CSS
The various text properties in HTMLS provide you with different text formatting options to format the
text on a Web page. Let us discuss these properties in detail. The following table (Table 7.2) shows these
text properties, their description, and their possible values.
Table 7.2 Text properties using CSS
a Specifies the
etign horizontal alignment
of text or block of text
L__Joftextorblock oftex |
Property Description Values Examples
color | Specifies the Color name/Hexadecimal |
This tells the browser that the text
‘of the HTML element should
be in purple and text of the
Democracy
government that allows people to choose
people rule
freedom to
A democratic government rules within limits set by ional law and constitut citizen's rights.
pest oe oy erence i pees aa I. eg Ce ed ey acaseanoleth | AInaehp er atta ind open sagen Naas ye Web pT iia cer ons set by constitutional lw and 2. Save the documer 3. Open Intemet Explorer ai example html. The view in th browser will be as shown in the figure alongside,ING CSS FONT PROPERTIES US! is different from text? Font means the shapes of the characters While i, Do you know how font is dil font. Using Font properties, you can change the font, r Mey mee ia nate through Table 7.3- ns A isc ? — Table 7.3 Font properties FR ee eet ee ea Example a teeey ey ar font-style, font-variant, font-size, [fonts bole ge oa fies all the , Pee ~ | as font family E a Ge F. font= Specifies alist of ont names | font name ont~faniiy, = ae II / small / a — = : i >xx-small /x-small / sm: ice. font-size | Specifies the font size medium (default) / large / x-large font-size, te /xx-large / larger / smaller / value font-size, Hine //percentage font-style | Speci le of the font | normal italic / oblique et ‘ont-style | Specifies the sty 1 i DL igig ‘The font property is used to set all the font-related properties in one declaration, Its syntax is: font: font-style font-size font-family where, font-style specifies the font style for the text and can take the values normal, italic, or Oblique ‘The default value is normal. le toa pray hei font and can ke ny oe othe values gen the sn table. Ifyou specify an absolute value for this Property, then you can give the value in any unit, such x Px and pt. : font-family: arial, “times New Roman” Pecan Pepe ese ef tet Fr ample Consider the following code to set the font 7 oo HTML elements: ee, Bicecss SETTING MARGINS USING sargin for an HTML element. Let us learn about the, ‘Margin properties can be used to set the marg! foperties through Table 7.4. : 7 ee Table 7.4 Margin properties (crea ves ol Values Example re i - |margin: 10px argin Sets all the margin properties | margin-top, margin: u iat ; na , SPX Spx. 1p, iia screen Fig, margn-botom, | Here the fist value spec | in one declai ee margin, Second value specing¢ tight margin third value spe bottom margin, and the last aj for the leit margin, alu | : S margin-bottom: | margin- | Sets the fixed bottom margin of | length ; g: om: lem | bottom | anelement in px, pt, cm, etc. | Default value is Opx i |margin- | Sets the left margin of an length margin-left: 2cm | left element in px, pt, cm, etc. Default value is Opx 4a zgin- | Sets the right-margin of an length margin-right: 10px | sight element in px, pt, cm, etc. Default value is Opx } |margin- | Sets the top margin of an length margin-top: 3cm . 1 [top element in px, pt, cm, etc. Default value is Opx The margin property is used to set all the margins (left, right, top, and bottom) in one declaration, Consider the following examples: margin: 10px Spx 8px 12px Inthe above example, top margin is 10px, right margin is Spx, bottom margin is 8px, and left marginis 12px. If you write the margin property as margin: 20px 15px then the top and bottom Margins are of 20px and the right and left margins are of 15px. Specifying the margin property as margin: 15px means that all the four margins are of 15px. SETTING BORDERS USING ssbody {background-color: yellow; margin: 50px) P {color:green; text-align: justify; text-height: 87 font-,,. “Comic Sans MS"; font-size: large; border-style: double; bo,4..” color: maroon; border-width: thick} hl(text-align: center; color: blue; text-transform: uppercase, font-family: arial}Carbohydrates provide energy to the body. Some of the source, of carbohydrates are rice, fruits, bread, corn, honey, and whole grains.
Save the document as example3 htm! ‘Open the document example3htm in Internet Explorer. The view in the Web browser will be as shown in the figure given below.ge STS at supports several types of list el ‘ cuent ‘These elements may also pale re different types of lists that we can Create in an HT! jered List An unordered list uses bullets ( ae ements that can be nested, ie, be included in the tag of the One set of elements can be embedded within List An ordered |i ‘symbols) as the list item marker. “i 'Stuses numbers or alphabets as the lst tem marker. aotion List A description list def; pescript 1ption list defines a particular item. jst tem Tad use the list item tag <1i> to define each ite i F r Fi He ist appeas in Web browses in buleted an ene on define lst items withthe <1i> tag, Lotus type the following HTML code to see h Farge 73+ jow the <1i> tag works. You can see the output of the code ptm? gitlerCreating a List