* chore(learn): audit files for crowdin Audits the challenge text in the Responsive Web Design superblock to account for words/phrases that should not be translated because they refer to code. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> * fix: remove quotes from code Removes instances of quoted code blocks, or code blocked quotes. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> * fix: additional uncaught quote-codes Thanks Oliver :) Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> * fix: so many quotes Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> * fix: missing punctuation Noted in a Crowdin comment. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> * fix: remove more quotes Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
57 lines
1.1 KiB
Markdown
57 lines
1.1 KiB
Markdown
---
|
|
id: 587d78a3367417b2b2512ad0
|
|
title: Center an Element Horizontally Using the margin Property
|
|
challengeType: 0
|
|
videoUrl: 'https://scrimba.com/c/cyLJqU4'
|
|
forumTopicId: 301043
|
|
dashedName: center-an-element-horizontally-using-the-margin-property
|
|
---
|
|
|
|
# --description--
|
|
|
|
Another positioning technique is to center a block element horizontally. One way to do this is to set its `margin` to a value of auto.
|
|
|
|
This method works for images, too. Images are inline elements by default, but can be changed to block elements when you set the `display` property to `block`.
|
|
|
|
# --instructions--
|
|
|
|
Center the `div` on the page by adding a `margin` property with a value of `auto`.
|
|
|
|
# --hints--
|
|
|
|
The `div` should have a `margin` set to `auto`.
|
|
|
|
```js
|
|
assert(code.match(/margin:\s*?auto;/g));
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```html
|
|
<style>
|
|
div {
|
|
background-color: blue;
|
|
height: 100px;
|
|
width: 100px;
|
|
|
|
}
|
|
</style>
|
|
<div></div>
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```html
|
|
<style>
|
|
div {
|
|
background-color: blue;
|
|
height: 100px;
|
|
width: 100px;
|
|
margin: auto;
|
|
}
|
|
</style>
|
|
<div></div>
|
|
```
|