删除与图像重叠的额外区域

时间:2013-08-31 17:32:00

标签: javascript jquery html css tabs

在关注this guide以在我的网站上创建标签菜单时,我遇到了一个问题。 image

内容框有点太长并且与图像重叠。 有人请告诉我如何削减额外的区域吗?

这里有jsfiddle example来说明问题。

HTML:

<div class='product'>
    <div class="product_image">
        <img src="http://www.gamersgate.com/img/boximgs/big/DDB-TTCP.jpg" alt="fggf"
        />
    </div>
    <div class="container">
        <ul class="tabs">
            <li class="tab-link current" data-tab="tab-1">Tab One</li>
            <li class="tab-link" data-tab="tab-2">Tab Two</li>
            <li class="tab-link" data-tab="tab-3">Tab Three</li>
            <li class="tab-link" data-tab="tab-4">Tab Four</li>
        </ul>
        <div id="tab-1" class="tab-content current">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
            tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
            quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
            consequat.</div>
        <div id="tab-2" class="tab-content">Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
            dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
            proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
        <div
        id="tab-3" class="tab-content">Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
            ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit
            in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</div>
    <div
    id="tab-4" class="tab-content">Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
        enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
        aliquip ex ea commodo consequat.</div>
</div>
<!-- container -->

CSS:

    body{  
    margin-top: 100px;  
    font-family: 'Trebuchet MS', serif;  
    line-height: 1.6  
     }  
    .container{  
    width: 800px;  
    margin: 0 auto;  
    }  

    ul.tabs{  
    margin: 0px;  
    padding: 0px;  
    list-style: none;  
    }  

    ul.tabs li{  
    background: none;  
    color: #222;  
    display: inline-block;  
    padding: 10px 15px;  
    cursor: pointer;  
    }  

    ul.tabs li.current{  
    background: #ededed;  
    color: #222;  
    }  

    .tab-content{  
    display: none;  
    background: #ededed;  
    padding: 15px;  
    }  

    .tab-content.current{  
    display: inherit;  
    }  

    .product {
    font-size: small;
    }

   .product_image {
   float: left;
   width: 200px;
   padding: 20px;
   margin: 0 20px 20px 0;
   }

2 个答案:

答案 0 :(得分:1)

如果我理解正确,请在此处查看fiddle

I made changes in css only

答案 1 :(得分:1)

改变了一点CSS,这里是Fiddle

.tab-content {  
  display: none;
  float: right;
  width: 584px;
  margin: 0;
  background: #ededed;  
  padding: 15px;  
}