I am working on a webpage where I need to display the status of two websites - whether they are currently up and running or not. For sites that are up, I want the block to have a light green background, and for those that are down, a light red one. Additionally, the name of the site should be centered inside each block.
Here is what I have attempted so far:
body {
font-family: sans-serif;
}
#container {
width: 800px;
height: 600px;
margin: 0 auto;
border: 1px solid #ccc;
}
#smallcontainer {
width: 208px;
height: 100px;
margin: 200px auto auto;
}
.status {
height: 100px;
width: 100px;
background: #efefef;
float: left;
margin-left: 2px;
border: 1px solid #ccc;
}
<div id="container">
<div id="smallcontainer">
<div class="status"></div>
<div class="status"></div>
</div>
</div>
While it functions (check full screen output), I believe there could be a more efficient way to achieve this with CSS. My current code feels like a workaround. How can I neatly center text both vertically and horizontally within each block?
Furthermore, is there a method to ensure that this layout is responsive across all desktop screen sizes? Would using percentage for width and height instead of pixels be a better approach?