Oliver Eyton-Williams ee1e8abd87
feat(curriculum): restore seed + solution to Chinese (#40683)
* feat(tools): add seed/solution restore script

* chore(curriculum): remove empty sections' markers

* chore(curriculum): add seed + solution to Chinese

* chore: remove old formatter

* fix: update getChallenges

parse translated challenges separately, without reference to the source

* chore(curriculum): add dashedName to English

* chore(curriculum): add dashedName to Chinese

* refactor: remove unused challenge property 'name'

* fix: relax dashedName requirement

* fix: stray tag

Remove stray `pre` tag from challenge file.

Signed-off-by: nhcarrigan <nhcarrigan@gmail.com>

Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
2021-01-12 19:31:00 -07:00

2.4 KiB
Raw Blame History

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
587d781e367417b2b2512ac9 更改元素的相对位置 0 https://scrimba.com/c/czVmMtZ 301044 change-an-elements-relative-position

--description--

在 CSS 里一切 HTML 元素皆为盒子,也就是通常所说的盒模型。块级元素自动从新的一行开始(比如标题、段落以及 div行内元素排列在上一个元素后比如图片以及 span。元素默认按照这种方式布局称为文档的普通流,同时 CSS 提供了 position 属性来覆盖它。

当元素的 position 设置为 relative 时,它允许你通过 CSS 指定该元素在当前普通流页面下的相对偏移量。CSS 里控制各个方向偏移量的属性是 leftrighttopbottom。它们代表从原来位置向远离该方向偏移指定的像素、百分比或者 em。下面的例子展示了段落向上偏移 10 像素:

p {
  position: relative;
  bottom: 10px;
}

把元素的 position 设置成 relative 并不会改变该元素在普通流布局所占的位置,也不会对其它元素的位置产生影响。 **注意:**定位可以让你在页面布局上更灵活、高效。注意不管元素的定位是怎样,内部的 HTML 代码阅读起来应该是整洁、有意义的。这样也可以让视障人员(他们重度依赖辅助设备比如屏幕阅读软件)也能够无障碍地浏览你的网页。

--instructions--

h2position 属性值设置成 relative,使用相应的 CSS 属性调整 h2 的位置,使其相对原本的位置向下偏移 15 像素。注意不要对 h1 和 p 元素的位置产生影响。

--hints--

h2 元素应该添加 position 属性,其属性值应为 relative

assert($('h2').css('position') == 'relative');

你应该使用 CSS 属性调整 h2 的位置使其从原来的位置向下偏移 15px

assert($('h2').css('top') == '15px');

--seed--

--seed-contents--

<style>
  h2 {


  }
</style>
<body>
  <h1>On Being Well-Positioned</h1>
  <h2>Move me!</h2>
  <p>I still think the h2 is where it normally sits.</p>
</body>

--solutions--

<style>
  h2 {
    position: relative;
    top: 15px;
  }
</style>
<body>
  <h1>On Being Well-Positioned</h1>
  <h2>Move me!</h2>
  <p>I still think the h2 is where it normally sits.</p>
</body>