cascading style sheet Flashcards

(31 cards)

1
Q

what does css stand for

A

cascading style sheets

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is the main purpose of css

A

to style and layout web pages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

how do you select an html element with the class “menu”

A

.menu

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

which selector targets the element with id =”main”

A

main

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

write a css rule to make all <h1> text blue

A

h1 { color : blue;}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what are the three ways to apply css

A

inline styles, internal document level, external

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is the highest priority style

A

inline style

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

how do you comment in css

A

/* this is comment */

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

write a rule for <p> elements to have italic text

A

p { front-style : italic;}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what property sets a space inside the border of an element

A

padding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

which property sets the background color

A

background - color

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what does the * selector mean in css

A

selects all elements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is the extension for css file

A

.css

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

how do you include an external stylehsheet in html

A

< link rel =”stylesheet” href=”style.css”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what does the font- family property do

A

sets the typeface for the text

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what does #header . menu-item select

A

.menu-item inside an element with id header

17
Q

What is the role of the rel attribute in <link></link> tag for CSS?

A

Defines the relationship, like “stylesheet”.

18
Q
  1. MCQ: Which of the following correctly links an external CSS file to an HTML document?

A) <style>
B) <stylesheet>
C) <link></link>
D) <css></css></stylesheet></style>

19
Q

To select an element with id=”hero” and apply red text color in CSS, you write:

A

hero { color : red;}

20
Q

Write a CSS rule to set the font of all paragraphs to Arial and size 16px.

A

p {
font-family: Arial;
font-size: 16px;
}

21
Q

MCQ: Which CSS property is used to center-align text horizontally inside an element?
A) align-text
B) text-center
C) align
D) text-align

22
Q

ul li.special { color: green; }

A

It selects all <li> elements with class “special” that are inside a <ul>, and sets their text color to green.

23
Q

What does the term “cascading” in CSS mean?

A

It refers to how the browser determines which styles to apply when multiple rules target the same element — based on priority: inline > internal > external > browser default.

24
Q

Consider the following code fragment taken from the body element of an
HTML document.

<h1>Web Technologies</h1>

<p>The following are some <em>key</em> technologies.</p>

<dl>
<dt>CSS</dt>
<dd>Cascading Style Sheets.</dd>
<dt>Javascript</dt>
<dd>A <em>language</em> for scripting web documents.</dd>
</dl>

Write code for a style element containing CSS rules to display the informa
tion in the HTML fragment as follows.
* The text-decoration property of em elements should have a value of
underline.
* The font-weight property of all elements of class important should
have a value of bold.
* The border-style property of the element with an id of “techlist”
should have a value of dotted.
* The word “language” should be rendered with a value of blue for the
background property. The rule you write for this should not affect any
other content

A

<style>

  em {
    text-decoration: underline;
  }

  .important {
    font-weight: bold;
  }

  #techlist {
    border-style: dotted;
  }

  em:contains("language") {
    background: blue;
  }
</style>
25
What is the purpose of using style sheets as part of a web document?
Style sheets (CSS) are used to separate content from presentation, allowing for easier maintenance and updates. They also enable consistent design across multiple web pages, improving efficiency.
26
Explain the role of the selector in a CSS style rule
The selector in a CSS style rule specifies which HTML element(s) the rule will apply to. It targets elements based on their type, class, ID, or other attributes, and determines where the style declarations (such as color, font size, etc.) will be applied in the document.
27
Suppose, in an HTML document, that styles are specified in each of the following ways: in a document-level style; in an external stylesheet; and using an inline style. In which order would styles for a given element of the document be applied by the web browser?
The order in which styles are applied by the web browser is as follows: Inline style: Styles specified directly within an element's style attribute have the highest priority and override other styles. Document-level style: Styles defined within the
31