In this exercise you'll learn how to use HTML attributes to modify the style of specific elements.
Continue using jsfiddle with the same code from the previous screen. Here it is again.
My Story <p>My friend Pablo has a <em>pet dog</em> called Sam who likes to have his tummy scratched. When they go to the park, <strong>he likes to chase a <em>ball</em>.</strong> He rolls in the dirt so Pablo has to wash him when they get home.</p> <p>On Sundays they drive to the <sup>mountains</sup> where he runs around smelling the grass and wagging his tail. He gets so tired that he sleeps all the way home.</p>
style="color:red"
inside the <em>
tag as follows.<p>My friend Pablo has a <em style="color:red">pet dog</em> called Sam who likes to have his tummy scratched. When they go to the park, <strong>he likes to chase a <em>ball</em>.</strong> He rolls in the dirt so Pablo has to wash him when they get home.</p>
style=""
.color
is the parameter (the colour of the text) and red
is the value we wish to use.:
used to separate the parameter and the value.<span>
. Let's make the text 'wagging his tail' blue.<p>On Sundays they drive to the <sup>mountains</sup> where he runs around smelling the grass and <span style="color:blue">wagging his tail</span>. He gets so tired that he sleeps all the way home.</p>
;
as follows.<em style="color:red; font-weight:700;">pet dog</em>
font-weight
. 300 is very faint and 900 is very heavy.;
marks the end of a single parameter:value
pair so when the browser encounters more text inside the inverted commas, it knows to expect a new pair.text-indent
.<p style="text-indent:30px;">On Sundays they drive to the <sup>mountains</sup> where he runs around smelling the grass and wagging his tail. He gets so tired that he sleeps all the way home.</p>
<p style="text-align:right;">My friend Pablo has a <em style="color:red">pet dog</em> called Sam who likes to have his tummy scratched. When they go to the park, <strong>he likes to chase a <em>ball</em>.</strong> He rolls in the dirt so Pablo has to wash him when they get home.</p>