CSS Selectors *: Can you swing it


#1


Hi,

I'm stuck. I get the oops message saying did I bold the introduction and summary paragraph. I've written my code, the preview shows the text as it should be but I get the error.

Here's my HTML and the CSS follows:

<!DOCTYPE html>
<html>
	<head>
		<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
		<title>Ultimate Text Challenge</title>
	</head>
	<body>
		<span><p>Introduction: Cascading with CSS</p></span>
		<div>
			<p>Synopsis: When you set a property of a selector like 'p' to a certain value, that value applies to <em>all</em> p tags.
			If, however, you change that same property to a different value for a more specific instance of p,
			that change will <em>override</em> the 'general rule'.
			</p></div>
			<ul>
				<li><p>If you say p { font-family: Garamond}, all 'p's will have the font Garamond.</p></li>
				<li><p>BUT if you say li p {font-family: Verdana}, 'p's outside of 'li's will be
					   in Garamond, and 'p's INSIDE 'li's will be in Verdana.
				</p></li>
				<li><p>The more specific your selectors are, the higher importance CSS gives to the styling you apply!</p></li>
			</ul>
		
		<span><p>Summary: Greater specificity makes CSS prioritize that particular styling.</p></span>
	</body>
</html>

/*Add your CSS below!*/
p {
font-family: Garamond;
}

span > p {
font-weight: bold;
}

div > p{
    color:#7AC5CD;
}

div > ul > p{
    color: #000000;
    text-decoration: underline;
   }

Thanks heaps, as I just can't see it


#2

Don't put span in the introductory paragraph. You can simply write it as : body>p {
font-weight:bold;
}
and as for--Make the paragraphs in the unordered list have the color #000000 and text-decoration underline.
li>p {
color:#000000;
text-decoration:underline;
}
see if it works this way.


#3

the introduction and summary paragraph are both direct child of body, not of span (as shown by @lav0017)

this will also cause a problem?

div > ul > p

will also cause a problem, since the html code is:

<ul><li><p></p></li></ul>

the paragraph aren't direct child of unordered list, there are multiply ways to solve this problem, pick what you like


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.