Doesn't CSS define presentation of web content?

Question

Codecademy says that a markup language like HTML “defines structure and presentation of raw text”. Doesn’t CSS define the presentation of web content?

Answer

That is correct! These days HTML is best categorized as a descriptive markup language which encourages developers to focus on the semantic meaning of information rather than its visual appearance. However, there are other markup languages which make no such separation of concerns. In fact, HTML used to be more presentational before the advent of CSS.

On a related note, it is important to realize that most browsers have default styles which they will apply to certain HTML elements.

21 Likes

So, for clarity, as a layman…What the ■■■■ does that mean?

35 Likes

In its simplest terms. HTML is your skeleton with text, images, links etc forming a base/foundation of a webpage and CSS is your muscles, skin and clothing to make it more presentable with font style, font colours, image alignment, background colours etc.

If you want another example, if you build a house, the brickwork, plastering and foundations are HTML, the CSS is your external and interior decorating to jazz it up abit.

HTML can be used exclusively when designing a webpage, but you’re rather limited as to what you can tweak visually on a webpage. CSS released a few years after HTML had been out so until it was released a developer had to make do with the tools at their disposal. There can, in some instances, be blurred lines between the two langauges but it’s often encourged to use HTML as a foundation and CSS as your style.

There are other markup languages which I’m not going to go into, that can do both raw text and styling at the same time, but this can look messy and is not very beginner friendly which is why HTML and CSS are seen as the standard for starting out.

I hope this eases any confusion @bitplayer07282

155 Likes

So is HTML a place to store content and CSS is a how we make that content more presentable.

5 Likes

@rgurule Yes, although I wouldn’t say HTML is a “place” or use the word “store” because the storing is done elsewhere. I think just saying HTML is a way to write content while CSS is a way to format that content is more appropriate.

25 Likes

You mean “…rather than its visual appearance” - its in this case should not have an apostrophe. It’s with an apostrophe is reserved for the “it + is” conjunction. Its (no apostrophe) is the possessive of it, as in “its visual appearance”.

So HTML is the skeleton, CSS is skin and muscles, what’s PHP in this illustration?

Thanks

2 Likes

Hi @Gal3rm,

Are you familiar with what PHP is? I’m going to proceed with my answer under the assumption that it is a rudimentary knowledge so I can give the most simple answer possible.

HTML is a in the category of whats referred to as “front end technology” in terms of web development. I’m not going to go too far into this as sometimes the line can get blurred but whats important here is front end refers to what the user will see, so, referring back to my analogy, this would be the human form (HTML Skeleton with CSS skin and muscles)

PHP is slightly special in that it is a server side scripting language. With it being server side, this means the scripts will run in the “back end” of the website, or, put bluntly, everything the user doesn’t see. When PHP scripts execute they will manipulate data which is on the server and change output based on what a user will input. I suppose the most apt comparison within my analogy would be to compare it to a human brain. I could compare it to movement within the muscles but that would primarily be animation, it’s the brain that sends the instruction to the muscles to tell them how to react. PHP is what would make a website more dynamic, often pulling information from a database that would also be part of the back end.

I hope this helps =)

33 Likes

Thank you! That made a lot of sense actually. Thanks for taking to time to respond.

4 Likes

Thank u for this topic!

1 Like

Are you really here to even learn HTML, or what lady? Maybe he was typing on his iPhone, and auto-correct came into play. Either way, IT’S of no significance.

5 Likes

It is true. HTML used to be more presentional.

Wielka Brytania

I really appreciate this answer.

Your analogy has finally made it clear to me why there would be a need for both HTML and CSS.

2 Likes