HTML CSS margin-left和margin-right不想以div为中心

时间:2017-09-09 14:23:17

标签: html css

我正在学习css和html,我遇到了这个问题,其中" .logo"中的margin-left和margin-right div class不想让div居中。请帮助,因为我做了研究,我检查了代码,一切看起来都很好,所以我不知道最新情况。



<html lang="pl">
<head>
    <meta charset="utf-8"/>
    <title>site</title>

    <link rel="stylesheet" href="style.css" type="text/css"/>

</head>
<body>

    <div class="wrapper">
        <div class="header">
            <div class="logo">
                LOGO
            </div>
        </div>
    </div>



</body>
</html>
&#13;
import csv

data = csv.reader(open('filename.txt'))
username=input("uesrname:")
accountno=input("account no:")
new_data = [{a:b for a, b in zip(["name", "id"], i)} for i in data]
if any(i["name"] == username and i["id"] == accountno for i in new_data):
    print("Access Granted")
else:
    print("Sorry, wrong credentials")  
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

当您的徽标为100px时,您的标题仅为450px,您可以查看此fiddle for demo

.wrapper {
  width: 100%;
}

.header {
  width: 1000px;
  padding: 40px 0;
}

.logo {
  width: 450px;
  font-size: 48px;
  border: 1px solid white;
  margin-left: auto;
  margin-right: auto;
}