2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
id: 587d781b367417b2b2512abd
|
2021-12-18 20:00:08 +05:30
|
|
|
title: 调整标题元素与段落元素的大小
|
2018-10-10 18:03:03 -04:00
|
|
|
challengeType: 0
|
2020-02-11 15:46:34 +08:00
|
|
|
videoUrl: 'https://scrimba.com/c/c3bRPTz'
|
|
|
|
forumTopicId: 301037
|
2021-10-25 19:17:54 +04:00
|
|
|
dashedName: adjust-the-size-of-a-heading-element-versus-a-paragraph-element
|
2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
# --description--
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2021-12-18 20:00:08 +05:30
|
|
|
标题元素(`h1` 到 `h6`)的字体大小通常应大于段落标签的字体大小。 这使用户更容易直观地了解页面上所有内容的布局和重要性级别。 你可以使用 `font-size` 属性来调整元素中文本的大小。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
# --instructions--
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2021-12-18 20:00:08 +05:30
|
|
|
要使标题明显大于段落,请将 `h4` 元素的 `font-size` 更改为 27 像素。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
# --hints--
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2021-12-18 20:00:08 +05:30
|
|
|
你的代码应该将 `font-size` 属性添加到设置为 27 像素的 `h4` 元素。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
```js
|
|
|
|
assert($('h4').css('font-size') == '27px');
|
2018-10-10 18:03:03 -04:00
|
|
|
```
|
|
|
|
|
2021-01-13 03:31:00 +01:00
|
|
|
# --seed--
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
```html
|
|
|
|
<style>
|
|
|
|
h4 {
|
|
|
|
text-align: center;
|
|
|
|
background-color: rgba(45, 45, 45, 0.1);
|
|
|
|
padding: 10px;
|
|
|
|
|
|
|
|
}
|
|
|
|
p {
|
|
|
|
text-align: justify;
|
|
|
|
}
|
|
|
|
.links {
|
|
|
|
text-align: left;
|
|
|
|
color: black;
|
|
|
|
}
|
|
|
|
.fullCard {
|
|
|
|
width: 245px;
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
border-radius: 5px;
|
|
|
|
margin: 10px 5px;
|
|
|
|
padding: 4px;
|
|
|
|
}
|
|
|
|
.cardContent {
|
|
|
|
padding: 10px;
|
|
|
|
}
|
|
|
|
.cardText {
|
|
|
|
margin-bottom: 30px;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<div class="fullCard">
|
|
|
|
<div class="cardContent">
|
|
|
|
<div class="cardText">
|
|
|
|
<h4>Alphabet</h4>
|
|
|
|
<hr>
|
|
|
|
<p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p>
|
|
|
|
</div>
|
|
|
|
<div class="cardLinks">
|
|
|
|
<a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
|
|
|
|
<a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
```
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
# --solutions--
|
2020-02-11 15:46:34 +08:00
|
|
|
|
2021-01-13 03:31:00 +01:00
|
|
|
```html
|
|
|
|
<style>
|
|
|
|
h4 {
|
|
|
|
text-align: center;
|
|
|
|
background-color: rgba(45, 45, 45, 0.1);
|
|
|
|
padding: 10px;
|
|
|
|
font-size: 27px;
|
|
|
|
}
|
|
|
|
p {
|
|
|
|
text-align: justify;
|
|
|
|
}
|
|
|
|
.links {
|
|
|
|
text-align: left;
|
|
|
|
color: black;
|
|
|
|
}
|
|
|
|
.fullCard {
|
|
|
|
width: 245px;
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
border-radius: 5px;
|
|
|
|
margin: 10px 5px;
|
|
|
|
padding: 4px;
|
|
|
|
}
|
|
|
|
.cardContent {
|
|
|
|
padding: 10px;
|
|
|
|
}
|
|
|
|
.cardText {
|
|
|
|
margin-bottom: 30px;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<div class="fullCard">
|
|
|
|
<div class="cardContent">
|
|
|
|
<div class="cardText">
|
|
|
|
<h4>Alphabet</h4>
|
|
|
|
<hr>
|
|
|
|
<p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p>
|
|
|
|
</div>
|
|
|
|
<div class="cardLinks">
|
|
|
|
<a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br>
|
|
|
|
<a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
```
|
2021-12-18 20:00:08 +05:30
|
|
|
|