Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialStavros Sofroniadis
Courses Plus Student 1,503 PointsAbout <strong> & font-weight and <em> & font-style
Dear Friends,
We use to apply bold text in our text using <strong> tag
<strong>Content</strong>
If we want to apply the same attribute with either internal css style or external css style can we use font-weight instead of <strong> tag?
<p class="one">Content</p>
.one{ font-weight:bold; }
It is not possible to use <strong> tag also inside external style file?
The same apply regarding, <em> tag and font-style? We use to display text in italic with <em> tag inside html file <em>content</em>
but we can apply the same result with font-style
<p class="text2">content</p>
.text2{ font-style:italic; }
Thank You
2 Answers
Emmanuel C
10,636 PointsHey Stavros,
Because "em" and "strong" are tags, its not as simple to change, lets say a "p" tag, to a "strong", in an external file, though it is possible. It would actually involve replacing the tag completely. font-weight: bold; and the strong tag are basically the same, the strong tag will actually give the text a font-weight of bold behind the scenes. There is a difference though.
The difference between them however is for web accessibility, like screen readers for blind people. While they can't see font as bold, when the screen reader reads a strong or em tag, it would say it in a unique way to let that person know that, that content has been emphasized. Using just font-weight: bold; or font-style: italic; wont produce the same results and is purely visual.
I hope that made sense and answered your question. If not feel free to leave a comment. Happy coding!
Greg Saunders
5,263 PointsCan't top Emmanuel's response!