Learning the why?

Learning the why?
0

#1

Hello all,
I have a question, I look at the process as reps the lessons, projects and even research as reps using the code.

The part im struggling with is the why aspect. I know this code does that and a rough idea of what to google. but why

when …But i guess reps and research will add into that? its only week 2 for me.

thanks
Justin


#2

I don’t really understand the question. What "why"s are you concerned about?


#3

Let me see if I can clarify,

Why certain code over others if they do exactly the same thing. why use div versus article I guess. I understand article denotes and actual article but don’t they effectively do the same thing in HTML? That is the overwhelming part trying to understand it all and retain it. Im wanting to understand the code more so then just replicate. I guess thats the struggle im focusing on.

Justin


#4

In terms of HTML the “when to use this as opposed to that” is one of those things that often either isn’t relevant or doesn’t make a lot of sense in the small, limited context of the early challenges. It really comes into play when you’re building a whole page or component. Whether it’s through trial-and-error, conversation with other members of the community, or your own research, you’ll start getting a handle on this as you start your front end projects. An example that comes immediately to mind: a couple days ago someone was asking for help with positioning text and the answer was “If you want to use display: inline on text, you should put it in a span instead of a p because a p consumes the full width of the parent.” That sort of thing isn’t going to make much sense in a “Here’s the paragraph element” challenge.

I do strongly encourage you to look up the html elements that you are learning with resources like MDN. That will give you a much more extensive “typically used for” or “differs from the other thing by” explanations.

ETA: And it’s always a good time to ask! Whatever lingering “when” and “why” questions that you have after looking at a longer description of an element, feel free to come start a discussion in the forum!