对齐圆形文字

时间:2017-10-15 02:12:08

标签: html css geometry

出于某种原因,我的CSS文件不会在页面上对齐我的圈子。

这是我圈子的html对象:

<div class="circle-text">Upload your photo here</div>

CSS文件:

.circle-text {
display: table-cell;
height: 400px; /*change this and the width
for the size of your initial circle*/
width: 400px;
text-align: center;
vertical-align: middle;
align
border-radius: 50%;
/*make it pretty*/
background: #000;
padding-top:;
color: #fff;
font: 18px "josefin sans", arial;

}

任何想法为什么?

2 个答案:

答案 0 :(得分:0)

尝试添加:

with

答案 1 :(得分:0)

我认为它有效

&#13;
&#13;
.circle-text {
height: 400px; /*change this and the width
for the size of your initial circle*/
width: 400px;
line-height: 400px;
text-align: center;
vertical-align: middle;
border-radius: 100%;
position:absolute;
left:50%;
transform:translate(-50%,0);
/*make it pretty*/
background: #000;
color: #fff;
font: 18px "josefin sans", arial;}
.circle-text .txt{
  line-height: 400px;
text-align: center;
vertical-align: middle;
}
&#13;
<div class="circle-text"><div class="txt">

Upload your photo here</div></div>
&#13;
&#13;
&#13;