2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
id: bad87fee1348bd9aedf08806
|
|
|
|
|
title: Change the Font Size of an Element
|
|
|
|
|
challengeType: 0
|
2019-12-13 13:47:57 +08:00
|
|
|
|
videoUrl: 'https://scrimba.com/c/cPp7VfD'
|
|
|
|
|
forumTopicId: 1
|
2020-01-08 12:40:17 +08:00
|
|
|
|
localeTitle: 更改元素的字体大小
|
2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Description
|
2019-12-13 13:47:57 +08:00
|
|
|
|
<section id='description'>
|
|
|
|
|
字体大小由<code>font-size</code>属性控制,如下所示:
|
|
|
|
|
|
|
|
|
|
```css
|
|
|
|
|
h1 {
|
|
|
|
|
font-size: 30px;
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</section>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
## Instructions
|
2019-12-13 13:47:57 +08:00
|
|
|
|
<section id='instructions'>
|
|
|
|
|
在包含<code>red-text</code>class 选择器的<code><style></code>声明区域的里,创建一个<code>p</code>元素样式规则,并设置<code>font-size</code>为<code>16px</code>。
|
|
|
|
|
</section>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
|
|
```yml
|
|
|
|
|
tests:
|
2019-12-13 13:47:57 +08:00
|
|
|
|
- text: '在<code>style</code>样式声明区域里,<code>p</code>元素的<code>font-size</code>的值应为<code>16px</code>,浏览器和文本缩放应设置为 100%。'
|
2020-01-08 12:40:17 +08:00
|
|
|
|
testString: 'assert(code.match(/p\s*{\s*font-size\s*:\s*16\s*px\s*;\s*}/i));'
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
|
|
<div id='html-seed'>
|
|
|
|
|
|
|
|
|
|
```html
|
|
|
|
|
<style>
|
|
|
|
|
.red-text {
|
|
|
|
|
color: red;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<h2 class="red-text">CatPhotoApp</h2>
|
|
|
|
|
<main>
|
2019-12-13 13:47:57 +08:00
|
|
|
|
<p class="red-text">点击查看更多<a href="#">猫图</a>.</p>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2019-12-13 13:47:57 +08:00
|
|
|
|
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="一只仰卧着的萌猫"></a>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
<div>
|
2019-12-13 13:47:57 +08:00
|
|
|
|
<p>猫咪最喜欢的三件东西:</p>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
<ul>
|
2019-12-13 13:47:57 +08:00
|
|
|
|
<li>猫薄荷</li>
|
|
|
|
|
<li>激光笔</li>
|
|
|
|
|
<li>千层饼</li>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
</ul>
|
2019-12-13 13:47:57 +08:00
|
|
|
|
<p>猫咪最讨厌的三件东西:</p>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
<ol>
|
2019-12-13 13:47:57 +08:00
|
|
|
|
<li>跳蚤</li>
|
|
|
|
|
<li>打雷</li>
|
|
|
|
|
<li>同类</li>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
</ol>
|
|
|
|
|
</div>
|
2019-12-13 13:47:57 +08:00
|
|
|
|
|
2018-10-10 18:03:03 -04:00
|
|
|
|
<form action="/submit-cat-photo">
|
2019-12-13 13:47:57 +08:00
|
|
|
|
<label><input type="radio" name="indoor-outdoor">室内</label>
|
|
|
|
|
<label><input type="radio" name="indoor-outdoor">室外</label><br>
|
|
|
|
|
<label><input type="checkbox" name="personality">忠诚</label>
|
|
|
|
|
<label><input type="checkbox" name="personality">懒惰</label>
|
|
|
|
|
<label><input type="checkbox" name="personality">积极</label><br>
|
|
|
|
|
<input type="text" placeholder="猫咪图片地址" required>
|
|
|
|
|
<button type="submit">提交</button>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
</form>
|
|
|
|
|
</main>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
2019-12-13 13:47:57 +08:00
|
|
|
|
```html
|
2018-10-10 18:03:03 -04:00
|
|
|
|
// solution required
|
|
|
|
|
```
|
|
|
|
|
</section>
|
2019-12-13 13:47:57 +08:00
|
|
|
|
|