如何居中对齐文本与“ display:inline”的边框

时间:2019-06-12 15:46:06

标签: html css

我无法使具有display:inline样式的文本居中对齐。我使用这种样式是为了能够拥有紧身的边框。

<!DOCTYPE html>
<html>
<head>
  <title>Sphero Tutorial Homepage</title>
  <style>
    body {
      background-color: red;
    }

    #heading {
      font-size: 50px;
      text-align: center;
      color: white
    }

    #howtodrivecode {
      color: white;
      border-style: solid;
      border-width: 3px;
      font-size: 30px;
      display:inline;
      margin-left: 540px;
    }
  </style>
</head>
<body>
  <h1 id = "heading">Sphero Tutorial Homepage</h1>
 <hr>
  <h3 id = "howtodrivecode">How-To-Drive</h3>
  <br>
  <br>
  <h3 id = "howtodrivecode">How-To-Code</h3>    
</body>
</html>

标题栏“ howtodrivecode”应居中。

0 个答案:

没有答案