HTML AND CSS ASSIGNMENT-1 SUBMITTED BY Mr. MAYANK SHARMA TO Mr. SHUBHAM FACULTY OF FULL STACK PYTHON DEVELOPMENT NIIT INSTITUTE 1. What is the use of HTML? What does HTML stand for? HTML is use for declaring web pages It defines the structure of the web page that is how the content is organised and linked togather. Also it is used for linking one webpage to another. HTML stands for Hyper Text Markup Language. 2. Who is the inventor of HTML? and What is the difference between HTML and HTML5? TIM BERNERS-LEE invented HTML in 1993. HTML HTML 5 It did’nt support audio and video controls. It supports audio and video controls with the use of <audio> and <video> tags. Does not allow JavaScript to run in Allows JavaScript to run in browser background. This is possible due to JS web worker API in HTML5. It uses <select> and <option> tags for It uses <datalist> tag combines with dropdown input values <input> tag. Not possible to draw shapes like Allows to draw shapes like circle, circle, rectangle,etc. rectangle, etc. 3. What is the role of the <head> tag in an HTML5? Give the name of any 5 tags which can you use in head tag. <head> tag in html 5 is used to define the head portion of the document which contains information related to document. It contains head elements. In HTML 5 <head> tag can be omitted. The five tags used inside head tags are 1. <style> 2. 3. 4. 5. <meta> <link> <script> <title> 4. How do you create a hyperlink in HTML5? What is the difference between an absolute and a relative URL? To make a hyperlink in an HTML page, use <a> and </a> tags, known as anchor tags. The text written inside these tags will work as a hyperlink. Example to create hyperlink: <a href=”abc.com”> click here </a>, where href defines the URL of linked resources. ABSOLUTE URL It contains all the information necessary to locate a resource. Means it contains path, resource, scheme and server. RELATIVE URL It locates a resource using an absolute URL as a starting point. Means it contains only path and not scheme or server. 5. What is the difference between the <div> and <span> elements in HTML? What is the purpose of the "alt" attribute in an image tag? <div> It defines section at block level it takes entire width of screen it applies styling to other html tag present inside <span> It defines section at inline- level It keeps to the width of the element it contains Does not apply to other html tags present inside. “alt” attribute in <img> tag is use to give alternate name to image in case the image is unable to load by the browser. 6. What is the different type of list in html? Explain all type of list with an example. Different types of list in html : ORDERED LIST It is defined by <ol> </ol> tags. types of values are {(1,2,3...)(i,ii,iii...)(I,II,III,...)(a,b,c...)(A,B,C...)}, by default (1,2,3...) Example: <ol type=”a”> <li>html <li>css <li>js </ol> UNORDERED LIST It is defined by <ul></ul> tags. It have 3 type of values {(•)disc(default), (°)circle and (■)square.} Example: <ul type=”square”> <li>css <li>js <li>python </ul> DESCRIPTION LIST It helps in defining heading of glossary and also the description of that heading data. It uses <dl> <dd> and <dt> in this specific order. Example: <dl> <dt> Red </dt> <dd> this is the symbol of danger </dd> </dl> 7. What is the purpose of the "form" tag in HTML? Give an example. What is the purpose of “input” tag in HTML? Give an example. An HTML form is used to collect user input. The user input is most often sent to a server for processing. Example: <!DOCTYPE html> <html> <body> <h2>HTML Forms</h2> <form action="/action_page.php"> <label for="fname">First name:</label><br> <input type="text" id="fname" name="fname" value="John"><br> <label for="lname">Last name:</label><br> <input type="text" id="lname" name="lname" value="Doe"><br><br> <input type="submit" value="Submit"> </form> <p>If you click the "Submit" button, the form-data will be sent to a page called "/action_page.php".</p> </body> </html> Purpose of input tag is: <input type="text"> defines a single-line text input field Example: <form action="/action_page.php"> <label for="fname">First name:</label><br> <input type="text" id="fname" name="fname"><br><br> <input type="submit" value="Submit"> </form> 8. What is the latest version of HTML? A. HTML 4.01 B. HTML 5 C. XHTML D. HTML 4.1 9. Which tag is used to define a hyperlink in HTML? A. <a> B. <link> C. <meta> D. <header> 10. Choose the right sequence for define: paragraph, line- break, division, table, heading in HTML? A. <p>,<br>,<div>,<td>,<h2> B. <p>,<br>,<div>,<table>,<h2> C. <p><break><div><table>,<h1> D. <p><br><alt><table><h1> 11. Which attribute is used to specify the alternate message and URL of the image in the <img> tag? A. alt-msg and src B. alt and href C. alt and src D. title and src 12. Which tag is used to define a form in HTML? A. <form> B. <input> C. <select> D. <button> 13. What is the correct HTML5 element for embedding a video? A. <video> B. <media> C. <embed> D. <object> 14. Which HTML5 element is used to define a list with bullet points? A. <ol> B. <li> C. <ul> D.<dl> 15. Which HTML5 element is used to group together related form elements? A. <fieldset> B. <formset> C. <group> D. <formgroup> 16. What is the CSS? What does CSS stand for? What is its purpose in web development? CSS is the language we use to style an HTML document. CSS describes how HTML elements should be displayed. CSS stands for Cascading Style Sheet. The purpose of CSS is to provide Web developers with a standard way to define, apply and manage sets of style characteristics. CSS provides these capabilities through a technical model based on a hierarchical scope of effect, the separation of style from content, and a well-defined set of published standards. **Child elements either inherit or override property values bound to their parent elements. 17. What do you mean by selectors? What are the different types of selectors in CSS3? CSS selectors are used to "find" (or select) the HTML elements you want to style. We can divide CSS selectors into five categories: Simple selectors (select elements based on name, id, class) Combinator selector (select elements based on a specific relationship between them) Pseudo-class selectors (select elements based on a certain state) Pseudo-element selectors (select and style a part of an element) Attribute selector (select elements based on an attribute or attribute value) 18. What is the flex-box model in CSS3? give a diagram. The flexible box layout module, usually referred to as flexbox, was designed as a one-dimensional layout model, and as a method that could offer space distribution between items in an interface and powerful alignment capabilities. When working with flexbox you need to think in terms of two axes — the main axis and the cross axis. The main axis is defined by the flex-direction property, and the cross axis runs perpendicular to it. Everything we do with flexbox refers back to these axes, 19. What is the difference between padding and margin in CSS3? In CSS, a margin is the space around an element’s border, while padding is the space between an element’s border and the element’s content. Put another way, the margin property controls the space outside an element, and the padding property controls the space inside an element. 20. what do you mean by linking a CSS file to an HTML document? Explain the all type of linking css. Linking CSS file to an HTML document means using style attributes and their values to apply on different HTML elements to make the webpage look more appealing in a easy and less time consuming way. CSS can be added to HTML documents in 3 ways: Inline - by using the style attribute inside HTML elements Internal - by using a <style> element in the <head> section External - by using a <link> element to link to an external CSS file 21. What is the syntax for setting a background color in CSS? And how do you center an element horizontally in CSS? The background-color property is used to specify the background color of the element. <!DOCTYPE html> <html> <head> <style> h2,p{ background-color: red } </head> <body> <h2>My first CSS page.</h2> <p>Hello this is css class. This is an example of CSS backgroundcolor.</p> </body> </html> To center align an element horizontally in CSS syntax is: text-align: center; 22. what is difference between ID and class in CSS? Class ID Selects a group of elements Selects a single element Is written with a period followed by Is written with a hash symbol the class name followed by the ID name Can be used to mark multiple Can only be used to mark a single elements within a page element in a page 23. What does CSS stand for? a) Cascading Style Sheets b) Creative Style Sheets c) Computer Style Sheets d) Compact Style Sheets 24. Which of the following is NOT a valid unit of measurement in CSS? a) px b) em c) % d) mm 25. Which of the following is a valid CSS selector? a) #myDiv b) .myDiv c) div.myDiv d) All of the above 26. Which of the following is used to add space between elements in CSS? a) padding b) margin c) border d) outline 27. Which property is used to align text horizontally in CSS? a) text-align transform b) text-decoration c) text-indent d) text- 28. Which of the following is NOT a valid value for the CSS3 property "display"? a. block b. inline c. flex d. left 29. Which of the following properties is used to apply a background image in CSS3? a) background-color b) background-image c) background-repeat d) background-size 30. Which of the following properties is used to apply rounded corners in CSS3? a) border-radius c)rounded-corners b) corner-radius d) none of the above