Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 在标志中居中显示文本_Css - Fatal编程技术网

Css 在标志中居中显示文本

Css 在标志中居中显示文本,css,Css,我怎样才能使下图中的文本居中 我有这个 .flag{ background: url('flag.png') no-repeat; width:120px; height:120px; } </style> <div class="flag">WOW</div> 这就是它目前的表现 试试: .flag{ background: url('flag.png') no-repeat; width:120px;

我怎样才能使下图中的文本居中

我有这个

.flag{ 
    background: url('flag.png') no-repeat;
    width:120px; 
height:120px; 
}
</style>

<div class="flag">WOW</div>
这就是它目前的表现 试试:

.flag{ 
    background: url('flag.png') no-repeat;
    width:120px; 
    height:120px;
    text-align:center;
    line-height:120px;
  }
尝试:

使用

使用


请正确标记您的问题。请正确标记您的问题。
.flag{ 
    background: url('flag.png') no-repeat;
    width:120px; 
    height:120px;
    text-align:center;
    line-height:120px;
  }
.flag{ 
    background: url('flag.png') no-repeat;
    width:120px; 
    height:120px; 
    line-height:120px; /* same as height */
    text-align:center;
}