Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Need help with Html&CSS

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.
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
Hey there,
If I have helped you or if you just enjoy my posts, please consider donating bitcoin to me 1DpL2kcxuidEsjt2MMN2AYufcVoXbi3v2X

[Image: FtwuQgr.gif]
(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.
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.
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
All my answers/posts are for educational purposes only. I am not in any way responsible for the actions you perform with the acquired knowledge.
[Image: ZjBA6fR.gif]


Possibly Related Threads...
Thread / Author Replies Views Last Post
by blackcoder00May 30, 2026 03:02 PM 2 100 May 30, 2026 03:02 PM
Last Post: blackcoder00
by emadaldin1Mar 29, 2023 07:59 AM 2 135 Mar 29, 2023 07:59 AM
Last Post: emadaldin1
[Help] by HamwareNov 22, 2022 07:27 AM 0 324 Nov 22, 2022 07:27 AM
Last Post: Hamware