9. font color


#1
I need help with this, it says did you make the second paragraph violet???
<!DOCTYPE html>
<html>
	<head>
		<title>Changing the colors!</title>
	</head>
	<body>
		<h2 style="color: green; font-size:16px">Big Heading</h2>
			<p><h2 style="color: violet; font-size:12px">A giant bear and a little duck were friends.</p>
			<p><h2 style="color: red; font-size:10px">But the bear got hungry and ate the duck.</p>
	</body>
</html>

#2

Hi William,

Please format your code so we can see it to help you. You can format it by editing your post (click the pencil icon along the bottom of it), highlighting all of your code, and clicking the </> button in the formatting toolbar.


#3

He edited his question, i guess this means you didn't get a notification. You want to help him or should i?


#5

Try


Also, you don;t need to use h2. Remember what h is for? I hope this helps.
<h1 style="color:green; font-size:16px">Big Heading</h1>
		<p style="color:violet">A giant bear and a little duck were friends.</p>
		<p style="color:red; font-size:10px">But the bear got hungry and ate the duck.</p>

#6

Thanks @stetim94 - I'll answer the question if you don't mind letting me :)

@textmaster80815, @emmiesue has what looks like the correct code to me, so here's what changed in case you're wondering:

  1. The first <h2> is supposed to be an <h1>, as shown in Emmiesue's code.
  2. Also, you shouldn't have <h2>s as a sub-element of a <p> ever, and this isn't an exception - they should be removed, apply those styles to the <p> instead.
  3. That'll pass you, but you should also probably remove the font-size declaration on the second <p>, since you weren't asked to put it there in the instructions.

I hope this helps!


#7

hi,
take out the


#8

@zystvan, now you know you don't get notifications for edits on peoples code (unless you set the watch setting very high, maybe then).

@textmaster80815, i agree with zystvan, take the steps he tells you. It is important to realize that style is an attribute which you can add to many html elements (including <p>), the h2 in the example of the exercise is on purpose, to test if you know how the attributes works.

@a_kiraly in your last post, you seem to post some code, but without format, can you fix that?


#9

I keep getting the error, "Did you remember to make the h1 header green?"
The results look right on the preview side, but obviously I've done something wrong.

I tried:

...but that showed all my code as text on the preview side.

What I have:

<!DOCTYPE html>
<html>
	<head>
		<title>Changing the colors!</title>
	</head>
	<body>
		<h1><p style="color:green; font-size:16px">Big Heading</h1>
			<p style="color:violet">A giant bear and a little duck were friends.</p>
			<p style="color:red; font-size:10px">But the bear got hungry and ate the duck.</p>
	</body>
</html>

#10

remove the paragraph opening tag inside h1 (never nest paragraph in headers and vice versa), and add the style attribute to the h1 opening tag


#11

Like this? I saw this in emmiesue's post and changed my code to match, but it makes it show all my code in the results.


#12

Yea, like that. Well obviously something isn't right then, but the only way i can tell, is you post your full code


#13
<!DOCTYPE html>
<html>
	<head>
		<title>Changing the colors!</title>
	</head>
	<body>	
		  <h1>style="color:green; font-size:16px">Big Heading</h1>
			<p style="color:violet">A giant bear and a little duck were friends.</p>
			<p style="color:red; font-size:10px">But the bear got hungry and ate the duck.</p>
	</body>
</html>

#14

this:

<h1 style="color:green; font-size:16px">Big Heading</h1>

and:

<h1>style="color:green; font-size:16px">Big Heading</h1>

are not the same, the first example is your quote, the second your full code you posted as last. See the difference?


#15

Yeah the space after h1, I'm not sure why it's changed, but I have what I initially pasted in my code and it still shows my code in the results.


#16
<!DOCTYPE html>
<html>
	<head>
		<title>Changing the colors!</title>
	</head>
	<body>	
		  <h1> style="color:green; font-size:16px">Big Heading</h1>
			<p style="color:violet">A giant bear and a little duck were friends.</p>
			<p style="color:red; font-size:10px">But the bear got hungry and ate the duck.</p>
	</body>
</html>

#17

<h1> style is wrong because of the >, remove it. style is a attribute, the closing > of h1 should after the style (it is in your case, but it also before)


#18

Wow... that's crazy. It was there in the default code. I guess we're intended to realize it isn't needed. A lot of this is still confusing.

That worked. Thanks for your help and your patience!


#20

Hi!

I try completed this one, but didn't complete, anyone can help me plz?!?!

<head>
	<title>Changing the colors!</title>
</head>
<body>
	<h2 style:"color:green; font-size:16px">Big Heading</h2>
		<p style:"color:violet">A giant bear and a little duck were friends.</p>
		<p style:"color:red; font-size:10px">But the bear got hungry and ate the duck.</p>
</body>

Thank you!


#21

after the style attribute there should be equal sign, not a colon. wrong code:

<p style:"">

right code:

<p style="">

#22

dmmt... thank you! :smiley: