1.
What does CSS stand for?
Correct Answer
B. Cascading Style Sheets
Explanation
CSS stands for Cascading Style Sheets. This is a stylesheet language used to describe the presentation of a document written in HTML or XML. It is responsible for the visual appearance of web pages, including layout, colors, fonts, and other design elements. The term "cascading" refers to the way styles are applied to different elements, with the ability to inherit and override styles from multiple sources. This allows for consistent and efficient styling across a website or web application.
2.
To define the space between the element's border and content, you use the padding property, but are you allowed to use negative values?
Correct Answer
A. Yes
Explanation
Yes, you are allowed to use negative values for the padding property. Using negative padding values will cause the content to extend beyond the element's borders, effectively overlapping other elements. This can be useful in certain scenarios, such as when you want to create a visual effect or adjust the positioning of elements. However, it is generally recommended to use positive padding values for better readability and maintainability of the code.
3.
Where in an HTML document is the correct place to refer to an external style sheet?
Correct Answer
D. In the section
Explanation
The correct place to refer to an external style sheet in an HTML document is in the section. This is where the document's metadata and other important information, such as the title and character encoding, is typically placed. Including the link to the external style sheet in the section ensures that the styles are loaded and applied before the content of the document is rendered, resulting in a more consistent and visually appealing presentation of the webpage.
4.
Which HTML tag is used to define an internal style sheet?
Correct Answer
A. Style
Explanation
The HTML tag used to define an internal style sheet is the "style" tag. This tag is placed within the head section of an HTML document and is used to define CSS rules that will be applied to the elements within the document. By using the "style" tag, developers can easily apply styles to multiple elements without the need for an external CSS file.
5.
Which HTML attribute is used to define inline styles?
Correct Answer
C. Font
Explanation
The correct answer is "font". The font attribute in HTML is used to define inline styles. It allows you to specify the font size, color, and other font-related properties for a specific element within the HTML code. By using the font attribute, you can apply inline styles directly to an element without the need for external CSS or style sheets.
6.
Which is the correct CSS syntax?
Correct Answer
A. {body:color=black(body}
Explanation
The correct CSS syntax is "body {color: black}". In CSS, selectors are used to target specific elements on a webpage, and in this case, the selector "body" is used to target the body element. The curly brackets {} are used to enclose the declaration block, and within the declaration block, the property "color" is set to the value "black". This syntax correctly applies the CSS style of setting the text color of the body element to black.
7.
How do you insert a comment in a CSS file?
Correct Answer
B. /*this is a comment*/
/*this is a comment*/
Explanation
To insert a comment in a CSS file, you can use the syntax /* this is a comment */. This allows you to add notes or explanations within the CSS code that will not be interpreted by the browser.
8.
Which property is used to change the background color?
Correct Answer
C. Background-color:
Explanation
The correct answer is "background-color:". This property is used to change the background color of an element on a webpage. It allows you to specify a color value, such as a color name, hexadecimal code, or RGB value, to be used as the background color for the selected element. By using the "background-color:" property, you can easily customize the appearance of the background of an element to match your desired design or style.
9.
How do you add a background color for all
elements?
Correct Answer
C. H1 {background-color:#FFFFFF}
Explanation
The correct answer is h1 {background-color:#FFFFFF}. This CSS rule targets all h1 elements and sets their background color to white (#FFFFFF).
10.
How do you change the text color of an element?
Correct Answer
B. Fgcolor:
Explanation
The correct answer is "fgcolor:". In CSS, the "color" property is used to change the text color of an element. The "fgcolor:" option is not a valid CSS property.
11.
Which CSS property controls the text size?
Correct Answer
C. Front-size
Explanation
The correct answer is "font-size". This CSS property is used to control the size of the text displayed on a webpage. It allows the web developer to specify the size of the font in pixels, ems, or other units of measurement. By adjusting the font-size property, the text can be made larger or smaller to enhance readability or achieve a desired aesthetic effect.
12.
What is the correct CSS syntax for making all the
elements bold?
Correct Answer
D. P {font-weight:bold}
Explanation
The correct CSS syntax for making all the elements bold is "p {font-weight:bold}". In CSS, the "font-weight" property is used to specify the weight or thickness of the font. The value "bold" makes the text bold. Therefore, applying this style to the elements will make the text inside them appear bold.
13.
How do you display hyperlinks without an underline?
Correct Answer
D.
a {text-decoration:no underline}
Explanation
The correct answer is "a {text-decoration:none}". This CSS code is used to remove the underline from hyperlinks. The "text-decoration" property is used to control the decoration of text, and setting it to "none" removes any underline that is applied to the hyperlink.
14.
How do you display a border like this:
The top border = 10 pixels
The bottom border = 5 pixels
The left border = 20 pixels
The right border = 1pixel?
Correct Answer
A. Border-width:10px 20px 5px 1px
Explanation
The CSS property "border-width" is used to set the width of the border. The values are specified in clockwise order starting from the top border and going around to the right, bottom, and left borders. In this case, the top border is set to 10 pixels, the right border is set to 20 pixels, the bottom border is set to 5 pixels, and the left border is set to 1 pixel.
15.
How do you make a list that lists its items with squares?
Correct Answer
D. Type:square
Explanation
To make a list that lists its items with squares, you can use the CSS property "list-style-type: square". This property sets the marker for each list item to be a square shape. By applying this style to the list, each item will be displayed with a square marker.