在证言部分正确安排文本

时间:2015-02-24 07:11:31

标签: javascript jquery html css

我需要图中所示的排列,因为我无法发布图片,请点击this link

同样我编码如下

HTML

 <div class="container">
                <div class="test-item">
                    <span class="test-head">
                        <img src="images/testimonial_item.png" class="img-responsive" />
                    </span>
                    <p class="test-quote">
                        Cras mattis consectetur purus sit amet fermentum. Donec id elit non mi porta gravida at eget metus. Duis mollis, est non commodo luctus erat porttitor. 
                        <span class="test-author" >
                            Lorem Ipsum
                        </span>
                        <br />
                        <span class="test-author-org">
                           lorem
                        </span>
                    </p>
                </div>
                </div>

CSS

    .testimonial
    {
        background: #fff;
        padding:60px 0px !important;
        position:relative;
    }
    .test-head {
        float: left;
            width: 10% !important;
    }
    .test-head img
    {
        height:80px;
        width:auto;
        }
        .test-author-org,.test-author
        {
            float:right;
            padding:0;
            margin:0;
            color:#626262;
            }
            .testimonial p
            {
                padding-right:70px !important;
                }
    .test-item
    {
        background:#e6e6e6;
        border-radius:70px;
        min-height:81px;
    }
.testimonial .test-quote
{
    display: block;
    font-family: Arial;
    font-size: 14px;
    color: #0a3980;
    text-align: left;
    padding:10px 0 0 0 ;
    margin-bottom:0px!important;
    clear:right;
}

fiddled here

我怎样才能让它与图像完全吻合?

请帮助任何人

2 个答案:

答案 0 :(得分:1)

从头开始,下面会产生你想要的东西。

注意如果您的报价小于650px,您可能需要调整边距,填充和/或宽度,以便内容不会溢出容器。

See a working jsFiddle here

&#13;
&#13;
.my-head{
    width:61px;
    float:left;
}
.my-body{
    padding-top:15px;
    width:auto;
    max-width:90%;
    float:left;
}

.my-quote-container {
    font-family: Arial;
    font-size: 14px;
    color: #0a3980;
    text-align: left;
    margin-bottom: 0px!important;
    background: #e6e6e6;
    border-radius: 70px;
    min-height: 81px;
    clear:both;
    
}
.my-head-img{
    float:left;
    transform: rotate(270deg);
    margin: 8px 8px 8px 15px;
    margin-right:25px;
}
.my-quote{
    text-align: left;
    display:table;
    padding-right:35px;
    padding-left:35px;
    float:left;
}
.my-body span{
    clear: right; float: right;
    padding-right:42px;
    color:#666666;
}
}
.my-author{
    text-transform: uppercase;
    margin-top:5px;
}
&#13;
<div class="my-quote-container">
  <div class="my-item">
    <div class="my-head"> <img src="http://s6.postimg.org/qara2aba5/testimonial_item.png" class="img-responsive my-head-img" /> </div>
    <div class="my-body">
      <div class="my-quote">Cras mattis consectetur purus sit amet fermentum. Donec id elit non mi porta gravida at eget metus. Duis mollis, est non commodo luctus erat porttitor.</div>
      <br>
      <span class="my-author cap">Lorem Ipsum</span> <br />
      <span class="my-author">lorem</span> </div>
  </div>
</div>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

在此处添加了旋转和填充plz检查:https://jsfiddle.net/bzz06r96/1/

.test-head img {
        height:80px;
        width:auto;
    -ms-transform: rotate(-90deg); /* IE 9 */
    -webkit-transform: rotate(-90deg); /* Chrome, Safari, Opera */
    transform: rotate(-90deg);
    }
.test-quote {
    padding-left: 90px;
    padding-top: 10px;
    position: relative;
    padding-right: 34px;
}