Css Basics Quizs Question and Answer

Q 1. What is CSS?
A. CSS is a style sheet language
B. CSS is designed to separate the presentation and content, including layout, colors, and fonts
C. CSS is the language used to style the HTML documents
D. All of the mentioned

Show Answer Answer:-D. All of the mentioned
Explanation CSS is a style sheet language that stands for Cascading Style Sheet and is used to style HTML documents. CSS is mainly designed to separate the presentation and content, including layout, colors, and fonts.

Q 2. Which of the following tag is used to embed css in html page?
A. <css>
B. <!DOCTYPE html>
C. <script>
D. <style>

Show Answer Answer:-D. tag is used to embed CSS in HTML page, while is used to embed JS in HTML. is HTML5 declaration.

Q 3. Which of the following CSS selectors are used to specify a group of elements?
A. tag
B. id
C. class
D. both class and tag

Show Answer Answer:-C. class
Explanation Class selectors are used to specify a group of elements. Id selector specifies a particular unique element.

Q 4. Which of the following has introduced text, list, box, margin, border, color, and background properties?
A. HTML
B. PHP
C. CSS
D. Ajax

Show Answer Answer:-C. CSS
Explanation CSS is a style sheet language that stands for Cascading Style Sheet. CSS has introduced text, list, box, margin, border, color, and background properties.

Q 5. Which of the following CSS framework is used to create a responsive design?
A. django
B. rails
C. larawell
D. bootstrap

Show Answer Answer:-D. bootstrap
Explanation Explanation: Bootstrap is a free and open-source collection of tools for creating websites and web applications. It contains HTML- and CSS-based design templates for typography, forms, buttons, navigation and other interface components, as well as optional JavaScript extensions. It aims to ease the development of dynamic websites and web applications.

Q 6. Which of the following CSS selector is used to specify a rule to bind a particular unique element?
A. tag
B. id
C. class
D. both class and tag

Show Answer Answer:-B. id
Explanation Explanation: For binding a particular unique element, id selectors are used. While for a group of elements, class selector can be used.

Q 7. Which of the following type of HTML tag is used to define an internal style sheet?
A. <script>
B. <link>
C. <class>
D. <style>

Show Answer Answer:-D.

Q8. Which of the following CSS property is used to make the text bold?
A. text-decoration: bold
B. font-weight: bold
C. font-style: bold
D. text-align: bold

Show Answer Answer:-B. font-weight: bold
Explanation The font-weight property is used for setting the thickness and boldness of the font. It is used to define the weight of the text. The available weight depends on the font-family, which is used by the browser.

Q 9. What will be the output of following CSS code snippet? h1 {color: “green”;}

A. nothings happen
B. error occurs
C. heading becomes dark-green
D. heading becomes green

Show Answer Answer:-A. nothings happen
Explanation Output of the above code snippet won’t happen as the declaration syntax is wrong. The correct declaration is : h1 { color: green; } which will yield an output. In CSS, we don’t write the value in double quotes.

Q 10. Which of the following CSS style property is used to specify an italic text?
A. style
B. font
C. font-style
D. @font-face

Show Answer Answer:-C. font-style
Explanation Explanation: font-style property is used to specify an italic text. font-style property has three values (normal, italic & oblique).

Q 11. What will be the output of following CSS code snippet?h1 {color: red text-decoration: underline; font-style: italic;}

A. color: red, text-decoration: underline works
B. only font-style: italic works
C. color: red, text-decoration: underline and font-style: italic all works
D. text-decoration: underline and font-style: italic works

Show Answer Answer:-B. only font-style: italic works
Explanation Explanation: In this case, we should see the browser continue to parse the value of color as “red text-decoration: underline” before it sees a closing semicolon. The font-style property that follows would then be used. Because the color property has an illegal value, it should be ignored.

Q 12. Which of the following are the CSS Extension Prefixes for Webkit?
A. -chrome
B. -web
C. -o-
D. -webkit

Show Answer Answer:-D. -webkit
Explanation Browser sometimes adds prefixes to non-standard CSS properties. CSS Extension prefix for Webkit is -webkit which is supported by almost all ios browsers. -o is used by opera where as -moz is used by firefox browser.

Q 13. Which of the following is the correct syntax to link an external style sheet in the HTML file?
A. <link rel=”stylesheet” href=”style.css” />
B. <link rel=”stylesheet” src=”style.css” />
C. <style rel=”stylesheet” src=”style.css” />
D. <style rel=”stylesheet” link=”style.css” />

Show Answer Answer:-A.
Explanation HTML file must contain a reference to the external style sheet file. External style sheet files are defined within the element and it should be inside the section. href attribute specifies the URL of the linked resource.

Q 14. Which of the following is the first CSS specification to become an official W3C Recommendation?
A. CSS level 2
B. (X)HTML CSS
C. CSS level 1
D. CSS level 2.1

Show Answer Answer:-C. CSS level 1
Explanation The first CSS specification to become an official W3C Recommendation is CSS level 1, published on December 17, 1996. Håkon Wium Lie and Bert Bos are credited as the original developers.

Q 15. Which of the following function defines a linear gradient as a CSS image?
A. gradient()
B. linear-gradient()
C. grayscale()
D. image()

Show Answer Answer:-B. linear-gradient()
Explanation Explanation: linear-gradient() function defines a linear gradient as a CSS image. Creating a linear gradient function we should define minimum of two color stops. color stops will tell the browser which colors to use in the gradients for smooth transitions.

Q 16. Which of the following CSS property can be used to set the image as a border instead of the border style?
A. background-image-source
B. background-image
C. border-image-source
D. border-image

Show Answer Answer:-C. border-image-source
Explanation The border-image-source property specifies the path to the image to be used as a border (instead of the normal border around an element).

Q 17. Which of the following CSS property defines the different properties of all four sides of an element’s border in a single declaration?
A. border-collapse
B. border-width
C. padding
D. border

Show Answer Answer:-B. border-width
Explanation The border-width property sets the width of an element’s four borders. This property can have from one to four values.

Q 18. Which of the following is the correct way to apply CSS Styles?
A. in an external CSS file
B. inside an HTML element
C. inside the <head> section of an HTML page
D. all of the mentioned

Show Answer Answer:-D. all of the mentioned
Explanation Explanation: We can style the document using CSS in three different ways i.e embed, inline and external. An inline CSS means applying styles rules directly to the HTML element. In embed, we declare or write all the needed style in tag in the head section of the HTML document. We can create an external style sheet and provide its link to the document.

Q 19. Which of the following CSS property sets the font size of text?
A. font-size
B. text-size
C. text
D. size

Show Answer Answer:-A. font-size
Explanation CSS Syntax:font-size: length | percentage | larger | smaller | xx-small | x-small | small | medium | large | x-large | xx-larger | inherit

Q 20. Which of the following is not the property of the CSS box model?
A. margin
B. color
C. width
D. height

Show Answer Answer:-B. color
Explanation Explanation: CSS box model include height, width, padding, margin and border. All text-fields have complete support for every property related to CSS box model. Browser relies on system default styles when displaying these widgets.

Q 21. Which of the following CSS property sets what kind of line decorations are added to an element, such as underlines, overlines, etc?
A. text-decoration
B. text-style
C. text-decoration-line
D. text-line

Show Answer Answer:-C. text-decoration-line
Explanation The text-decoration-line property defines the type of line decorations that are added to an element, such as underlines, overlines, etc.

Q 22. Which of the following CSS property specifies the look and design of an outline?
A. outline-style
B. outline-format
C. outline-font
D. none of the mentioned

Show Answer Answer:-A. outline-style
Explanation Explanation: The outline-style CSS property is used to set the style of the outline of an element. An outline is a line that is drawn around elements, outside the border edge, to make the element stand out.

Q 23. What will be the output of the following CSS code snippet?span { border: 1px solid red; outline: green dotted thick; }

A. All span elements will have a green thick border and a red outline
B. All span elements will have a red border and a green dotted outline
C. All span elements will have a outer green dotted border and an inner red border
D. All span elements will have an outer red border and inner green dotted border

Show Answer Answer:-C. All span elements will have a outer green dotted border and an inner red border
Explanation The border property creates the inner border, while the outline sets the outer border.

Q 24. Which of the following CSS property sets the shadow for a box element?
A. set-shadow
B. box-shadow
C. shadow
D. canvas-shadow

Show Answer Answer:-B. box-shadow
Explanation box-shadow property sets the shadow for a box element. CSS Syntax:box-shadow: none | inherit

Q 25. Which of the following CSS property is used to set the color of the text?
A. text-decoration
B. pallet
C. colour
D. color

Show Answer Answer:- D. color
Explanation The color property is used to set the color of the text. In CSS, colors can also be specified using RGB values, RGBA values, HSL values, HEX values, etc.

Q 26. Which of the following CSS Property controls how an element is positioned?
A. static
B. position
C. fix
D. set

Show Answer Answer:-B. position
Explanation Position property controls how an element is positioned. When set to absolute or fixed, the element is removed completely from the normal flow of the document. When set to relative, the element is moved relative to its position in the normal flow, but a space is left where it would normally have been. The default value, static, means the element remains in the normal flow and is not positioned.

Q 27. Which of the following CSS selector selects the elements that are checked?
A. :checked
B. E ~ F
C. ::after
D. none of the mentioned

Show Answer Answer:-A. :checked
Explanation checked selector selects the elements that are checked.Example: :checked {color: blue;}

Q 28. Which of the following is an appropriate value for the overflow element?
A. scroll
B. hidden
C. auto
D. all of the mentioned

Show Answer Answer:-D. all of the mentioned
Explanation Overflow of a div or a container can have the following values:visible|hidden|scroll|auto|initial|inherit

Q 29. Which of the following CSS property is used to specify table borders in CSS?
A. table:border
B. table
C. border
D. none of the mentioned

Show Answer Answer:-C. border
Explanation In CSS, border property is used to specify table borders. Example:table{border: 7px solid black;}

Q 30. Which of the following property is used to align the text in a table?
A. text-align
B. align
C. text
D. none of the mentioned

Show Answer Answer:-A. text-align
Explanation Explanation: In CSS, text-align property is used to align the text in a table. Example:table{text-align: left;}

Q 31. Which of the following CSS Property sets the stacking order of positioned elements?
A. y-index
B. z-index
C. x-index
D. all of the mentioned

Show Answer Answer:-B. z-index
Explanation Explanation: z-index property sets the stacking order of positioned elements. Syntax:z-index: auto|number|initial|inherit;

Q 32. What will be the output of the following CSS code?div { border-width:5px; border-style:dotted solid double dashed; }

A. Box having dotted bottom outline, solid right outline, double top outline and dashed left outline
B. Box having dotted bottom outline, solid left outline, double top outline and dashed left outline
C. Box having dotted top outline, solid right outline, double bottom outline and dashed left outline
D. Box having dotted top outline, solid left outline, double bottom outline and dashed right outline

Show Answer Answer:-C. Box having dotted top outline, solid right outline, double bottom outline and dashed left outline
Explanation The shorthand run in clockwise direction.

Q 33. Which of the following property allows a marquee to be used in the case of a text-overflow?
A. overflow-marquee
B. overflow-style
C. overflow-text
D. none of the mentioned

Show Answer Answer:-B. overflow-style
Explanation overflow-style is a CSS property that allows a marquee to be used in the case of a text-overflow. Syntax:overflow-style: auto | marquee-block

Q 34. Which of the following CSS property defines the space between cells in a table?
A. border-spacing
B. border-style
C. border
D. none of the mentioned

Show Answer Answer:-A. border-spacing
Explanation border-spacing property defines the space between cells in a table. Syntax:border-spacing: non-negative length(s) | inherit

Q 35. Which of the following CSS3 property can be used to allow line breaks within words?
A. line-break
B. line-wrap
C. word-wrap
D. word-break

Show Answer Answer:-D. word-break
Explanation Explanation: word-break property can be used to allow line breaks within the words. Syntax:word-break: break-all | keep-all | normal

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You cannot copy content of this page