2015-04-04 69 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; 
      ">