无法让图像浮动到文本右侧?

时间:2014-11-06 18:18:36

标签: html css

我试图让图像浮动在文本旁边,我无法让它工作。我希望文本和图片都位于导航和徽标下方。

这里是html                        杰克琼斯新媒体设计

        <link rel="stylesheet" type="text/css" href="style.css">
    </head>
    <body>

    <div class="wrapper">

    <div id="logo"><img src="logo.jpg" alt="Art"></div>

 <ul id="Menu">

  <li><a href="#">Home</a></li>
  <li>
      <a href="#">Portfolio</a>
      <ul>
        <li><a href="#">Web</a></li>
        <li><a href="#">Campeign</a></li>
        <li><a href="#">Print</a></li>
        <li><a href="#">Motion</a></li>
        <li><a href="#">Photography</a></li>
        </ul>
    </li>
    <li><a href="#">Contact</a></li>
</ul>


    <div class="text">

            <p> The surfboard, one of the most fun toys around.  There is just one problem with it.  The majority of them are plain white.  There is no color and adding some stickers isn't a true way to express yourself!  With a little time and some common items from your garage or hardware, you can make it so much better.  You don't have to be a great artist or have lots of money to truly make that board your own.  This site is a simple guide with some tips and tricks for painting your surfboard.  When the waves aren't breaking and your looking at that board in the corner of your room, take some time and change it up!  Here are some art ideas. <a href="http://jsindustries.com/sprays" target="blank">Art Ideas</a> </p>



<div class="imgContainer">
        <img src="me.jpg" alt="Art" title="me">
    </div>

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

这是css

.wrapper {
    margin:auto;
    width:1000px;       
}

#logo {
    float: left;
    margin-left: 10px;
}

#Menu,
#Menu ul {
    list-style: none;
  }

#Menu {
    float: right;
    margin-right: 20px;
   margin-top: 85px;
  }

#Menu > li {
float: left;
}
#Menu li a {
display: block;
height: 2em;
line-height: 2em;
padding: 0 1.5em;
text-decoration: none;
 }

#Menu ul {
position: absolute;
display: none;
z-index: 999;
}

  #Menu ul li a {
   width: 50px;
 }

#Menu li:hover ul {
display: block;
  }

    /* Main menu
------------------------------------------*/
#Menu {
font-family: Arial;
font-size: 12px;
background: #ffffff;
  }

   #Menu > li > a {
   color: #000000;
   font-weight: bold;
    }

 #Menu > li:hover > a {
background: #ffffff;
color: #7a0808;
 }

/* Submenu
 ------------------------------------------*/
   #Menu ul {
    background: #ffffff;
   padding: 0;
   list-style-type: none;
     }

   #Menu ul li a {
  color: #000000;
   }

  #Menu ul li:hover a {
   color: #7a0808;
  }

  /* Content
   ------------------------------------------*/
.text {
    clear: both;
}

p   {

    clear: both;
    width: 200px;
}


.imgContainer {
margin-top: 70px;
margin-right: 40px;
float:right;
clear: both;
}

1 个答案:

答案 0 :(得分:2)

您需要在段落之前放置图像。

<div class="text">

    <div class="imgContainer">
        <img src="me.jpg" alt="Art" title="me">
    </div>

    <p> The surfboard, one of the most fun toys around.  There is just one problem with it.  The majority of them are plain white.  There is no color and adding some stickers isn't a true way to express yourself!  With a little time and some common items from your garage or hardware, you can make it so much better.  You don't have to be a great artist or have lots of money to truly make that board your own.  This site is a simple guide with some tips and tricks for painting your surfboard.  When the waves aren't breaking and your looking at that board in the corner of your room, take some time and change it up!  Here are some art ideas. <a href="http://jsindustries.com/sprays" target="blank">Art Ideas</a> </p>

</div>