Académique Documents
Professionnel Documents
Culture Documents
htm file:
1. Useyourtexteditorto openabouttxt.htm folderin yourData
fromthetutorial.OS/tutorial
Files.
Savethefileasabout.htm.
yournaneandthe datein thecomment
2. Enter tagat thetopof thefile.
5. Saveyourchanges yourtexteditoropen.
to thefile,butteave
yourWebbrowser
4. Start Figure
andopenabout.htm. J-2showsthecurrent formatofthepage.
Welcome
Excihng advenhxesawartyou at Arcadrum,yow affordablefamilyfi-rncenter.The park is located 5 milesnorthwestof Derby -
closeto manyofGeorgra'sscenicuronders.Arcadium offers over 50 ndes,:ncludingsome ofthe state'smost excihngroller
coasters andwater rides. There's also plenty offi.rnforthe yor.ugerkrds,includrnglro separateL,rddrepools and specialrides
for thekrds.
-Arcadium is easy on your budget. Compare our low darlyrates to the brg cha:nparks. You cm chooseto pr.rchasea goid
tichetfor any twenty rides, a plabnm hcLet for thirty rides, or for best value, a firll-day pass to nde as marrytimes as you
want,whereveryou want. Specialoff-seasonand largegroup rates are available.
A n a d i u m . H W 1 2 , E x i t 4 9 l . D e r b y , G A 2 0 0 1 0].( 8 0 0 )J J J - 5 4 3 1
ColorValues
Using
A colorvalueis a numericalexpression that preciselydescribes
a color.To betterunder-
standhownumberscan represent colors,it helpsto reviewsomeof the basicprinciplesof
colortheoryand how they relateto the colorsthat your monitordisplays.
White light is made up of three primary colors (red, green, and blue) mixed at equal
llllllll intensities.By adding only two of the three primary colors we can generatea trio of com-
plementarycolors: yellow, magenta,and cyan (seeFigure3-3).To generatea wider range
of colors, we simply vary the intensityof the red, green, and blue light. For example,
orange is createdfrom a high intensityof red light, a moderate intensityof green light,
a n d a n a b s e n c eo f b l u e l i e h t .
1l
ll
,,,,,
*redgreenbJue
g ,r e e n ta n d b l u e a r e t h e h e x a d e c i m avl a l u e s o ft h e r e d , g r e e n , a n d b l u e c o m -
wherered
Thus,thecoloryellowcould be representedeitherby the RGBtriplet(255,255,0)
inthehexadecimalform#FFFF00.
Atthispointyou mightbe wonderingif you haveto becomea mathmajorbeforeyou
$artaddingcolorto yourWeb pages.Fortunately,this is not the case.Youcan specify
in yourWeb pageswith stylesthat useRCBtripletsratherthanthe hexadeci-
colors
form.However, you mayseeHTML codethat setsa color valueto somethinglike
and now you know what that means,even if you can't tell at a glance that it
the color orange.
WhileRCBtriplets candistinguish over16.7millioncolors,the numberof colorsthata
actuallydisplays dependson the user'smonitor.Somemonitorsarecapableof
ingonly256differentcolors,and thusbrowserson thesecomputersare limitedto
r palette,or selection,of colors.When a browserencounters a color not in its
it attemptsto renderthe color usinga processcalleddithering,in which the
combines similarcolorsfrom its paletteto approximatethe originalcolor's
. Dithering can resultin an imagein which individualpixelsstandout,and
fuzzy when compared to the original (seeFigure3-5).
appears
Color dithering
originalimage
dithered image
Close
thepagewhenyouarefinished.
yourcolorselections
Bylimiting to the colorsof the safetypalette,you can be assured
yourimages will appearthe sameto all usersregardless of monitorresolution.
because monitorsnow commonlysupporthighercolor resolutions, the needfor
safetypaletteis not asgreatas it once was.
Color Name RGB Tfiplet Hexadecimal Color Name RGB Thiplet Hexadecimal
5. Closethe pagewhenyouarefinished.
where coTor is either the color value or the color name. The style to define the background
color is
background-color: coTor
SeeFigure
3-9.
Settingpageforegroundand backgroundcolors (
yourchanges
Save to thefile.
orrefresh
Reload about.htm in yourWebbrowser
andverifythatthetextcolorhas
toa medium
changed brown.
-l -l -l
fi1 styl e=' c,:l ,:r : r,ilrit e; Lr4{_r.Llr Ur_{i ru-l_rJ ILrr . | '_l}J!-!_'_' i.i _
! l v L r l , ' t_ ! J 4r? rl , r I >
trielcofle
/h1>
e
I
Window
Reference
default,
browsers displayWeb pagetext in a singlefont, usuallyTimesNew Roman.
You a differentfont for any pageelementusingthe style
canspecify
font-fanily: fonts
Genericfonts
viewyourbrowser'sgenericfonts:
Useyourbrowser to openthedemo_text_styles.htm filefromthetutorial.0J/tutorial
ofyourDataFiles.
folder
Thisdemo pagecontainsa collectionofthestylesyou'ilbelearning aboutinthissession,
thePreview
Initially, boxdisplays thesample textin thedefaulttextstyleofyourWeb
browser.Youcanspecifydifferent sampletextbyselecting thedefaulttextandeditingit.
Youcanselect stylevalues
different usingtheinputboxes anddrop-down listboxesonthe
ofthepage.Entering
leftside orselecting "default"in aninputordrop-down listbox
causesthepageto usethedefaultstyle.Pressingthetabkeyactivates a stylechange. The
codeforthenewstyleappears in thepage'slower-right corner.
We'[lworkwiththisdemopagethroughout the restof thesession.
Youmaywantto keep
the pageopenasyouexploreotherstyles.
Trouble? Thisdemopagemaytookslighttydifferentdepending
onyourbrowser. i! 1rol
,fui.r"
It'sgenerallygood practicenot to usemorethantwo differentfont faceswithin a single
page,unlessyou'retryingto createan interesting and strikingvisualeffect.Seriffontsare
bestreadin largeblocksof text like paragraphs.Sans-serif fontscan work well eitheras
paragraph textor as headingsand subheads. You'llapplythis principleto theAboutpage
by changingthe font for the h1 headingand the listof linksto a seriffont.
Choosingfonts (
< b o d vs t v l e = " c o l o r : r q b ( 1 5 3 . 1 0 2 . 1 0 2 ) : b a c k q r o u n d - c o l o:r w h i t e " >
<'p s i y l a - = " t e x t - a l i q n : - c d n t e i ;f i n r : - F a r n i l t ' : - & . r i a lF, e l , r E : i , - a ,i a n s - r p r i f " >
< i f i r gs r c = " 1 o q o . { i t " a l t = " A R c A D r u M/"> '
<or />
< a h r e f = " a b o u t . h t m " > n b o u t A r c a di u m < / a > & n b s p ;& n b s p ;& n b s p ;
< a h r e f = " m a ph. t m " > P a r kn t a p < , / a& > n b s p& ; n b s p& ; nbsp;
< a h r e f = " w a t e r . h t n " > u a t e r n . i d e s < , / a >& n b s p ; & n b s p ; & n b s p ;
< a h r e f = " k a r t s , h t n " > c o t < a r ts < / a > & n b sp ; & n b sp ; & n b sp ;
< a h r e f = " r i d e s .h t m " > R oIl e r c o a s t e r s < / a >
</p>
< h 1s t y l e = " c o l o r : w h i t e ; b a c k g r o u n d - c o l o rr: g b ( 1 - 5 3 , 1 0 2 , 1 0 2 ) i
i=rrL-Farrj li : H=l?eti :a.,.jd;rj-jErif'l>
.,oriil.
* r
About
ArcadiumParkMap WaterRides GoKarts Roller
Coasters
-
ReferenceWindow
rt for an alemant'q tFvt rrqc fhe qtvle
;:
#tha ge
"ndirg
,rr.n,r-*,*;;
;i*g:*:X-;t* :*:::l
L
element.lf the pagebody is setto a 1Optfont,for example,a paragraph
inthe page setto a font sizeof 0.8emappearsas Bptfont.The ultimatecontaining
isthebrowseritself,which hasits own defaultfont sizefor bodytext.Settingthe
textto 0.8emreducesthe font sizeto 9O"hof the browser's defaultfont size.
Youcanuserelativeunitsto makeyour pagescalable,which allowsthe pageto be
the sameway no matter how a user'soutput device is configured. For example,
usermayhavea largemonitorwith the defaultfont sizefor bodytext setto 1Bpt.
usermayhavea smallermonitorand a defaultfont sizeof 12p1.Youwant your
textto be about50% largerthanthe bodytextfor eitheruser.Althoughyou can't
thedefaultfont sizefor a givenuser'soutputdevice,usinga valueof 1.5emfor the
ensures thatit is sizedappropriately on eithermonitor.Notethatyou can achieve
sameeffectby expressing a font sizeas a percentage defaultfont size.
of an element's
example,thestyle
ze: L50E
the headingto appear 50"/olarger than the default size. Eventhough point size is
most commonly usedunit in desktoppublishing, oftenlead
the benefitsof scalability
designersto optfor the em unit overpointsor otherabsoluteunits.
Thefinalunitof measurement we'll examineis the pixel,which represents a singledot
theoutputdevice.Because the pixel is the mostfundamental unit,for mostlength
, thebrowserassumes that a valueis expressedin pixelsif no unit is speci-
Thus,to setthefont sizeto 20 pixels,you could useeitherof the followingstyles:
: 2Opx
izet 20
font-size: 0.5in
font-size:36pt
font-size: 3pc
Goto the<h1>tag,andaddthefollowing
style: Con
font-size:1.5em Tom {
Figure therevised
3-17shows code. backp
alsov
Settingthe font sizes browr
H]
font sizewill be 807o tasks
referr
tracki
lette
word-
wnere
sizesr
length
tracki
font sizewill be reouc
1.5x normal bodv text
To
text st
4. Saveyourchanges
andthenrefresh
about.htminyourWebbrowser,
verifying
thatthe
fontsizes
have
changed.
Compare Figure
J-18withFigure
3-'15.
To vi
Resizedlist of linksand heading
1. R
2. C
F
5. S
4. C
rl;,;l a1;1;l;lil F - ' : r l l- r l a r : un;ter F d*: -.i i,ir1! FI Er r-]r;tFr:
sp
F
You can also use the deprecated<fonD tag to set the font size for a section of text. See @
the referencewindow for details. Fa
Reference
Window
o To setthe font size,usethe style
font-si-ze z value
where rzaJueis either a unit of length (specifiedin mm, cm, in, pt, pc, em, or ex units),a
keyword (xx-smal[,x-sma[[,small, medium, [arge,x-[arge,or xx-[arge),a percentageof
the default font size,or a keyword describingthe sizerelativeto the sizeof the contain-
ing element (smalleror larger).The defauttfont size unit is the pixet (px).
Deprecated
s
r To set the font sizefor a sectionof text, usethe code:
<font size= " ya-l.ue" >text</font> Anc
where rzaLueis a number from 1 (smallest)to 7 (largest)and text is the text Vou want l i n e so
to size. line-.
ng Spacingand Indentation
feelsthatthetextfor the Welcomeheadinglookstoo crowdedon the mediumbrown
He would like you to spreadit out moreacrossthe width of the page.He
l e,t"t ae nr ,d t h e l e f t e d g e ot hf e
w o u l d l i k e t o s e e m o r e s p a c e b e t w e e n t h e f i r s"tW
background.
HTML andXHTMLsupportstylesthat allow you to performsomebasictypographic
suchaskerningand tracking.Theamountof spacebetweenpairsof lettersis
to asthekerning,while the amountof spacebetweenwordsand phrasesis called
Thestylesto controlan element'skerningand trackingare
ing: rzal ue
ing: vaTue
FunPark
Family Family Fun Park
Iine-height: 2
Arcadium
AmusementPark
AmusementPark
l,t
font-fili-Ly: sans-serrf; text-a-hgn: center; font- font-fffirIy: sans-serrf; texE-al-ign: center; font-
si.zet 32Dxr saze: 32pxi l-ihe-hei-ght: 2{px;
5.Saveyourchanges theAboutpageinyourWebbrowser.
andrefresh Verify
thatthespac-
ingoftheWelcome
heading (seeFigure
haschanged J-22).
ReferenceWindow
r Tosetthespacebetweenletters(kerning),
usethe style
'I
Fl-tFr-snec i no: y6] gg
whereyaJueisthespacebetweenindividualletters.Thedefaultis 0 pixels.
o Tosetthespacebetweenwords(tracking),usethe style
word-spacingz vaTue
whereyal ueisthespacebetweenindividualwords.Thedefaultis 0 pixets.
r Tosettheverticalspacebetweenlinesof text (leading),usethe style
line-height z Tength
wherelength is eitherthe length betweenthe lines,a percentageof the font size,or
the ratioof the line height to the font size.The default is a ratio of 1.2.
r Tosetthe indentationof the first [ine, use the style
text-indent: value
wherevalue is the length ofthe indentationexpressedeither as a length or as a per-
centage of the width of the text block.The default is 0 pixels.
whereTength is a specificlength,or a percentage of the font sizeof the text on those
the numberto represent
a browserinterprets
Iines.lf no unit is specified, the ratioof the
line heightto the font size.Thestandardratiois 1.2:1,which meansthatthe line heightis
1.2 timesthe font size.lf Tomwantedhistextto be double-spaced, you couldapplythe
followingstyleto the text:
Iine-height: 2
Arcadium Arcadium
AmusementPark
AmusementPark
font-fdily: sans-serif; bext-align: center; font_ font-filIly: sans-serif; text-align: centeE; font-
sizet j?pri -Iine-height: 24F',
sizet 32pxi
text-decoration: type
text-transformz type
wheretype is capitalize,uppercase/lowercase,or none (to makeno changesto the text
case).Forexample,if you want to capitalizethe first letterof eachword in the element,
you could usethe style
text-transform: capitalize
font-variant2 type
vertical-align:50E
raisesthe element by half of the line height of the surroundingcontent,while the style
vertical-align: -100t
d r o p st h e e l e m e n ta n e n t i r el i n e h e i g h tb e l o w t h e b a s e l i n eo f t h e c u r r e n tl i n e .
where font-style is the font's style, font-variant is the font variant, font-weightis
the weight of the font, f ont-size is the size of the font, Tine-height is the height of
each line, and f ont-f amiTy is the font face. For example, the style
Tomfeelsthatthe sizeof the addresstext at the bottomof the pageis too large,and he
itwouldlookbefterin a normalsans-serif
feelsthat font ratherthan in italics.Makethese
nowusingthefont style.
changes
yourchanges
I Save andthenrefresh in yourWebbrowser.
about.htm Verifythatthe
oftheaddress
appearance elementhaschanged.
SeeFigure
3-26.
Formattedaddress
'tig 'f+u
Arca&ura i easylti yru{ ltt{ge-t. }rlrnp*re our'1,;lr' a:ly rates i+ |!i cluanp'ark-s. can ci:a:rselo plrcha;e ;r gold
riJes, or *tr l:eat v';i;t:.e,
ticketfor anytwe*ry ndes^a 1:ia!u:unilicktt for t!'ilri.'*. a fi:L1-daypass t+ r:le a: roal.?timer as 'r,;u
rant,wherever y+uruant.Sp*ciai ,;S:seasotarr.C iargdgt'+"p rirt*s we ztst;Jal:,lt
':1
,and,
ii!ffi
Usingthe SpanElement
Tomwantsto makeone morechangeto the font styleson the page.He would likethe
word 'Arcadium"in the firstparagraph to be prominentlydisplayedin bold and perhapsin
Arial or Helveticafont, settingit off from the restof the text in paragraph.
To makethis
change,you firstneeda way of markingthatsingleword within the paragraph. Youcando
thatwith the spanelement.Thesyntaxis
<span>content</ span>
Creatinga spanelement
Noninterlaced
GIF
tt,
ngwithTransparent
Colors
feature
of theClF89aformatis the abilityto usetransparent
colors.A transparent
i s a c o l o r t h aits n o t d i s p l a y e dw h e n t h e i m a g e i s v i e w e d i n a n a p p l i c a t i o n .l n p l a c e
color,a browserdisplayswhateveris on the pagebackgrouno.
thetransparent
Theprocess
bywhichyou createa transparent
color dependson the graphicssoftware
areusing.
Manyapplicationsincludethe optionto designate a transparent
color
savingan image,while other packagesinclude a transparentcolor tool, which you
to selectthe color that you want to treat as transparent.
thepast,
Webpagedesigners usedtransparent ClFsas layouttoolsto helpthem
elementson aWebpage.Toaccomplish this,a designerwould createa CIFone
in size,with the colorof the pixel specifiedastransparent.
square Thistypeof image
sometimesreferredto asa spacer.A Web designercould then sizethe spacerin
toposition
objectsin specificlocationson the page.Because the spacerwastrans-
wouldseeonly the positionedobject.With the adventof styles,thereis little
users
forspacers
anymore, but you may stilI seethem in the codefor olderpages.
Animated
ClFs
arealsocommonlyusedto createanimatedimages.An animatedGIF is composed
images
thataredisplayedone afterthe other.Somefilesplaythe framesin rapid
c r e a t i ntgh e i l l u s i o no f m o t i o n , w h i l e o t h e r a n i m a t e dC l F s s i m p l y c y c l e s l o w l y
throughmultipleimagesor messages. Youcaneasilyfind animated GlFson theWeb in
onlinecollections. Youcan alsocreateyour own by installinganimatedCIF software.
MostanimatedCIF softwareallowsyou to controlthe rateat which an animationplays
(asmeasured by framesper second)and to determinethe numberof timesthe animation
repeatsbeforestopping(or setit to repeatwithoutstopping). Youcan alsocombineindi-
vidualGIFfilesintoa singleanimated file and createspecialtransitionsbetweenimages.
AnimatedClFsarea mixedblessing. Because an animated CIFfile is typicallylarger
thana staticGIF imagefile, usinganimatedGlFscan greatlyincrease the sizeof a Web
page.Youshouldalsobe carefulnot to overwhelmuserswith animatedimages. Animated
ClFscan quicklyirritateusersoncethe noveltywearsoff, especiallybecausethereis no
way for usersto turn themoff! LikeotherGIFfiles,animatedGlFsare limitedto 256 col-
ors.Thismakesthem idealfor smalliconsand line art,but not for photographic images.
Recallthatone of the pagesin theArcadiumWeb siteis a splashscreen.Tomwantsto
includesomeinteresting visualeffectson this pagein orderto draw usersintothe site.
Youdecideto investigate whetherthiswould be a good placefor an animatedGIF.Oneof
the graphic designers at Arcadiumhascreatedan animatedGIFof the companylogo.
You'lltry addingthatto the splashscreen.
Insertingthe animatedlogo
5. Saveyourchangesto thefile.
4. Openindex.htmin yourWebbrowser.
Verifythatthelogodisplays
ananimated
setof
racing
downthetrack.SeeFigureJ-32
Animatedlogo
ingwith JPEGlmages
othermainimagefile formatis the JPECformat.f PEGstandsfor foint Photographic
Group.JPEGs differfrom ClFsin severalways.In the JPEGformatyou can create
thatusethefull 16.7millioncolorsavailablein the color palette.Because
of this,
filesaremostoften usedfor photographsand imagesthat covera wide spectrum
with PNGlmages
formatthat is startingto gain wide acceptanceis the PortableNetwork
graphic
or PNGformat.PNC filesincludemostof the samefeaturesas ClFs(suchas
and transparency)
interlacing, but alsoprovidethe file compression available
like
. Inaddition, the JPEC format, PNC the
supports full 16.7 million colors
colorpalette.
You can also designate severaltransparentcolors in a PNC file,
thanthesinglecolorthat GlFssupport.Theonly problemwith the PNC formatis
The about photo
Aligningan lmage
You showTom the progressyou'vemadeon the Web page.Althoughhe'spleasedwith
theimageof the kids,he doesn'tlike how the imageis positionedon the page.The
layoutincludesa largeblankspacebetweenthe Welcomeheadingand the first
current
paragraph,
Tomwantsyou to wrap the paragraph text aroundthe image.
an Element
Floating
Onewayto achievethis is with the float style.Thesyntaxof the floatstyleis
: position
W ffi
Wf;-rch'l
r
m
@r
ffi
lastelementonly displays
when the right marginis clear
whatyou know aboutthe float style,placethe photo on the About pageat the
Using
andusethe clearstyleto ensurethatthe horizontalline at the bottomof the
margin
doesnotmoveup and wrap aroundthe image.
at the photo:
totheabout.htm filein yourtexteditor.
attribute
rt thefollowing intothe<img/> tagfortheaboutphoto:
"float: right"
styleintothe<hr/> tag(besureto separate
thefollowing thisstylefromtheother
witha semicolon).
: right
J-39shows
therevised
code.
lnsertingthe float and clear styles
4. Saveyourchangesandreopen inyourWebbrowser.
about.htm Figure
3-40shows
the
revised
layout
ofthepage.
Floatingthe imageelement
'Ilir
Exciltqg ad"reuhrri aurill 'ri)L!at ArCadiUm" 'gour idti;rdal:lef'aradvfir: ,:*nter. parh
rs hiatriJ 5 mi!-'r n+rtll',reit oi lrri::y - rlos* io rn*i"1 of ilt.,'rg]a's :cerrir ',1'orrdrrs.
-d"rcadirmil$eri .rr"erfiil i;,tlrs, tuh.i'durgso:ne *ftl:r*:tate'r rrr+ste::cilingrc,llercrartrr:
-*lrJ 'rirtrr n,,J*: Therr'r ail,; pi*ng +i'fi.ur ii,r th* ycrnger k-:,J:,n:*lud:rrgil".J srparnte
itid,Lrel.uri: ar:ri:perr;,1t'i,1tsfbr rh* L:rtJe
l . r r , . 1 1 r r , : c ^ r ' r . . . i r , - r r t . 1 , , . . , 1. . t - , . - e k
Usingthe AlignAttribute
Forsomeolder browsers,you may needto usethe alignattribute,which is now deprecated,
to fulfillsomeof the sameneedsasthe floatstyle.Thesyntaxof the alignattributeis
<img align="position" />
w h e r e p o s r t r o ni n d i c a t e sh o w y o u w a n t t h e i m a g ea l i g n e dw i t h t h e s u r r o u n d i n gc o n t e n t .
l fy o uw a n tt h e i m a g ep l a c e do n t h e l e f t o r r i g h tm a r g i n ,u s ea l i g n v a l u e so f " l e f I " o r " r i g h t " .
F i g u r3e- 4 1s h o w st h e o t h e rv a l u e so f t h e a l i g n a t t r i b u t e .
Aligns the bottom of the object with the absolute bottom of the surrounding text. The
absolute bottom is equal to the baseline of the text minus the height of the largest
descender in the text.
absmiddle Aligns the middle of the object with the middle of the surrounding text. The absolute
middle is the midpoint between the absolute bottom and text top of the surrounding text.
baseline Aligns the bottom of the object with the baseline of the surrounding text.
bottom Aligns the bottom of the object with the bottom of the surrounding text. The bottom is
right Aligns the object to the right of the surrounding text. All subsequent text ftows to the left
of the obiect.
texttop Aligns the top of the object with the absolute top of the surrounding text. The absolute
top is the baseline plus the height of the largest ascender in the text.
Aligns the object to the right of the surrounding text. Al[ subsequent text flows to the left
of the obiect.
N o t et h a ty o u c a n d u p l i c a t et h e a l i g n v a l u e sw i t h s t y l e sY . o u c a n r e c r e a t et h e e f f e c t so f
t h el e f ta n dr i g h tv a l u e su s i n gt h e f l o a t s t y l e .Y o u c a n d u p l i c a t et h e r e s to f t h e a l i g n v a l u e s
u s i ntgh ev e r t i c a l - a l i gsnt y l ed i s c u s s e di n t h e p r e v i o u ss e s s i o n .
T h e r ies n o g , e n e r aalt t r i b u t et o p r e v e n ta n e l e m e n tf r o m b e i n g d i s p l a y e du n t i l a m a r g i n
i s c l e alrf.y o u n e e dt o p e r f o r mt h i s t a s kf o r o l d e r b r o w s e r sy, o u c a n p l a c e t h e t a g
< b r c l e a r = " p o s i t i o n " / > b e f o r et h e e l e m e n ty o u w a n t c l e a r e d ,w h e r ep o s i t i o n i s
e i t h e" rl e f t "o t " r i g h t " ," a l l " , o r " n o n e " . T h i s t a g c r e a t e sa l i n e b r e a ko n l y a f t e rt h e s p e c i -
f i e dm a r g i n i s c l e a r .N o t e t h a t l i k e t h e a l i g n a t t r i b u t e t, h i s a t t r i b u t eh a s b e e n d e p r e c a t e d .
ReferenceWindow
o Tofloatanelement
on the left or right margin,usethe style
float: position
whereposit:onis none (the default),left, or right,
r Todisplay an elementin the first availablespacewhere the specifiedmargin is clear of
elements,
floating use the style
clear: position
Deprecated
o Toalignaninlineimagewith the left or right pagemargin,add the followingattribute
tothe<img/> tag:
a l i g n = " p o s : . t i o n"
where positron is either left or right.
r Todisplay an elementin the first availablespacewhere the specifiedmargin is clear of
otherelements, enterthe fo[[owingtag before the element:
<br clear="position', />
where position is left, right, atl, or none.
SettingMargins
Wrappingthe contentaroundthe imagehassolvedthe problemof the largewhitespace
in the middle of the About page.However,Tomfeelsthat the text crowdsthe phototoo
much,and would Iikeyou to slightlyincreasethe marginbetweenthe photoand thetext.
Fourstylescontrolthe sizeof an element's
top, right,bottom,and left margins:
margin-topz Tength
margin-righLz Tength
margin-bottom: lengrth
margin-leftz Tength
where top, right, bottom, and left are the sizesof the top, right, bottom, and left margins.
(lf you havetrouble rememberingthis order,just think of moving clockwisearound the element
startingwith the top margin.)lf you include only three values in the margin style,they are
applied to the top, righg and boftom margins.lf you specifyonly two values,a browserapplies
the first value to both the top and bottom margins,and the secondvalue to both the left and
rightmargins.lf you specifyonly a singlevalue,a browserappliesit to all four margins.
Tom suggeststhat you set the size of the left margin to 1 5 pixels and the size of the
bottom margin to 5 pixels.The top and right margins can be set to O pixels.
Settingthe marginsize
<o stvle="text-aliun: iustifv">
<imgirc="about.jpd" alt="" ity'le="float: right; margirr: 0 0 5 l-5",/>
Excitino adventuibi awair vou at
<spansfyle="font-weiqht: 6o1d; font-family: nria1, Helvetica, sans-serif">Arcadiunr</span>,
voirr aff-ordable familrT fun cenier. The Eark is locited 5 milei northwest of
berby - close to many-ofGeorqia's scenic wonders,lrcadium offers over 50 rides,
inclfidinq sone of th-e state's-nrost excitinq roller coasters and water rides.
There's 51so plenty of fun for the younqer-kids, including two separate
kiddie pools and s-pecialrides for ttre [ius.<,rpi
Saveyourchanges
to thefileandreopen in yourWebbrowser.
about.htm Verifythatthere
isnowmorespace
separating thephotofromthesurrounding
content.
to set
styles margins for your entire Web page. Tom has looked at
. o u c a n u s et h e m a r g i n
Y o uc a na l s os e t m a r g i n sf o r e l e m e n t so t h e r t h a n i n l i n e i m a g e sY
the splashscreenand
rlt
suggests that the animated logo might look better if it was further down the page.You can
accomplish t h i s b y i n c r e a s i n t
g h e p a g e ' s
t o p m a r g i n .
Tosetthe pagemargin:
fileinyourtexteditor.
1.Gototheindex.htm
tagatthetopofthefile,insertthefollowing
the<body>
2.Within 3-45:
In Figure
style,asshown
margin-top: 100
a semicolon,
toinsert
Besure thisstylefromtheotherstyledeclarations.
separating
<bltlvsrvle=,,font_faflily:Ar.iJl,HelVEtira,sans_serif'''j''>
. a' t r v l o = " t e r t a l i q n : - ; r n t' e r ' .
,.iirg..rc="logoariirn.;1if a l r , " a R c A D I tt , t ' . / :
<frr ./ >
<spai style="color: red: forrt size: lBFt; fDnt uPiqht: bold">
ffirrdable ramily run
<,/tFani
:br -/><br r/:,- I
ri fief = abrut. htttt">EntEr trcaliuill-i,/'e:'
,/,p,
<,/trtrtr./:
< , / n t ml >
yourchanges
5,Save index.htm
to thefileandreopen Verify
inyourWebbrowser. thatthe
have
contents beenshifteddownthepage.
Window
Reference
r Tosetthesizeof the marginsaroundan element,usethe styles
margin-top: length
margin-rightz Tength
margin-bottom: Tength
nargin-left z Tength
wherelengthisa unitof length,a percentage element,
of the width of the containing
orthekeyword"auto"(thedefault),whichenables the browserto setthe marginsize.
o Tocombinea[[marginstylesin a singlestyle,use
margin: top right bottom Teft
top,right, battomtandJeft arethe marginsof the top, right,bottom,and left
where
youinclude
edges.lf onlythreevalues,the marginsare appliedto the top, right,and
boitom.Iiyouspecify onlytwo values,the firstvalueis apptiedto the top and bottom
' valueto the right and left edges.If youspecifyonlyonevalue,it
anJthesecond
edges,
to allfouredges.
isapplied
width="value" height="va7ue"
the<img/> tagfortheabout.jpg
5. Within graphic,
insert width="210"
theattributes
Youmaywantto place
height="280". theseattributes
ona separate your
lineto make
Figure
codemorereadable. 5-44shows
therevisedcode.
Settingthe imagesize
< b o d v s t v l e = " c o lo r : r q b ( 1 5 3 .l - 0 2 . 1 0 2 1 : b a c k q r o u n d - c ool r : w h i t e " >
<p siyle-="text-align:-cdntei; fbnt-iirmily:-Arial, Helvetica, sans-serif;
T0nr-51 ze: u. aefl >
< i m g s r c = " 1 o g o . g i f " a 1 t = " n R c A D r u t t " l d id t h = " 5 1 - r " h E i g l r t = " 1 1 E " / >
<nr / >
<a href="about. htm">About lrcadi um</a>
< a h r E f = " m a F .h t m " > P a r k M a p < / a > & n b s p ; & n b s p ; & n b s p ;
< a h r e f = " w a t e r . h t m " > t ia t e r t i d e s < / a > & n b s p ; & n b s p ; & n b s p ;
< a h r e f = " k a r t s . h t m " > G o t < a r t s < / a > & n b s p ;& n h s p ;& n b s p ;
<a href="ri des. htn">Rol I er coasters<./a:
<./p>
< h 1 s t v- l e = " c o l o r : w h i t e ; b a c k q r o u n d - c o l o r : r q b ( l - 5 1 , 1 - 0 2 , 1 0 2 ) ;
font-fafli ly: nri a'lI nelveti ca, sans-serif; 1 - .5 e m ;
I etter-spati ng: l-eril; text-i ndent : 1em">
wel come
<./nL>