asasass
1
Would I be setting width and height to body?
Code: https://jsfiddle.net/9mrvj76L/
#holder {
width: 1500px;
height: 500px;
box-shadow: inset 0 0 0 3px #e77d19;
position: relative;
background-color: black;
}
.hvcentered {
width: 232px;
height: 232px;
background-color: #00a0b0;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
}
<div id="holder">
<div class="hvcentered">
</div>
</div>
I tried this:
Code: https://jsfiddle.net/xt4yL192/
.content {
width: 600px;
height: 200px;
}
#holder {
width: 1500px;
height: 500px;
box-shadow: inset 0 0 0 3px #e77d19;
position: relative;
background-color: black;
}
.hvcentered {
width: 232px;
height: 232px;
background-color: #00a0b0;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
}
<div class="content">
<div id="holder">
<div class="hvcentered">
</div>
</div>
</div>
Hi there asasass,
My monitor cannot handle 1500px so this
example takes a rather different approach
which you may be able to change to suit
you specific requirements…
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1">
<title>Untitled document</title>
<!--
The internal CSS should be transferred to an external file
<link rel="stylesheet" href="screen.css" media="screen">
-->
<style media="screen">
body {
background-color: #f0f0f0;
font: normal 1em / 1.62em sans-serif;
}
#holder {
display:flex;
justify-content: center;
align-items: center;
width: 81vw;
height: 27vw;
margin: auto;
border: 0.2em solid #e77d19;
background-color: #000;
box-sizing: border-box;
}
#holder div {
width: 12vw;
height: 12vw;
background-color: #00a0b0;
}
</style>
</head>
<body>
<div id="holder">
<div></div>
</div>
</body>
</html>
coothead
1 Like
asasass
3
How would I set it up without changing these numbers?
#holder {
width: 1500px;
height: 500px;
box-shadow: inset 0 0 0 3px #e77d19;
position: relative;
background-color: black;
}
.hvcentered {
width: 232px;
height: 232px;
display:flex;
justify-content: center;
align-items: center;
The problem with width:1500px
is that it probably
does not cater for the majority of your visitors. 
Of course, if it’s just for your personal delight then
by all mean make it as wide as you want. 
coothead
1 Like
system
Closed
5
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.