我如何将文字移到这里?

时间:2016-06-18 07:00:47

标签: html text

我的代码:https://jsfiddle.net/xgckxtes/1/

如何仅使用html移动文本?

<div style="display: block;background-color:black; color:white; width: 266px; height:266px;x;  border-radius:50px">

<p><q>Never let society to turn you into a grain of sand on the beach. Be different, be individual. Refuse to look alike with others. Leave your herd, only then you will have a real name and till then your name will remain as the grain of sand.</q> - <em>Mehmet Murat ildan</em></p>

3 个答案:

答案 0 :(得分:0)

<div style="display: table;background-color:black; color:white; width: 266px; height:266px;x;  border-radius:50px">

<p style="display: table-cell; vertical-align: middle;"><q>Never let society to turn you into a grain of sand on the beach. Be different, be individual. Refuse to look alike with others. Leave your herd, only then you will have a real name and till then your name will remain as the grain of sand.</q> - <em>Mehmet Murat ildan</em></p>

答案 1 :(得分:0)

修改要显示的样式:table-cell; vertical-align:middle;

添加填充属性。这将使它更美丽。

padding-top调整顶部

例如:

<div style="display:table-cell; vertical-align: middle; background-color:black;
 padding:20px;


color:white; width: 266px; height:266px;x;  border-radius:50px">

<p><q>Never let society to turn you into a grain of sand on the beach. Be different, be individual. Refuse to look alike with others. Leave your herd, only then you will have a real name and till then your name will remain as the grain of sand.</q> - <em>Mehmet Murat ildan</em></p>

</div> 

修改过的小提琴:https://jsfiddle.net/djsreeraj/84k62frb/2/

答案 2 :(得分:0)

<style>
    .item { width:300px; /*width:100%;*/ background-color:black; color:#FFF; border-radius:50px; padding:20px; }
    .item p { font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px; padding:0; } 
</style>

<div class="item">
<p><q>Never let society to turn you into a grain of sand on the beach. Be different, be individual. Refuse to look alike with others. Leave your herd, only then you will have a real name and till then your name will remain as the grain of sand.</q> - <em>Mehmet Murat ildan</em></p>
</div>