- What is the best way to center a div?
- How do I compress the text like in the example photos?
Aziz Moe
@a2uuzAll comments
- @MichaelSplSubmitted over 1 year ago@a2uuzPosted over 1 year ago
- To center a div horizontally and vertically on a webpage, you can use a combination of CSS flexbox or CSS grid along with proper alignment properties. Here's an example using Flexbox:
HTML: <div class="center-div"> <!-- Your content goes here --> </div>
CSS: body { display: flex; justify-content: center; align-items: center; height: 100vh; /* This helps center vertically */ margin: 0; }
.center-div { /* Define div styling here */ }
- If you want to compress text, you can achieve a similar effect by adjusting the font size, line height, and possibly the letter spacing. Here's an example:
.center-div { text-align: center; font-size: 14px; /* Adjust as needed / line-height: 1.2; / Adjust line height for readability / letter-spacing: -0.02em; / Adjust letter spacing for compression effect */ }
Keep in mind that compressing text too much might reduce readability, so it's important to find the right balance :)
2 - @yrpcfcpSubmitted over 2 years ago
This is my second challenge.
@a2uuzPosted over 2 years agohi, you almost nailed the design !! checkout your reports to fix the html and accebility issues for clean code :)
0 - @Queen-codesSubmitted over 2 years ago
Good day, any ideas on how to make the texts similar to the one in the design would be appreciated. tried using width, but it didn't work
@a2uuzPosted over 2 years agohello, nice work :D you really nailed it! try using font-size for the text and make sure you have all the style-guide prerequisites and also look out for accecibility issues.
0