Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
172 views
in Technique[技术] by (71.8m points)

html - Border box not showing up inside larger border box

I have a larger, long box that I want to have a heading inside. I want the heading border-box to be covering the whole top of the larger box, but my heading box isn't even showing up. Here is the code that I have for this:

<!-- Larger box --> 
<div class="border-box" style="
position: absolute;
top: 3500px;
left: 420px;
border: 10px solid;
border-color: #466995;
background-color: none;
width: 260px;
height: 700px;
margin: 20px;
box-sizing: border-box;
text-align: center;
color: black;
font-size: 40px;
font-family: 'Oswald', sands serif;
                             ">
<!-- smaller heading box -->
<div class= "border-box" style="
    position: absolute;
    margin: 0 auto;
    top: 3500px;
    width: 260px;
    background-color:#466995;
    border: none;  
    box-sizing: border-box;
    text-align: center;
     box-align: center;
    ">
</div>
</div>

I want that second snippet to be inside the borders of the first one, but right now it just shows up that there's no second box.

question from:https://stackoverflow.com/questions/66068854/border-box-not-showing-up-inside-larger-border-box

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

<!-- Larger box --> 
<div class="border-box" style="
position: absolute;
top: 3px;
left: 42px;
border: 10px solid;
border-color: black;
background-color: none;
width: 280px;
height: 700px;
margin: 20px;
box-sizing: border-box;
text-align: center;
color: black;
font-size: 40px;
font-family: 'Oswald', sands serif;
                             ">
<!-- smaller heading box -->
<div class= "border-box" style="
    position: absolute;
    margin: 0 auto;
    top: 0px;
    width: 260px;
    background-color:red;
    border: none;  
    box-sizing: border-box;
    text-align: center;
     box-align: center;
    ">heading
</div>
</div>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...