2015-04-04 68 views
2

我想在HTML頁面上創建一個包含文本的圓圈。類似這樣: https://jsfiddle.net/f5vctpth/1/HTML文本包裝盒

我現在用從引導的IMG輪課上做,但它不是動態...

<div class="img-circle"> 

有沒有辦法來動態自動換行中div?

我發現這一點:(但還沒有還沒有找到一種方法,使其工作)

http://webplatform.adobe.com/Demo-for-Alice-s-Adventures-in-Wonderland/

+0

你需要從DIV隱藏文本出來??? – 2015-04-04 15:25:51

+0

[圓圈div內的文字可能重複。分區大小調整爲內容](http://stackoverflow.com/questions/19169806/text-within-circle-div-div-size-adjusted-to-content) – pschueller 2015-04-04 15:32:38

回答

1

試試這個小提琴https://jsfiddle.net/f5vctpth/2/

添加到您的div overflow: hidden;它會工作

  <div class="img-circle" style=" 
       width: 500px; 
       height: 500px; 
       background: #333; 
       color: red; 
       text-align: center; 
      "> 

以上款式你錯過了overflow: hidden;加入你的搭配overflow: hidden;

與此代碼替換它的工作

  <div class="img-circle" style=" 
       width: 500px; 
       height: 500px; 
       background: #333; 
       color: red; 
       text-align: center; 
       overflow: hidden; 
      ">