Given the following markup: Where does the image align in relation to the text?
Correct Answer: C
The CSS propertyvertical-align: baselinealigns the baseline of the element with the baseline of its parent. For inline elements like images, the baseline alignment means that the bottom of the image aligns with the bottom of the text. * CSSvertical-alignProperty: * Baseline Alignment: Aligns the baseline of the element with the baseline of its parent. * Example: <p>Hello World<img src="sample.jpg" style="vertical-align:baseline"></p> * Analysis: * The<img>element withvertical-align: baselinewill align its bottom with the bottom of the surrounding text "Hello World". : MDN Web Docs -vertical-align W3C CSS Inline Layout Module Level 3
Question 17
A web page includes the following CSS code: ```css @keyframes anim_01 { 0% { left: 0px; top: 0px; } 50% { left: 200px; top: 0px; } 100% { left: 600px; top: 0px; } } .animation { position: relative; animation-name: anim_01; animation-duration: 4s; animation-timing-function: linear; animation-iteration-count: infinite; animation-direction: alternate; animation-play-state: running; } ``` What happens to the animation when the style is invoked?
Correct Answer: A
> "The animation changes the `left` property from 0px to 600px while keeping the `top` at 0px throughout. This means the animation causes horizontal movement only." > > "Since `position: relative` is set, changes in `left` and `top` move the element relative to its normal position." Thus, the element moves horizontally across the screen, alternating direction infinitely. References: * MDN Web Docs: CSS animation-direction, animation-name * CSS Animations Module Level 1 Specification ---
Question 18
What is the default behavior of overlay elements?
Correct Answer: A
In CSS, when elements overlap, the default behavior is that the last element listed in the HTML document appears on top. * Stacking Context: * Default Behavior: Elements are stacked in the order they appear in the HTML. The last element in the document tree is rendered on top. * z-index: You can control stacking order using the z-index property, but without it, the default order applies. * Example: * Given HTML: <div style="position: absolute; width: 100px; height: 100px; background-color: red;"></div> <div style="position: absolute; width: 100px; height: 100px; background-color: blue;"></div> * The blue div will be on top of the red div because it appears later in the HTML document. * References: * MDN Web Docs - Stacking context * W3C CSS Positioned Layout Module Level 3 By understanding these fundamental CSS concepts, developers can create more effective and visually appealing web layouts.
Question 19
Where can users items using the HTML
Correct Answer: C
Using HTML, users can upload files from their computer to a web page using the<input>element with thetype="file"attribute. * File Upload Input: The<input type="file">element is used in forms to allow users to select files from their local file system to be uploaded to a server. * Usage Example: The<canvas>element in HTML5 is used to render images and graphics dynamically through JavaScript. It is a powerful feature for creating graphics, game visuals, data visualizations, and other graphical content directly in the browser. * Canvas Element: The<canvas>element is an HTML tag that, with the help of JavaScript, can be used to draw and manipulate graphics on the fly. * Usage Example: html Copy code <canvas id="myCanvas" width="200" height="100"></canvas> <script> var canvas = document.getElementById("myCanvas"); var ctx = canvas.getContext("2d"); ctx.fillStyle = "#FF0000"; ctx.fillRect(0, 0, 200, 100); </script> In this example, a red rectangle is drawn on a canvas element. : MDN Web Docs on<canvas> W3C HTML Canvas 2D Context Specification <form action="/upload" method="post" enctype="multipart/form-data"> <input type="file" name="fileToUpload" id="fileToUpload"> <input type="submit" value="Upload File" name="submit"> </form> In this example, users can choose a file from their computer and upload it to the specified server endpoint. References: MDN Web Docs on<input type="file"> W3C HTML Specification on File Upload
Question 20
What is a characteristic of JavaScript code?
Correct Answer: A
JavaScript is a scripting language primarily used for creating and controlling dynamic website content. Here are some characteristics: * Runs Inside a Web Browser: JavaScript code is executed in the web browser, making it possible to create interactive and dynamic web pages. * Cross-Browser Compatibility: JavaScript is designed to be compatible across different web browsers. * Interpreted Language: JavaScript is interpreted, meaning it does not need to be compiled before execution. * Accessible to Users: JavaScript code is not hidden from the user; it can be viewed in the browser's developer tools. References: * MDN Web Docs on JavaScript * W3C JavaScript Introduction