JSFiddle - React, Tailwind, and code Playground
HTML
<div id="main">
<div id="the-content">
<p>段落</p>
<p>段落</p>
<p>段落</p>
<p>段落</p>
</div>
<div class="navigation">
ナビゲーション
</div>
</div>
<div id="main2">
<div id="the-content">
<p>段落</p>
<p>段落</p>
<p>段落</p>
<p>段落</p>
</div>
<div class="navigation">
ナビゲーション
</div>
</div>
CSS
#main {
width: 540px;
border: 1px solid;
}
#the-content {
padding: 10px 0;
}
#the-content p {
width: 500px;
margin: 0 auto 32px;
background-color: rgba(0, 0, 0, .2);
}
#the-content p:last-child {
margin-bottom: 0;
}
.navigation {
width: 100%;
background-color: rgba(200, 0, 0, .5);
color: #fff;
}
#main2 {
width: 540px;
border: 1px solid;
box-sizing: border-box;
}
#main2 #the-content p {
width: initial;
margin: initial;
margin-bottom: 32px;
}
#main2 #the-content p:last-child {
margin-bottom: 0;
}
#main2 #the-content {
padding: 10px 20px;
}
#main2 .navigation {
position:relative;
width: initial;
width: 540px;
left: calc(50% - (540px / 2));
}
JavaScript
100vw / x = 540px
x = 540px *