1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-08-10 08:04:42 +02:00
Files
csslayout/contents/initial-avatar.mdx
2023-09-01 07:43:57 +07:00

66 lines
1.0 KiB
Plaintext

---
category: Display
created: '2019-12-04'
description: Create an initial avatar with CSS
keywords: css avatar
thumbnail: /assets/css-layout/thumbnails/initial-avatar.png
title: Initial avatar
---
## HTML
```html index.html
<div class="initial-avatar">...</div>
```
## CSS
```css styles.css
.initial-avatar {
/* Center the content */
align-items: center;
display: flex;
justify-content: center;
/* Colors */
background-color: #d1d5db;
color: #fff;
/* Rounded border */
border-radius: 50%;
height: 3rem;
width: 3rem;
}
```
<Playground>
```css styles.css hidden
body {
align-items: center;
display: flex;
justify-content: center;
}
.initial-avatar {
/* Center the content */
align-items: center;
display: flex;
justify-content: center;
/* Colors */
background-color: #d1d5db;
color: #fff;
/* Rounded border */
border-radius: 50%;
height: 3rem;
width: 3rem;
}
```
```html index.html hidden
<div class="initial-avatar">
PN
</div>
```
</Playground>