freeCodeCamp/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-visual-balance-using...

2.4 KiB
Raw Blame History

id title challengeType videoUrl localeTitle
587d7791367417b2b2512ab3 Create Visual Balance Using the text-align Property 0 使用text-align属性创建视觉平衡

Description

本课程的这一部分侧重于应用视觉设计。第一组挑战建立在给定的卡布局上以显示许多核心原则。文本通常是Web内容的很大一部分。 CSS有几个选项可以将它与text-align属性text-aligntext-align: justify;导致除最后一行之外的所有文本行都与行框的左右边缘相交。 text-align: center;文本text-align: right;右对齐文本和text-align: left; (默认值)左对齐文本。

Instructions

h4标签的文本称为“Google”与中心对齐。然后证明段落标记是合理的其中包含有关Google如何成立的信息。

Tests

tests:
  - text: 您的代码应使用<code>h4</code>标记上的text-align属性将其设置为居中。
    testString: 'assert($("h4").css("text-align") == "center", "Your code should use the text-align property on the <code>h4</code> tag to set it to center.");'
  - text: 您的代码应使用<code>p</code>标记上的text-align属性将其设置为对齐。
    testString: 'assert($("p").css("text-align") == "justify", "Your code should use the text-align property on the <code>p</code> tag to set it to justify.");'

Challenge Seed

<style>
  h4 {

  }
  p {

  }
  .links {
    margin-right: 20px;

  }
  .fullCard {
    border: 1px solid #ccc;
    border-radius: 5px;
    margin: 10px 5px;
    padding: 4px;
  }
  .cardContent {
    padding: 10px;
  }
</style>
<div class="fullCard">
  <div class="cardContent">
    <div class="cardText">
      <h4>Google</h4>
      <p>Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University.</p>
    </div>
    <div class="cardLinks">
      <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a>
      <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
    </div>
  </div>
</div>

Solution

// solution required