Hi,
Here is the Task 4 decription:
User Story #4: Each section element with the class of main-section should
also have an id that corresponds with the text of each header contained
within it. Any spaces should be replaced with underscores (e.g. The section
that contains the header "Javascript and Java" should have a corresponding
id="Javascript_and_Java").
Here are some mistakes I’ve found in the code:
<section class="main-section" id="what_you_should_already_know">
<header>What you should already know</header>
<section class="main-section" id="Javascript_&_Java">
<header>JavaScript and Java</header>
<section class="main-section" id="If...Else_Statement">
<header>if...else statement</header>
<section class="main-section" id="While_statement">
<header>while statement</header>
Do you see what mistakes you made?
EXAMPLE:
Your code:
<section class="main-section" id="While_statement">
<header>while statement</header>
The way it should be like:
<section class="main-section" id="While_statement">
<header>While statement</header>
For example, the MY TEXT
from the inside of the <header> MY TEXT </header>
should be included as an id
to the section
element with class main section
in the following way MY_TEXT
.
Hi,
Thanks for your help,
It’s working fine now.
What i learned is:
1. id="MY_ID" need to be same as Href="#MY_ID" # -( A Hash within a hyperlink specifies an html element id to which the window should be scrolled.)
2.The text between ancer tag<a>My Header Text</a> need to be same as <header>My Header Text</header>
Code Example:
<ul>
<li>
<a class="nav-link" href="#MY_ID">My Header Text</a>
</li>
</ul>
<section class="main-section" id="MY_ID">
<header>My Header Text</header>
</section>
note that this is always valid, if you want your code to work
but you need to do this:
only because the user story asks you to
we can say this is better practice. code will be more managed.