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
143 views
in Technique[技术] by (71.8m points)

html - Two divs will not nest inside parent div

I have two divs inside of a parent div, but when I inspect the page, the two divs are not in a container, even though I have wrapped the div around the other 2 divs.

I want to add characteristics to the parent div, instead each div individually.

Advice?

<!DOCTYPE html>
    <head>
    <title>Lavu Explore</title>
        <link rel="stylesheet" type="text/css" href="styles_sample.css">
    </head> 
    <body>
        <div id="sell_section">
            <h2>Sell, Manage, & Market in one easy system</h2>
            <hr class="hr_1">
            <div class="box1">
                <img id ="terminal_img" src="http://i.imgur.com/D5T6lY1.png">
            </div>
            <div class="box1">
                <p style="text-align:left">Choosing a new Point of Sale (POS) is an opportunity. Lavu   is not just accepting payments - Lavu is business management on the iPad. Upgrade your business with the Cloud POS system that was developed specifically for the restaurant / hospitality industry. Lavu has the tools you need to improve efficiency and the bottom line. Love your business.</p>
            </div>

        </div>
     </body>
</html>

styles_sample.css

html {
    box-sizing: border-box;
}


*, *:before, *:after {
    box-sizing: inherit;
}

body {
    margin: auto;
    position: relative;
    overflow: auto;
    padding: 0 5%;
    max-width: 990px;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

h2 {
    text-align: center;
    font-family: DIN;
    font-size: 40px;
    color: #8b8b8b;
    text-align: center;
    width: 100%;
    font-weight: normal;
}

p {
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    color: #8b8b8b;
    font-size: 16px;
    line-height: 150%;
} 

.hr_1 {
    position: relative;
    padding: 0;
    margin: 2% auto;
    height: 0;
    width: 400px;
    max-height: 0;
    font-size: 1px;
    line-height: 0;
    clear: both;
    border: none;
    border-top: 1px solid #aecd37;
    border-bottom: 1px solid #aecd37;
}

.box1 {
    width: 50%;
    min-width: 50%;
    position: relative;
    min-height: 1px;
}

@media (min-width: 830px) {
    .box1 {
        float: left;
    }
}

@media (max-width: 830px) {
    .box1 {
        width: 100%;
    }
}
See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

You didn't insert html start tag after your doctype, it should look a little like this

<!doctype html>
<html>
<head>
...
</head>
<body>
...
</body>
</html>

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

...