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


#1

Question

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

Answer

Within software engineering, there is a design principle known as “separation of concerns” which aims to create scalable, more easily maintainable coding architectures. For web developers, this principle guides us to keep our structure (HTML) separate from our presentation (CSS).


FAQ: Learn HTML Tables - Tables - Table Borders
#4

Where in HTML code should I use CSS to add borders?


#5

You will reference a .css file from your .html file in which you will have written all the code necessary to style your webpage (including table borders) rather than adding it onto your .html file :slight_smile:


#6

cant we just use div to border them?


#7

I totally understand the explanation, But in my opinion, it still does not make sense.
Code process always should be simple and easy. By separating ‘making borders’ from html, we are not making it easy, but complicated.
I prefer the old way.


#8

Honestly, I still do not get this.


#9

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