2013-04-09 69 views
2

目前在我的代碼我的形象看起來像this(右下) - 我將如何使它apear通過使用CSS圖像纏文本右上:文字環繞圖像周圍的

HTML:

  <div class="leftColBlog"> 
         {{ streams:cycle stream="agrilife_news" limit="5"}} 
          {{ entries }} 
           <h2 class="blogTitle">{{ title }}</h2> 
            <div class="textCon alignLeft"> 
             <p class="text"> {{ description }} </p> 
              <img class="alignRight" src="{{ image:thumb }}" /> 
            </div> 

          {{ /entries}} 
         {{ /streams:cycle }} 
        </div> 

CSS:

.leftColBlog{ 
    display: inline-block; 
    width:650px; 
    border-right: 1px solid red; 
} 
.textCon{ 
    display: inline-block; 
} 
.textCon p{ 
    padding: 0 10px 0 10px; 
} 
.textCon p a{ 
    color: #fff !important; 
} 
.textCon img{ 
    display: inline-block; 
} 
.alignleft{ 
    float: left; 
    margin: 0 0 0 5px; 
} 
.alignRight{ 
    float: right; 
    margin: 0 0 0 5px; 
} 
+0

試圖把圖像文本前的標記 – Ejaz 2013-04-09 23:25:27

回答

2

把你的文字之前,你的形象,並給它是一種浮動風格:正確。

應該是這個樣子:

<div class="leftColBlog"> 
     {{ streams:cycle stream="agrilife_news" limit="5"}} 
       {{ entries }} 
        <h2 class="blogTitle">{{ title }}</h2> 
        <div class="textCon alignLeft"> 
         <img class="alignRight" src="{{ image:thumb }}"/> 
         <p class="text"> {{ description }} </p> 

        </div> 

       {{ /entries}} 
     {{ /streams:cycle }} 
</div> 

CSS

.leftColBlog{ 
    display: inline-block; 
    width:650px; 
    border-right: 1px solid red; 
} 
.textCon{ 
    display: inline-block; 
} 
.textCon p{ 
    padding: 0 10px 0 10px; 
} 
.textCon p a{ 
    color: #fff !important; 
} 
.textCon img{ 
    float:right; 
} 
.alignleft{ 
    float: left; 
    margin: 0 0 0 5px; 
} 
.alignRight{ 
    float: right; 
    margin: 0 0 0 5px; 
}