【发布时间】:2014-08-25 20:41:29
【问题描述】:
我对 CSS 还很陌生。我一直在寻找有关居中 div 的答案。我确实看过这个网站的一些答案,但它对我没有多大帮助。我想要一个完美的中锋。谢谢!
这是我的图片:
<!DOCTYPE html>
<html>
<head>
<style>
@font-face {
font-family: stonehen; src: url('stonehen.ttf'); }
@font-face {
font-family: stonehen src: url('stonehen.ttf');
font-weight: bold; }
div {
border: 4px solid #A9A9A9;
margin: auto;
color: #A9A9A9;
text-align: center;
background: #006400;
border-radius: 25px;
padding: 6px;
font-family: stonehen, san-serif;
font-size: 150%;
font-weight: bold;
width: 300px; }
</style>
</head>
<body>
<div> Welcome </div>
</body>
</html>
【问题讨论】:
-
缺少什么让您的问题成为“不完美的答案”?
-
你想让它水平和垂直居中吗?如果是这样结帐:css-tricks.com/centering-in-the-unknown
-
什么是“完美中心”?
标签: html css border center margins