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 trialChris Shaffer
12,030 PointsThis challenge is *not* dumb. But it is confusing.
It requires us to use and antiquated form of HTML, specifically requires the use of the <strong> tag, yet requests the text to be bold, which implies using the <b> tag.
I get it, we need to know old HTML. But we shouldn't be required to be confused by doing so.
edit to be clear this is confusing to me because I don't do styling in HTML; I use only CSS. It's also confusing to a person new to HTML, I'm sure, due to the lesson not covering HTML styling in much detail.
4 Answers
Tom Bedford
15,645 PointsThe <strong>
tag is part of the HTML5 specification. It's not antiquated and should be used to add "strong importance, seriousness, or urgency" to a section of text. The default styling for <strong>
is font-weight: bold;
.
Using <b>
just for "bold text" isn't encouraged, and it has it's own specific use.
Jamie Archer
5,054 PointsThe <b> tag (and <i> etc.) are not yet deprecated in the spec it just says use them as a last resort. Some of javascript WYSIWYG editors still insert those inline style tags into content to format text in CMS' like TinyMCE for example (need to check whether the newer versions have dropped that but I think this is still the case). Similarly its sometimes quicker to type the inline styles in something like Blogger when doing blog posts than to create a separate style sheet and use wrap elements on specific words in That's why those tags are useful... you may not need or use them for your projects but its always worth knowing them.
Chris Shaffer
12,030 PointsTotally agree the knowledge is useful if you ever run into it; the point is the challenge is unnecessarily hard for a person like myself who already knows HTML and CSS fairly well, with little to no purpose in the difficulty from a learning standpoint.
And you'll almost never use a WYSIWYG editor in the real world if you're actually working in the software industry. Some people consider WordPress a WYSIWYG, but even so you would use CSS not HTML for this styling.
Neil Northrop
5,095 PointsHey Chris,
I take it when you post, "This challenge is dumb," it means that you fully understand older and newer HTML tags and the uses between them. Which is great!
But it doesn't mean the challenge is dumb, it means you're beyond the challenge. The challenge is there for someone who thinks it is more or less a "challenge."
What did you mean by, "But we shouldn't be required to be confused by doing so."?
Chris Shaffer
12,030 PointsThe actual lesson doesn't use the <strong> tag and focuses on very little styling. The old-school method of making text bold doesn't work as an answer and I didn't even think to use strong because I wouldn't even use strong in CSS; I'd use a font-weight or actually call bold.
This would be very confusing for a person who didn't know HTML at all because it's not actually discussed in the lesson. Confusion as a challenge doesn't make for good learning.
edit - I'll change the title, too, btw. It was out of frustration; not fair.
Neil Northrop
5,095 PointsI get it Chris, it is poorly worded. It would of been better to use strong instead of bold.
They do talk about using the <strong> tag in a lesson a few back, were they mention it has a "bold" effect.
Chris Shaffer
12,030 PointsSo if "strong" makes the text bold, doesn't CSS override this anyway? Any what is the semantic use? In other words, if I'm using "strong" or "em" rather than achieving the same styling with CSS, how does this affect browser logic?
If the browser somehow handles this differently, then I'll experiment with this, but if it's in effect the same as and overridden by CSS, I don't see the value when using stylesheets.
However, the e-reader and other view types that may be similarly effected I had not considered.
*Edited for context - tags written as HTML were actually interpretted AS HTML and as such didn't show in my post LOL.
Tom Bedford
15,645 PointsUsing <strong>
adds more meaning to the HTML file. The default styling is to make this bold, to attempt imply that meaning visually. You can override the browser default styling however you wish (as with any other element). Semantic HTML refers to marking up your code to accurately reflect the nature of the content.
Using tables to layout HTML pages used to be common practice, but it was not semantically accurate as an entire website is not tabular data. Similarly, <b>
gives no additional importance to text, whereas <strong>
has a defined meaning in HTML. Accurately marking up your HTML allows it to be understood more correctly by the devices reading/displaying it.
If you had a paragraph and you wanted highlight certain words/phrases how would you do so without additional markup?
<p>This is a paragraph. Lorem ipsum dolor sit amet, consectetur adipisicing
elit. Iure, neque aperiam exercitationem beatae.</p>
Typically in CSS you could only style the entire paragraph above (i.e. make the entire paragraph bold, red, whatever). You could select individual words/phrase by using additional elements, e.g. wrapping them in <i>
, <b>
, <strong>
, <em>
, <span>
, but how do you decide which? You pick the one that most accurately defines the meaning of the word you are choosing to style differently.
Which has more meaning?
Example 1:
<style>
.important {
font-weight: bold;
}
.emphasized {
font-style: italic;
}
</style>
<p>This is a paragraph. Lorem ipsum <span class="important">dolor
sit amet, consectetur adipisicing elit</span>. Iure, neque
<span class="emphasized">aperiam</span> exercitationem beatae.</p>
Example 2:
<p>This is a paragraph. Lorem ipsum <strong>dolor sit amet,
consectetur adipisicing elit</strong>. Iure, neque <em>aperiam</em>
exercitationem beatae.</p>
In the first example the browser will simply display the text with the styles you have given it, it has no additional meaning to a machine other than it is a paragraph. You have human recognizable class names, which would show your intention to someone reading the code, but it has no meaning in HTML.
The second example can have more of the meaning interpreted by a device because semantic markup has been used to show the intention of the text.
Edit: added some line breaks in the code examples to try and make it more readable without scrolling sideways.
Chris Shaffer
12,030 PointsChris Shaffer
12,030 PointsRight, I get that, but the point is that there is almost no case in which we would do this as in-line CSS rather than using the CSS stylesheet. I work in the software industry, specifically in web development and in-line CSS is generally considered a big no-no.
Styling in HTML at all is basically a noob move in the industry. I'm not saying it's not possible or not worth knowing, but it's generally not used.
Neil Northrop
5,095 PointsNeil Northrop
5,095 PointsIf I understood correctly, <strong> wasn't created to use as inline CSS but rather for eReaders, among a few other reasons.
https://stackoverflow.com/questions/271743/whats-the-difference-between-b-and-strong-i-and-em
Tom Bedford
15,645 PointsTom Bedford
15,645 PointsHi Chris
Using
<strong>
isn't inline CSS, it's marking the text as having a different mood/voice/importance to the text around it. It adds semantic meaning and is correct to use where appropriate. Similarly, using<em>
for emphasized text is also good practice.