Hack Forums
Need help with Html&CSS - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5)
+---- Thread: Need help with Html&CSS (/showthread.php?tid=6126268)



Need help with Html&CSS - LambertGolden - Dec 8, 2020

Guys i recently started learning html & css, so i am begginer and i got some questions to ask from the more experienced guys.
Why should i use <header> tag, <footer> tag, when i could just make one div for the header, like this <div> and here put everything that i would put before with <header> tag. </div>
Maybe i wasnt as much understandable, but i tried my best.


RE: Need help with Html&CSS - tux1 - Dec 8, 2020

The main reasons for using the different tags are:
1. To make the code easier to read, once the code starts getting long or if you are working with multiple people it just makes life easier
2. It helps automated bots, screen readers and search engine makes sense of your page

In short, it's a good habit to use the right html tags


RE: Need help with Html&CSS - Doc - Dec 9, 2020

(Dec 8, 2020 03:58 PM)tux1 Wrote:  The main reasons for using the different tags are:
1. To make the code easier to read, once the code starts getting long or if you are working with multiple people it just makes life easier
2. It helps automated bots, screen readers and search engine makes sense of your page

In short, it's a good habit to use the right html tags

I second this. Coding (HTML isn't a programming language but I mean it's at the very least similar to coding) isn't just a matter of "as long as it works that's all that matters"
I mean what if you've gotta go back to a project you wrote 6 months ago and rework some part of it and you then discover you didn't put comments in it anywhere and so now you've gotta spend all this extra time deciphering code you already wrote?
Trust me, dealing with that is a nightmare, that's why it's best practice to do things like using the right html tags and following certain style conventions/guidelines, like PEP8 for Python for example. PEP8 encourages you to name Python variables like this:
Code
this_variable = 0
and not like this:
Code
thisVariable = 0

So yeah, probably best to just use the different tags for readability and to make life easier for anyone else that might get involved with whatever you're working on. Plus it's always a good idea to start developing good habits from the start.


RE: Need help with Html&CSS - Mister Slyther - Dec 9, 2020

Because those tags are HTML semantics, it helps with SEO and devices comprehend the layout of your page better.

What are Semantic Elements? A semantic element clearly describes its meaning to both the browser and the developer.

In other words, when you use those tags, you are speaking HTML.


RE: Need help with Html&CSS - guardian - Dec 16, 2020

Lots of html tags are not "necessary", as it is pretty fault tolerant and most browsers will be able to read html, even if tags are missing (for instance closing tags)
As mentioned by other users, it is a good habit and makes your code easier to read and maintain
For one static page it might not be a big thing, but when you start working on real projects you'll realize that clean code that is well structured, even if it is just html, will make your life a lot easier