In style.css, write a selector for p elements that also have a class of .time


#1

guys please help me out. what am I doing wrong here?


#2

.time p will select all paragraphs within all element which has class time, for example:

<!-- html code -->
<div class='time'>
   <p>i am affected, given there is a parent element with class timeD</p>
</div>
<p>i am not affected, i don't have a parent element with class time</p>
/* css */
.time p { color: grey; }

this is what your current css code does, selecting any paragraph element within elements which have class time

However, the exercises ask you to target all paragraph elements which have class time

so, we need to change the css syntax, how could we do this?


#3

i don’t know. hooooowwww?


#4

this must have been explained somewhere? Maybe in the exercise itself? Otherwise this would be an impossible exercise

we could change the css selector to: p .time, this will select all elements with class time within paragraph, still not entirely right. What causes that it to select the elements with class time within the paragraph elements? The space between the css selectors, so what would happen if we remove the space from between the css selectors?


#5

i removed the space, i seem to have tried everything. please help i’m desperate


#6

that should work, unless you made a mistake somewhere else in your css code or the <link> is missing and the html code is not aware of the css, please post full html and css code


#7

i contacted them, and the tech guy suggested writing it without the space between them


#8

please give me:

the exercise url
your full html code
your full css code

so i can have a proper look


#9

the issue is solves, but i can send u the link to the exercise https://www.codecademy.com/courses/learn-css-selectors-visual-rules/projects/css-selectors?course_redirect=learn-css. task 5


#10

the hint says:

To select elements with a specific class, chain the class selector to the end of the element selector.

which was my suggestions: p.time {property: value}, that should solve the issue

good to hear that its solved


#11

i didn’t understand the was Not a space


#12

the chaining selectors was explained, as i thought:

https://www.codecademy.com/courses/learn-css-selectors-visual-rules/lessons/css-setup-selectors/exercises/chaining-selectors?action=lesson_resume&course_redirect=learn-css

and then in the next exercise, the nested selectors:

https://www.codecademy.com/courses/learn-css-selectors-visual-rules/lessons/css-setup-selectors/exercises/nested-elements?action=lesson_resume&course_redirect=learn-css

I would highly recommend you to visit this exercises again, hopefully this will make you understand why you need p.time to target the right paragraph in your project