I am trying to style a book title, and my code isn’t working.
I have a book title where I want the entire thing semantically to be an H2, but I want the end of the title to be styled in less dominant font like this…
It is, trust me on this… never start an id with a number, it is illegal in HTML law . Changing that to a proper id made the code work for me.
You might also have had that other problem you were describing, maybe a mixture of issues.
sounds like you have several issues playing at once… make sure you have properly disabled the cache… Chrome has a handy setting: settings -> Network -> disable cache when dev tools is open
Hey @UpstateLeafPeeper, someone helped me point out a few other things that I missed that may help you:
You will not need the id if you target your span correctly.
h2 default styles are already bold so the font-weight:bold in the span will do nothing.
Also font-size: 1em is saying that it should be 100% the size of the container’s font-size so it will have no effect.
li.productDetails h2{
font-size: 1.4em;
font-weight: bold;
}
li.productDetails h2 span{
display: block;/* is working ok */
font-size: 1em;/* does nothing - just makes same size as parent*/
font-weight: bold;/* does nothing - I am already bold (change to 'normal' if you don't want it bold) */
}
As for your selectors xyz, OS and 123, the only offender is 123 for the reason I explained yesterday. Why you might not have noticed a change of style in the elements is because of the reasons I told you above.
if I ever get my site done, next year I am going to buy a bunch of HTML and CSS books and re-learn everything from the ground up, including learning how to write “smarter” CSS!!