简体   繁体   中英

Problems with positioning of text within HTML

I am trying to position a paragraph between an image and bullet points. I think I have the right layout within the html but for some reason it is just not displaying correctly. See image below:

在此处输入图片说明

As you can see, the paragraphs appear under everything else but this is not how it is displayed within my html. See below for code:

HTML:

<div class="services">
        <div class="serviceHolder" style="opacity: 1;">
            <div class="serviceBox" id="service-plan">
                <div class="serviceIcon"><img src="images/icon-design.jpg" width="129" height="134" alt="design icon"></div>
                <div class="serviceCopy">
                    <h2>Plan</h2>
                    <ul class="serviceBullets">
                        <li><h3>Objectives</h3></li> 
                        <li><h3>Scope</h3></li>
                        <li><h3>Sitemap</h3></li>
                        <li><h3>Wireframes</h3></li>
                    </ul>   
                    <p>Lorem ipsum dolor sit amet, porta quis urna tempor vestibulum purus, vulputate condimentum arcu faucibus aliquam enim accumsan, a nulla nullam morbi bibendum eveniet tempus, parturient consequat sociis quis. Suscipit in vitae ornare lobortis sed, porta et minima odio neque maecenas cras, justo in. </p>
                    <p>Justo arcu lacus, quos pellentesque nam sit. Luctus mauris egestas, leo nisl porttitor urna scelerisque ut, mauris sodales sapien donec dolor, arcu a ante vestibulum lorem vitae quam</p>
                </div>
            </div>
        </div>

CSS:

.services {
width: 100%; float: left; margin: 30px 0;
}

.services .serviceBox {
width: 898px; padding: 30px; border: 1px solid #43C0C2; background-color: white; float:     left; margin-bottom: 10px;
}

.services .serviceIcon {
float: left; margin: 0 30px 50px 0; width: 129px;
}

.serviceBullets {
float: right; font-weight: 100; width: 150px;
}

.serviceBullets li {
list-style-image: url(../images/bullet.gif); color: #43C0C2; margin-bottom: 10px;
}

.services h2 {
font-size: 40px; margin-bottom: 20px; color: #000000;
}

You have added Float:left to just right Div only, You need to update your left div also with following code

.serviceCopy
{
  float: left;
  width: 721px;
}

Also after 2 div you will need to add one more div to clear all floats

<div class="serviceIcon"></div>
<div class="serviceCopy"></div>
<div style="clear:both"></div>

So that your layout won't break.

Are you trying to have it so that it goes IMAGE - PLAN AND PARAGRAPH - BULLET POINTS?

Or

IMAGE - Everything else so that the image column is on the left, everything else is on the right?

IF its the former.

Try this:

<div class="serviceHolder" style="opacity: 1;">
        <div class="serviceBox" id="service-plan">
            <div class="serviceIcon"><img src="images/icon-design.jpg" width="129" height="134" alt="design icon"></div>
            <div class="serviceCopy">
            <h2>Plan</h2>
                <p>Lorem ipsum dolor sit amet, porta quis urna tempor vestibulum purus, vulputate condimentum arcu faucibus aliquam enim accumsan, a nulla nullam morbi bibendum eveniet tempus, parturient consequat sociis quis. Suscipit in vitae ornare lobortis sed, porta et minima odio neque maecenas cras, justo in. </p>
                <p>Justo arcu lacus, quos pellentesque nam sit. Luctus mauris egestas, leo nisl porttitor urna scelerisque ut, mauris sodales sapien donec dolor, arcu a ante vestibulum lorem vitae quam</p>
             </div>
            <div class="serviceBullets">
                <ul>
                    <li><h3>Objectives</h3></li> 
                    <li><h3>Scope</h3></li>
                    <li><h3>Sitemap</h3></li>
                    <li><h3>Wireframes</h3></li>
                </ul>   
            </div>
        </div>
    </div>

So that it has its own div and bullets are separate.

Then float all of them left. And define their widths. Then add one more div, to clear the floats.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM