Files
freeCodeCamp/guide/english/css/layout/inline-block/index.md

32 lines
691 B
Markdown
Raw Normal View History

2018-10-12 15:37:13 -04:00
---
title: Inline Block
---
## Inline Block
inline-block is a possible value of the display property.
2018-10-12 15:37:13 -04:00
Elements marked as _inline-block_ behave like inline elements (_spans_, for example), but can have width and height.
You can add inline-block to navigation so it is displayed horizontally instead of vertically.
2018-10-12 15:37:13 -04:00
HTML:
```html
<ul class="nav">
<li><a href="#">Home</a></li>
<li><a href="#">About Me</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
```
2018-10-12 15:37:13 -04:00
CSS:
2018-10-12 15:37:13 -04:00
```css
.nav li {
display: inline-block;
padding: 20px;
}
```
#### More Information:
[CSS-Tricks - inline-block](https://css-tricks.com/almanac/properties/d/display/#inline-block)