Ashley P.

asked • 11/17/19

CSS - Selecting the first bold word of all paragraphs

write the required external CSS rules for the following :


Set the font size and font style , of the first bold word of all the paragraphs in a document into 14px and italic respectively.

2 Answers By Expert Tutors

By:

Ricardo Z. answered • 11/26/19

HTML, CSS and Web Design Expert

Art S. answered • 11/17/19

Fullstack Web Developer 8+ Years

Ashley P.

So we are asked to write only the external CSS rules here. Plus we are required to identify the first bold word too. How do we accomplish both?
Report

11/17/19

Art S.

tutor
You can't identify the first word with CSS only javascript. If you want an external rule. You create a style.css file and input the text i mention above
Report

11/17/19

Ashley P.

But how do we identity the "first bold word"? It could be anywhere in the paragraph right?
Report

11/17/19

Art S.

tutor
Oh i thought you meant first word to identify first bold you can do strong:first-of-type or p > strong:first-child if there is no other element So p > strong:first-child { font-size etc }
Report

11/17/19

Ashley P.

So how do we exactly write the external stylesheet accordingly : Like below? p.strong:first-of-type { font-size: 14px; font-style:bold; }
Report

11/17/19

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.