1.2 KiB
1.2 KiB
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
587d78a3367417b2b2512ad0 | Center an Element Horizontally Using the margin Property | 0 | 使用margin属性水平居中元素 |
Description
margin
设置为auto值。此方法也适用于图像。默认情况下,图像是内联元素,但在将display
属性设置为block时可以更改为块元素。 Instructions
div
通过添加在页面上margin
属性与汽车的价值。 Tests
tests:
- text: <code>div</code>应该有一个设置为auto的<code>margin</code> 。
testString: 'assert(code.match(/margin:\s*?auto;/g), "The <code>div</code> should have a <code>margin</code> set to auto.");'
Challenge Seed
<style>
div {
background-color: blue;
height: 100px;
width: 100px;
}
</style>
<div></div>
Solution
// solution required