Question: 1
Which of the following CSS rules will select the HTML element with the id logo and set the font size for that element to 60 pixels?
XIncorrect
logo {
O
font-size: 60px;
}
O
.logo {
font-size: 60px;
}
logo {
font-size: 60px;
}
id="logo" {
O
font-size: 60px;
}
Answered
Close! ID names are denoted with a hashtag before the name of the ID, Instead of a period.
14 15
1.6 1.7
1.8 1.9 1.10 1.11 1.12
Search
hulu
1.13 1.14



Answer :

To create a CSS rule that will select an HTML element with a specific `id` and set its font size, you use the `#` symbol (hashtag) followed by the `id` name. Here's a detailed, step-by-step explanation:

1. Identify the HTML `id` Selector: In CSS, an `id` is selected using a `#` symbol before the id name. An `id` selector is unique within a page, so it should only be used to select one unique element.

2. CSS Syntax for `id` Selector: The correct syntax to apply a rule to an element with a specific `id` looks like:
```css
#id_name {
/ CSS properties /
}
```
In our case, `id_name` would be `logo`.

3. Setting the Font Size Property: To set the font size of an element, use the `font-size` property followed by the desired size in pixels.

Putting it all together:
```css
#logo {
font-size: 60px;
}
```

This CSS rule will select any HTML element that has the `id` of `logo` and set its font size to 60 pixels.

### Explanation of Choices:

1. `logo { font-size: 60px; }`:
- Incorrect. This targets an HTML element named ``, not an element with an id of `logo`.

2. `.logo { font-size: 60px; }`:
- Incorrect. This targets HTML elements with a class name of `logo`, not an id.

3. `logo { font-size: 60px; }`:
- Incorrect. Redundantly incorrect as described in option 1.

4. `id="logo" { font-size: 60px; }`:
- Incorrect. This is not valid CSS syntax. It appears to be a mix of HTML and CSS.

The correct answer is:
```css
#logo {
font-size: 60px;
}
```

Other Questions