Why is there div class and div Id for same section?


#1


I saw this code in the first page of the exercise. I dont understand why we use div id=head-text? the entire text is already inside the div header
If i wanted to change the text couldnt i just select the .header?


Replace this line with your code. 

  <div class="header">
    <div id="header-text">
      <h1>Travel Like Never Before</h1>
      <h2>Whether you're looking for adventure or luxury, let us help you plan your perfect getaway.</h2>
    </div>
  </div>

Appreciate any input.
btw love this site thank you


#2

It's possibly a separation of concerns. header may apply position and dimension properties (layout) along with border and background, while header-text may apply presentational styles.


#3

ohh I see. So it would keep things neater by separating them. that makes a lot of sense.

thank you


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.