Use a text editor of your choice to create a new file. Save the file on your home h: drive as tutorial5.html
The form you will create should resemble Fig.1 below, indicating that you should aim to replicate a page that integrates a similar interactive SVG.
To achieve this, follow the steps outlined below:
<header> that contains a <h1> for the page title "Interactive SVG Navigation" and a paragraph <p> that provides a short description for the page. Close the <header><main> area of the page that contains a <section> with a class name "seasons", containing:<h2> for the section.<p> with the text "Each season brings its own beauty. Click on any section of the circle to learn more about Winter, Spring, Summer, and Autumn."<section class="seasons"> create an <svg"> with <viewBox="0 0 200 200"">. Make sure you use accessibility tags like <aria-label> to describe the svg.d="M 100 100 L 100 5 A 95 95 0 0 1 195 100 Z".
The path d="M 100 100 L 100 5 A 95 95 0 0 1 195 100 Z" defines a quarter-circle quadrant in SVG.
| Command | Meaning |
|---|---|
M 100 100 |
Move To: Start at (100,100) (center of the circle) |
L 100 5 |
Line To: Draw a straight line upwards to (100,5) (top center of the quadrant) |
A 95 95 0 0 1 195 100 |
Arc To: Draw an arc from (100,5) to (195,100), forming a quarter-circle |
Z |
Close Path: Connects the last point (195,100) back to (100,100), forming a closed shape |
This path creates a quarter-circle (90-degree segment) starting from the center of the circle and moving to the top.
circle with center coordinates cx="100", cy="100" and radius r="95". Set up its propertries with fill="white", stroke="black" and stroke-width="3".<use> tag to reuse the path id="quadrant" and create the 4 quarters of the circle corresponding to the 4 seasons. The 4 quarters of the circle will have different transformation and fill, but they will share the same class name class="season-quadrant" and in this way we will be able to select them and create a CSS rule that applies to all of them.
transform="rotate(0, 100, 100)"fill="lightblue"transform="rotate(90, 100, 100)"fill="lightgreen"transform="rotate(180, 100, 100)" fill="yellow"transform="rotate(270, 100, 100)"fill="orange"foreignObject tag for something like this.path you re-used with the use tag create a foreignObject tag. Each foreignObject will have, different coordinates:
foreignObject for winter will be x="75" y="10" width="50" height="50"foreignObject for spring will be x="140" y="75" width="50" height="50"foreignObject for summer will be x="75" y="140" width="50" height="50"foreignObject for autumn will be x="10" y="75" width="50" height="50"span with the text for the season name (Winter, Spring, Summer, Autumn).foreignObject will be followed by a div class="season-label" containing:The images are provided in tutorial5_startup.zip.
foreignObject a link to a web page for each coresponding season. Create relational links as if the html pages you call are structured in the same folder path with this tutorial exercise (the files are in the same folder).
tabindex="0" attribute to control keyboard navigation by determining whether an element can receive focus when users press the Tab key.
Use linked style sheet to further modify the HTML content to resemble the example layout of Fig.1 above.
Here is some help, use the following rule for some of the elements you have created:/* Seasons Section */
.seasons {
position: relative;
width: 800px;
margin-left: auto;
margin-right: auto;
padding: 20px;
height: 300px; /* Enough space for 200px SVG + 20px top/bottom padding */
background: white;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.seasons svg {
width: 300px;
height: 300px;
}
/* Style the season labels inside foreignObject */
.season-label {
text-align: center;
font-size: 10px;
font-weight: bold;
background: lightcyan;
padding: 5px;
height: auto;
border-radius: 10px;
}