Why should we use CSS rather than HTML to create borders for our tables?

I agree with you. But being a pro entails being competent and adopting a proper professional way of doing things.

5 Likes

Hold on… You are not the only one :smiley:

2 Likes

Not a pro but I understand the intention or principle here. The goal of your html file is to setup and define the structure and content of your page. It’s better to keep the styling (CSS) separate so that you can style similar and related content in one swoop.

With the old way, you would need to style every element or structure (eg. tables, list) individually in the html. With the new way you can style just one, a few or any amount of elements you the designer deem similar in function or purpose or position very easily.

Hope this helps.

48 Likes

Zormus nailed it. I’m not pro on this either but it makes sense that it’d be cleaner to separate style from substance. If HTML is like the skeleton and muscular systems that make up the core pieces of a page, CSS is like the skin put over top of it; your skin is one large organ with consistent properties of its own that only have to be defined once, and if you had separate skin systems to cover each limb of your skeleton/musculature structure, that would create lots of unnecessary extra seams and internal complex joinery, which creates room for more flaws and errors and also makes the whole system messier to examine or mentally break down.

31 Likes

Thanks! Helped me) as I just wondered why I have to use different types of notations for single page.

1 Like

Here’s the thing…you don’t. Eventually, we’ll get to the point where we have taken the codeacademy.com CSS course and are ready to collaborate code.

(for example) Having an index.html file tab open in our Text Editor/IDE while simultaneously writing code in a .css tab that would point directly to the second row of the table.

OR you can INSERT the CSS code like illustrated in the image below although is trickier and it is recommended by most professionals to keep codes separate.

51%20PM

6 Likes
1 Like

I’m new to this as well, but I don’t believe div produces an actual physical effect on the webpage. We use

in order to group a certain section of our code, so that we can easily style it later with CSS or something else.
1 Like

If you put everything in the same box “html” file, you will be creating a messy code and unreadable.

1 Like

If you put everything in the same box “html” file, you will be creating a messy code and unreadable.
This is why CSS is important.

Styling in CSS makes the code smaller than HTML.
TOFEL Classes in Pune

So, according to the matters of this discussion, borders would be CSS oriented? Thus, it is regarded as “separation of concerns”?

Creating borders, making the table look good belows to the desing aspect of a website. Therefore, CSS would be better sutied for it. HTML is used for content eg. adding words, tables and pictures.

I found a good short video that would explain this concept well.

Hope it helps! Enjoy learning!

7 Likes

This channel is awesome ~thanks for sharing~ she made it easy to understand

I dont think we can,div are basiacaly for code text grouping if am not mistaken😊

<div></div> is one of a number of sectioning elements. Were it the parent element of the element we wish to border, the border property could be applied to it and on the screen nobody would be the wiser.

If we use CSS to maintain the overall size of the object, the border will take up some of the space of the child element. In a way, while this adds structure (more code) but it also frees up the child element to have its own background and sizing expectations. If its width is 100%, then it will not demand any more space than the parent can allow. The parent can be fixed size, relative size, of even relative to the body size. It won’t matter to the child.

In a way this is a better way to separate concerns that only get in the way of the actual styling we want on the child element. Any properties that can be handed up to the parent will only make the selector rule(s) at the child level simpler and easier to maintain.

1 Like

how to open dashboard of any wifi through guest account?

Making it modular never makes it complicated, it’s just a matter of getting used of that

Yeah, it still seems a little weird, but I think those of us learning can expect that some things won’t make sense until we’ve learned a little more about computer science and the purpose of the code that we’re learning. I honestly did find it somewhat helpful to do an internet search for “Separation of Concerns” and read a bit about the reasoning behind it.

thanks for your illustration @bjthomas1 you save my life :slightly_smiling_face: