ExamBank Scot · Higher Computing Science question bank · All Higher Computing Science questions
11 marks · CSS rules and selectors
Write a single CSS rule to apply the correct margins to all the h2, h3 and image elements on the web page. Complete the CSS rule below to correctly position the images to allow the pizza information and price to appear in the correct position. img{height: 100px; width: 100px; _____________________} To add interactivity to this page the restaurant would like the information about each pizza to only appear to the user when they place their cursor over the image of the pizza. Part of the HTML code for the page is shown below. … <section id="menu"> <h2> Pizza Choices </h2> <div id="margherita"> <h3> Margherita </h3> <____________________________________________> <div id="margInfo"> <p> Classic cheese and tomato </p> <p> £7.99 </p> </div> </div> … </section> … Write the CSS rule needed to initially hide the description and price of the Margherita pizza. Complete the missing JavaScript code to allow the information to be displayed on the screen. function displayMText(){ document.getElementById("margInfo").style.display = "______________________________________";} Write the missing line of the HTML code shown above to apply the JavaScript function from part (ii) to the image ‘mPizza.jpg’ when the user places their cursor over the image. A page on the website allows users to leave a review of the restaurant using an online form. A design for part of this form is shown below. Write the line of HTML code needed for the form element that would allow the user to type their name. Write the line of HTML code needed for the form element that would allow the user to type their comment. A pizza restaurant is redesigning their website and want to display information about the three most popular pizzas — Margherita, Hawaiian and Pepperoni. Part of the wireframe design is shown below.
Award 1 mark for each bullet. • Grouping h2,h3,img • Correct margins: 10 px h2,h3,img {margin:10px;} float: left; OR display: inline; Accept inline-block; Award 1 mark for each bullet. • ID: #margInfo • display: none #margInfo {display:none;} Accept inline style: <div id="margInfo" style="display: none"> block inline Accept inline-block; Award 1 mark for each bullet. • Image added • Onmouseover event with function <img src=”mPizza.jpg” onmouseover="displayMText() "> May include (this) as parameter to the function <input type=”text” …> Award 1 mark for each bullet. • <textarea> (with closing </textarea>) • required attribute within an element <textarea required></textarea> Do not accept <input type=”text”>
Previous question: Higher Computing Science 2023 Question 17