我想要一个包含width:auto;
和display:block;
的按钮。此按钮应以margin:0 auto
为中心。但是如果我把所有东西放在一起,它就行不通。
我做错了什么?
CODE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>asd</title>
</head>
<body>
I am an example content and I should be above the button. I want to have an auto width and being centered
<style type="text/css">
.btn{
color:black;
font-size: 14px;
line-height:14px;
text-align: center;
font-weight: bold;
margin:0 auto;
height:14px;
display:block;
cursor: pointer;
background-color:red;
padding:15px;
text-decoration:none;
}
</style>
<a class="btn">helloworld</a>
</body>
</html>