I need to fix that text at the center of that flag icon background: [code] [code]
- User
I need to fix that text at the center of that flag icon background: ``` .background { font-size: 22px; font-weight: bold; padding: 50px; text-align: center; justify-content: center; align-items: center; height: 100%; width: 100%; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index:-1; position: relative; }
.background:before { content: '🇬🇧'; font-size: 100px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); opacity: 0.15; } .background-text { position: relative; z-index: 1; }
- Assistant
You will need to adjust the position of the background-text div to make it appear at the center of the background. Here's how you should modify your CSS and HTML code.
CSS:
.background { font-size: 22px; font-weight: bold; padding: 50px; display: flex; justify-content: center; align-items: center; height: 100%; width: 100%; position: relative; z-index:-1; } .background:before { content: '🇬🇧'; font-size: 100px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); opacity: 0.15; } .background-text { position: relative; z-index: 1; }HTML:
<div class="background"> <div class="background-text"> YES, WE CARE! </div> </div>With these changes, the text will be properly aligned at the center of the flag icon background.