The two inline divs keep the stack upright. (main content is under my sidebar) HTML and CSS

HTML and CSS question: For this purpose, we shouldn't use float, but instead only use block, inline and inline. Even though I have set the div in the sidebar for the inline block and the main content div for the inline, and the width is less than the width of the wrapper, it is not left and right aligned. Can anyone help me figure out what I need to fix. I know there is a lot of code here, but I'm not sure what I need to insert and what not. I looked around and tried to find an answer, but if this question has already been asked and resolved, please email me. Thank.

Google drive html and css (sorry to submit the whole file, I wasn't sure what it was, so I decided to attach the entire html and css file.)

+3


source to share


1 answer


try it

Html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>Word Stream</title>
    <meta name="description" content="Pay per click search marketing software offers a means for accomplishing two core requirments for PPC optimization"/>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
    <div id="wrapper">
        <!-- Header (Logo and Nav) -->
        <div id="header">
            <div id="nav">
                <ul>
                    <li><a href="#">Products</a></li>
                    <li>|</li>
                    <li><a href="#">Products</a></li>
                    <li>|</li>
                    <li><a href="#">Blog</a></li>
                    <li>|</li>
                    <li><a href="#">Support</a></li>
                    <li>|</li>
                    <li><a href="#">AdWords Grader</a></li>
                </ul>
                <form id ="login">
                    <label>
                        <button class="button" type="button">Login</button>
                    </label>
                </form>         
            </div>

            <div id="logo">
                <img src="logo.png" alt="Logo">
                <span id="word">Word</span>
                <span id="stream">Stream</span>
            </div>
        </div>
        <!-- Main content section -->
        <div id="main-page">
            <div id="banner">
                <h1>WordStream Internet Marketing Software</h1>
            </div>
            <!-- main side of page -->

            <!-- Side bar (info and Advertisment) -->
            <div id="side-bar">
                <div id="side-bar-content">
                    <h1>Wordstream for PPC</h1>
                    <h2>Drive More Profits Through PPC!</h2>
                    <p>Get Started with <span class="blue">Wordstream</span> Powerful PPC Platform Today</p>
                    <form>
                        <label>
                            <button class="button1" type="button">SCHEDULE DEMO</button>
                        </label>
                        <label>
                            <button class="button2" type="button">FREE TRIAL</button>
                        </label>
                    </form>
                    <p class="center">(No Credit Card Required)</p>
                </div>
                <!-- side bar ad -->
                <div id="side-bar-ad">
                    <div id="wrap-img-text">
                        <h3>How does your adWords performance measure up?</h3>
                        <p>Get a free, instant report with the WordStream Adwords Performance Grader</p>
                        <form>
                            <label>
                                <button class="graded" type="button">Get Graded Today</button>
                            </label>
                        </form>
                    </div>
                    <img class="img" src="left_content_ad1.png" alt="Oops, your browser isn't showing this image.">
                </div>
            </div>
            <div id="handle">
            <div id="upper-bar">
                <img class="inline" src="home_button.png" alt="home">
                <span class="blue">PPC</span>
                <!-- contact info and phone pic -->
                <div id="contact" class="inline">
                    <img class="inline phone" src="phone.png" alt="phone">
                    <!-- text only -->
                    <div class="inline">
                        <p class="top">
                            <span class="hours">Mon - Fri 9 a.m. - 5 p.m. (EST)</span>
                            <br>
                            <span class="number">855.967.3787</span>
                            <br>
                            <span class="int-number">International: +1.617.963.0555</span>
                        </p>
                    </div>
                </div>
            </div><br/>
            <!-- main content starts here -->
            <div id="main-content">
                <h1>PPC - Achieve More Efficiant Pay-Per CLick (PPC) Marketing</h1>
                <p><span class="bold">PPC</span>(<a href="#">pay-per click</a>) search marketing software offers a means for accomplishing two core requirements for PPC optimization:</p>
                <ul>
                    <li>
                        <span class="bold">PPC Automation</span>-While it would be impossible (and inadvisable!) to automate every aspect of <a href="#">pay-per-click advertising</a>, automating away redundant, time-consuming tasks affords you a means of increasing productivity. Often, this means being able to produce an amount of work that would otherwise have been unachievable for you and your business.
                    </li>
                    <li>
                        <span class="bold">PPC Management</span>-<a href="#">PPC management</a> refers to the maintenance and prioritizing of <a href="#">paid seach</a> marketing tasks. Being able to oversee various aspects of your account while assigning each item on a seemingly endless to-do list an appropriate value can make or break an <a href="#">online ad campaign</a>.
                    </li>
                </ul>
                <p>
                    WordStream <a href="#">PPC software</a> is specifically designed to aid in these two <a href="#">PPC search engine</a> marketing areas. This page will show you both the processes the software is automating for you, and the best course of action to take where workflow is concerned.
                </p>
                <!-- Bordered *Trial* box with logo and button -->
                <div id="trial-box">
                    <img src="content_ad.png" alt="ad">
                    <div class="text-button">
                        <h3>Drive More Profits Through PPC - Try Our Platform FREE</h3>
                        <p>Get instant access to WordStream innovative <span class="bold"> Quality Score</span> and <span class="bold">Account Management</span> tools through our <span class="bold"> FREE 7-day Trial</span>. Risk Free, No Credit Card Required and No Automatic Signups.</p>
                        <form>
                            <label>
                                <button class="get-started" type="button">Get Started Today!</button>
                            </label>
                        </form>
                    </div>
                </div>
                <!-- under the trial box -->
                <h2>Automation And Your PPC Search Campaign</h2>
                <p>Another two lines of text that I really dont feel like copying. Soooo much text to copy, not worth it. Im just writing this instead to fill in the space.</p>
            </div>
            </div>
        </div>
    </div>
</body>
</html>

      

CSS

*{
margin: 0px;
padding: 0px;
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
}
#wrapper{
width: 1000px;
margin: 0px auto;
}
/*HEader things*/
#header{
width: auto;
position: relative;
height: 100px;
}
#logo{
display: block;
text-align: left;
position: absolute;
bottom: 0px;
}
#logo img{
vertical-align: text-bottom;
width: 50px;
}
#word{
color: grey;
font-family: Tahoma, Geneva, sans-serif;
font-size: 35px;
}
#stream{
color: blue;
font-family: Tahoma, Geneva, sans-serif;
font-size: 35px;
}
#nav{
display: block;
margin: 10px 30px;
position: absolute;
right: 0px;
}
#nav ul{
display: inline-block;
background-color: #F0F0F0;
border-radius: 5px;
padding: 0px 10px 5px;
padding-bottom: 7px;
}
#nav li{
display: inline-block;
font-size: 12px;
vertical-align: middle;
}
#login{
display: inline-block;
margin-left: 20px;
}
.button{
width: 60px;
height: 25px;
background-color: blue;
border-radius: 5px;
border: 0px;
color: white;
}
/*Banner right under header*/
#banner{
background-color: blue;
padding: 5px 10px;
margin: 15px 0px;
font-size: 10px;
box-shadow: 0px 50px 200px grey;
}
#banner h1{
color: white
}
/*sidebar*/
#side-bar{
display: inline-block;
width: 220px;
}
#side-bar-content{
border-bottom: 1px solid lightgrey;
margin-bottom: 10px;
padding-bottom: 10px;
}
#side-bar h1{
font-size: 15px;
color: blue;
}
#side-bar h2{
font-size: 12px;
color: darkred;
}
#side-bar p{
font-size: 11px;
}
.button1{
border: 0px;
background-color: blue;
color: white;
width: 220px;
padding: 3px 0px;
margin-bottom: 3px;
border-radius: 5px;
}
.button2{
border: 0px;
background-color: orange;
color: white;
width: 220px;
padding: 3px 0px;
border-radius: 5px;
}
.center{
text-align: center;
}
/*Bottom half of sidebar*/
#side-bar-ad{
position: relative;
}
#wrap-img-text{
position: absolute;
left: 0px;
top: 0px;
padding: 10px;
}
#wrap-img-text h3{
font-size: 15px;
padding: 5px;
color: blue;
}
#wrap-img-text p{
padding: 3px;
}
.graded{
width: 180px;
background-color: darkblue;
color: white;
border-radius: 10px;
margin: 5px;
}
.img{
width: 210px;
height: auto;
}
.blue {
color: blue;
}
#handle{
    vertical-align: top; display: inline-block;
}
/*Under the panel (phone number etc)*/
#upper-bar{
display: inline-block;
vertical-align: top;
position: relative;
width: 720px;
height: 110px;
border-bottom: 1px solid lightgrey;
}
#upperbar hr{
position: absolute;
bottom: 0px;
}
.inline{
display: inline-block;
vertical-align: top;
}
#contact{
position: absolute;
height: 110px;
right: 0px;
top: 0px;
}
.phone{
height: 70%;
width: auto;
}
.number{
color: blue;
font-family: Impact, Charcoal, sans-serif;
font-size: 45px;
}
.int-number{
font-size: 15px;
}
/*main content section*/
#main-content{
display: inline-block;
width: 700px;
vertical-align: top;
}
#main-content li{
list-style-type: square;
margin-left: 20px;
margin-bottom: 5px
}
#main-content h1{
font-size: 23px;
color: blue;
margin-bottom: 5px;
margin-top: 15px;
}
#main-content p{
margin-bottom: 5px;
margin-top: 15px;
}
.bold{
 font-weight: bold;
}
#trial-box{
border: 5px solid blue;
padding: 10px;
}
#trial-box img{
display: inline-block;
vertical-align: top;
}
.text-button{
display: inline-block;
width: 600px;
vertical-align: top;
}
h3{
color: blue;
}
.get-started{
background-color: limegreen;
color: white;
border-radius: 5px;
border: 0px;
width: 150px;
padding: 5px;
}
h2{
color: blue;
font-size: 17px;
margin-top: 10px;
}

      



Output: enter image description here

Check it out

Fiddle

EDIT:

Q: Why didn't the code work before? A:enter image description here

+2


source







All Articles