I'm new to HTML. Been learning for more than 2 months+ and I am as yet befuddled about the most "useful" approach to coding however I realize I shouldn't overthink it. Question - For the example below, do I still need a div id="header" since there is a header class="header"? Is it because of the div's flexibility for styling purpose if I happened to add/style anything to it next time? I did see the Freecodecamp project website example having a semantic tag like header tag nested in non-semantic div. So I follow suit.
Div and semantic tags usage
2
I'm new to HTML. Been learning for more than 2 months+ and I am as yet befuddled about the most "useful" approach to coding however I realize I shouldn't overthink it.
Question - For the example below, do I still need a div id="header" since there is a header class="header"? Is it because of the div's flexibility for styling purpose if I happened to add/style anything to it next time? I did see the Freecodecamp project website example having a semantic tag like header tag nested in non-semantic div. So I follow suit.
As for CSS, I never style anything to the div id="header". I asked this question because it feels the div is a little redundant and I assume, lesser tags and codes make cleaner and clearer coding?
Question - For the example below, do I still need a div id="header" since there is a header class="header"? Is it because of the div's flexibility for styling purpose if I happened to add/style anything to it next time? I did see the Freecodecamp project website example having a semantic tag like header tag nested in non-semantic div. So I follow suit.
As for CSS, I never style anything to the div id="header". I asked this question because it feels the div is a little redundant and I assume, lesser tags and codes make cleaner and clearer coding?
Code:
.logo {
margin: 20px 0 0 20px;
}
.logo img {
max-width: 230px;
}
header {
display: flex;
font-weight: 700;
font-family: Arial, Helvetica, sans-serif;
color: #fff;
justify-content: space-around;
align-items: baseline;
} Code:
<!-- Header Wrap-->
<div id="header">
<!-- Logo-->
<header class="header">
<div class="logo"><a href="#"><img src="../t/img/b.png" alt="logo" /></a></div>
<!--Navigation-->
<nav class="header-menu">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Terms</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
</div> - savidge4
- [ 1 ] Thanks
- ukeme peter
- Justcare
Next Topics on Trending Feed
-
2