Guest User

Untitled

a guest
Mar 21st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.84 KB | None | 0 0
  1. Part I: HTML
  2. 1. What is a block element and how does it flow on the screen?
  3. A block element is a 2-dimensional element that flows vertically on the screen. Blocks use up the full available width and always start on a new line.
  4.  
  5. 2. What is an inline element and how does it flow on the screen?
  6. An inline element is a 1-dimensional element that flows horizontally and wraps when its content fills the available width. Inline elements flow left to right and are not effected by width and height properties. Their width and height are determined by their content. Also vertical margin properties have no effect on inline elements whereas horizontal margins do.
  7.  
  8. 3. What box model properties are unavailable for inline elements?
  9. Width, height, margin-top, margin-bottom
  10.  
  11. 4. List 3 inline elements that are most commonly used?
  12. a, img, span
  13.  
  14. 5. What are semantic tags and why use them?
  15. Tags that describe their purpose or content. Proper HTML coding (semantic coding) is using HTML5 tags that describe the structure of the page and HTML4 tags that property describe their content.
  16.  
  17. 6. What are 2 grouping tags (one inline, one block)
  18. inline: span, block: div
  19.  
  20. 7. Write the HTML5 tags we use to structure a page, in the order you might use them?
  21. header, main, section, article, aside, footer
  22.  
  23. 8. What is the difference between a tag and an element?
  24. An element consists of opening and closing tags and potentially any content contained within whereas a tag is just the portion of the HTML inside the angle brackets
  25.  
  26. 9. What is the box model (Explain it)?
  27. The box model defines how elements are sized, bordered, and spaced internally and externally. An element's total width, for example, is it's content width (width property) plus it's right and left padding plus its right and left border. Margin is the space between elements and padding is the inside space of an element between the element's border and it's content.
  28.  
  29. 10. How does the box-sizing: border-box; rule modify the box model?
  30. box-sizing: border-box; re-defines the width and height properties to include padding and border. Thereby, increasing the padding or border takes space away from the content.
  31.  
  32. 12. On form tags such as input, what attribute links a label to the form element?
  33. The for="value" attribute in the label element is linked to the "id="value" attribute on the form field tag such as an input tag, as long as both values match.
  34.  
  35. 13. Are input, button and textarea block or inline tags?
  36. They are inline tags
  37.  
  38. 14. What is the viewport meta tag used for?
  39. The viewport meta tag tells the browser that the website is responsive and at what size to initially display the site.
  40.  
  41. Part II: CSS
  42. 13. How do you separate multiple CSS selectors in the same rule set?
  43. With a comma
  44.  
  45. 14. In the following selector, what does the space mean between the tag names?
  46. section p { property: value; }
  47. The space means "inside of" or "descendant of" (reading right to left). Eg, all p tags that are inside of (or descendants of) section tags
  48.  
  49. 15. How do you select the 2nd paragraph tag in CSS without modifying the HTML:
  50. <main>
  51. <h1>Welcome</h1>
  52. <p>Hi</p>
  53. <p>Hello</p>
  54. <p>Hey</p>
  55. </main>
  56.  
  57. p:nth-of-type(2) { ... }
  58.  
  59. 16. Write the CSS to show the menu items only when hovering over the nav
  60. <nav>
  61. <h2>MENU</h2>
  62. <ul>
  63. <li><a href="#">Home</a></li>
  64. <li><a href="#">About</a></li>
  65. <li><a href="#">Contact</a></li>
  66. </ul>
  67. </nav>
  68.  
  69. nav li { display: none; }
  70. nav:hover li { display: block; }
  71.  
  72. 17. Which category of CSS properties are all inherited?
  73. Font and text properties
  74.  
  75. 18. What do the units vw and vh mean?
  76. Viewport widths and viewport heights (on a scale of 100). 1 vw is 1% of the available viewport width for example.
  77.  
  78. 19. How do you set a top-margin to 2% of a site's width?
  79. margin-top: 2vw;
  80.  
  81. 20. What are the 2 methods we've used to make block elements flow horizontally; what are the side effects of each method?
  82. a) display: inline-block
  83. - extra spacing between elements treated as characters can be removed by setting the font-size to 0 on the parent
  84. b) float: left or right
  85. - Unfloated sibling that follows must be cleared to the corresponding left or right (or both)
  86. - Parent elements require clearfix to assume the height of their children (to avoid height collapse)
  87.  
  88. 21. What are collapsing margins and how do you address them?
  89. Collapsing margins occur most commonly when:
  90. a) a bottom margin of an element is followed by a top margin of a sibling.
  91. - In this case, the total margin between the elements is the max of the two margins instead of the sum
  92. - This can be corrected by floating the elements
  93. b) a first child element has margin-top inside it's parent, and the margin is placed outside the parent instead
  94. - This can be corrected by placing any upper "barrier" such as padding-top or border-top on the parent
  95.  
  96. 22. Write the CSS property: value to make an inline element flow vertically?
  97. display: block;
  98.  
  99. 23. Write the CSS property: value to horizontally center a fixed-width block element inside a parent?
  100. margin: 0 auto;
  101.  
  102. 24. Write the CSS property: value to vertically center a this text if the section tag's height is 100px:
  103. <section>Hello</section>
  104.  
  105. line-height: 100px;
  106.  
  107. 25. In which HTML tag rule set is it good practice to place all font/text default properties in CSS and why?
  108. body
  109.  
  110. 26. For floated elements inside a parent, how do we fix the parent's height from
  111. collapsing? State the answer and write the CSS.
  112. clearfix applied directly to the element's selector or a class that is added to the element:
  113. ::after {
  114. content: "";
  115. clear: both;
  116. display: table;
  117. }
  118.  
  119. 27. What CSS property: value; is used to stop a unfloated element from sliding
  120. up and behind it's floated, previous sibling?
  121. clear: left, right or both;
  122.  
  123. 28. position: relative positions an element is relative to what?
  124. It's static position
  125.  
  126. 29. For non-static positioning, what additional properties are required?
  127. At least one vertical and one horizontal property
  128. top, bottom and left, right
  129.  
  130. 30. The position (eg, properties top, bottom, left or right) of absolute-positioned elements are in reference to what?
  131. The first non-static ancestor
  132.  
  133. 31. What do each of these selectors mean? (state what is selected for each)
  134. article>p /* all p tags that are immediate children of article tags */
  135. nav li:nth-child(2):hover /* the 2nd li, when hovered, inside a nav tag */
  136. p::after (and what property is the partner to this selector) /* content: url(); or content: "string"; */
  137. p+img /* all image tags that immediately follow (sibling) p tags */
  138. input[type="radio"] /* all input tags with the attribute type="radio" (eg, all radio buttons) */
  139.  
  140. 32. How do you set default styles in a website so the box model values are predictable for all elements across multiple browsers?
  141. Use a reset such as normalize.css or Eric Meyer's reset.
  142.  
  143. 33. How do you use google fonts and from which file to you access them (HTML or CSS)?
  144. Use the @import rule to embed them in the CSS file so that all style information remains in the CSS file
Add Comment
Please, Sign In to add comment