For all exercises, validate your HTML and use inspect in the browser (Chrome!!) to check the console messages.
This week may be a challenge - use the 02 Lecture slides for reference - if you complete everything today, well done!
If not, don’t worry - use your Self-directed Learning Time (SDL) to work on your code before next week’s lab. If you get stuck, keep trying! The simplest version of the solutions will be demonstrated next week.
index.html
, a CSS file styles.css
and a “js” folder containing a JavaScript file scripts.js
a
” tag links (<a href="#">link text</a>
tags) inside a nav
tag. Keep it simple and don’t use any other tags to do this:hover
style for the menu itemstransition
to make the menu item background fade to another colour on hover (clue: the CSS transition
rule goes on the “a
” tag selector rule, not the a:hover
selector rule)header
section above the nav
tag, containing an h1
tag with a few wordsmain
tag below the nav
tag, containing a paragraph “p
” tag with the text “Click me to say hello”body
and h1
margins so that body
, header
, nav
and main
have no gaps between thema
” tags in the nav
vertically, and set a width of 15%
to the nav tag and 85%
to the main
tagpadding
on the main
tag, then use float: left;
and float: right;
on the nav
and main
with box-sizing
to contain the main
tag paddingid
attribute of "hello"
to the “p
” tagdocument.getElementById();
to set a JavaScript const
property named hello
to store a reference to the paragrapheventListener(){}
to the hello
variable that listens for a "click"
event and calls a named function greeting
greeting
function that sends a message to the console using console.log();
greeting
function that changes the text of the paragraph to a text string of your owngetElementById and
and eventListener
work togetheraddEventListener()
and various types of getElement(s)By
functions. It will help you understand how to use JavaScript to interact with the DOM.