Square-Box Vertical Center
How do I make an square-box vertical center?
In a clients project I needed to center content vertically, without knowing how much content it was. No Javascript.. What is a square-box vertical center? How do you make a square-box vertical center? This script and codes were developed by Tom Lutzenberger on 24 August 2022, Wednesday.
Square-Box Vertical Center - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Square-Box Vertical Center</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container"> <div class="row"> <h1 class="col-xs-12 text-center">Vertical centered square boxes</h1> <div class="col-xs-12 alert alert-info text-center"> <p>The class <code>.square-wrap</code> provides the square shape, while the inner classes (<code>.v-center-wrap</code> and <code>.v-center</code>) do the alignment.</p><strong>Always square. Always vertical centered. No matter the size.</strong> </div> <div class="col-xs-1 col-xs-offset-3"> <div class="square-wrap"> <div class="product v-center-wrap"> <div class="product-content v-center text-center"> <h3>ABC</h3> </div> </div> </div> </div> <div class="col-xs-2"> <div class="square-wrap"> <div class="product v-center-wrap"> <div class="product-content v-center text-center"> <h3>Product</h3> <p>Some text and data</p> </div> </div> </div> </div> <div class="col-xs-3"> <div class="square-wrap"> <div class="product v-center-wrap"> <div class="product-content v-center text-center"> <h3>Product</h3> <p>Some text and data</p> </div> </div> </div> </div> </div>
</div>
</body>
</html>
Square-Box Vertical Center - Script Codes CSS Codes
.square-wrap { height: 0; margin-bottom: 30px; overflow: hidden; padding-top: 100%; position: relative;
}
.square-wrap > div { height: 100%; margin-bottom: 0; margin-top: -100%; position: absolute; width: 100%;
}
.v-center-wrap { display: table;
}
.v-center-wrap > .v-center { display: table-cell; vertical-align: middle;
}
.product { background: #40f; color: #fff; padding: 10px;
}
.product:hover { background: #80f; cursor: pointer;
}
.product h3 { margin: 0;
}
Developer | Tom Lutzenberger |
Username | tomlutzenberger |
Uploaded | August 24, 2022 |
Rating | 3.5 |
Size | 2,774 Kb |
Views | 32,384 |
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!
Name | Size |
Palindrome check | 2,177 Kb |
Weather widget | 2,486 Kb |
Auto-scaling iframes | 3,057 Kb |
Hxgn | 4,203 Kb |
A Pen by Tom Lutzenberger | 2,530 Kb |
Square-Box Vertical Center - Method 2 | 2,701 Kb |
Standard Template | 1,454 Kb |
Pseudo ASCII-Art | 10,362 Kb |
CSS Folders | 2,614 Kb |
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!
Name | Username | Size |
Myprofile | SoufianeAbid | 2,451 Kb |
Barber Shop | Bhlaird | 6,270 Kb |
Map Controls | Iliadraznin | 3,721 Kb |
A Pen by Kenny Mark | Kennymark | 5,574 Kb |
Perspective Origin Demo | Agelber | 3,614 Kb |
Highbrow Basic HTML Lesson 8 | Kimlarocca | 2,094 Kb |
Formations | Cantelope | 5,731 Kb |
Tic Tac Toe | Volv | 4,862 Kb |
Twinner Spinner II | Katydecorah | 2,974 Kb |
Contact | GanNichiHa | 2,514 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!