Web Design and Development

Tutorial 5 - SVG


Task 1 - Create an SVG Interactive SVG Navigation

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.

example of interactive svg
Fig.1 - A snapshot of an interactive SVG you want to achieve for this tutorial exercise.

To achieve this, follow the steps outlined below:

  • fill="lightblue"
  • The second quarter of the circle corresponding to spring will have the following properties:
  • The third quarter of the circle corresponding to summer will have the following properties:
  • The fourth quarter of the circle corresponding to autumn will have the following properties:
  • Each quadrant of the circle contains a thumbnail image and a title corresponding to each season. Starting from Winter, followed by Spring, Summer and Autumn going clockwise. To achieve this you need to introduce HTML elements within the svg. We use the foreignObject tag for something like this.
    Followed each path you re-used with the use tag create a foreignObject tag. Each foreignObject will have, different coordinates:
  • Each foreignObject will be followed by a div class="season-label" containing:
  • The images are provided in tutorial5_startup.zip.

  • Make each 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).
  • Use the tabindex="0" attribute to control keyboard navigation by determining whether an element can receive focus when users press the Tab key.
  • Task 2 - Format the Interactive SVG

    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;
    }

    Task 3 - Validate your code

    Task 4 - Upload your page to the Web server and set the correct permissions

    Task 5 - Share your design with your peers and comment on other's work.

    Task 6 - Complete the Practice Test on Blackboard


    Prepared by Daphne Economou.
    Last modified, February 2025 by Daphne Economou
    Accessibility statement