Flexbox, div centered

Developer
Size
1,628 Kb
Views
34,408

How do I make an flexbox, div centered?

This is an example from the blog article Playing around with Flexbox at http://www.tipue.com/blog/flexbox/ and is also featured in the article The complete guide to centering a div at http://www.tipue.com/blog/center-a-div/. What is a flexbox, div centered? How do you make a flexbox, div centered? This script and codes were developed by Steve Pear on 16 September 2022, Friday.

Flexbox, div centered Previews

Flexbox, div centered - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Flexbox, div centered</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container"><div class="item"></div><div>
</body>
</html>

Flexbox, div centered - Script Codes CSS Codes

body
{ background-color: #fcfcfc;
}
.container
{ display: flex; align-items: center; justify-content: center; height: 100vh;
}
.item
{ background-color: #ccc; border-radius: 3px; width: 200px; height: 100px;
}
Flexbox, div centered - Script Codes
Flexbox, div centered - Script Codes
Home Page Home
Developer Steve Pear
Username Tipue
Uploaded September 16, 2022
Rating 3
Size 1,628 Kb
Views 34,408
Do you need developer help for Flexbox, div centered?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Steve Pear (Tipue) Script Codes
Create amazing blog posts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!