水平无序列表前面的间隙
Gap infront of horizontal unordered list
我想用 fullpage.js 为自己创建一个网站,但我 运行 在某些元素上遇到了一些麻烦。我有这个无序列表,我想将列表居中,以便项目居中。我已经尝试了一切,但没有任何效果。我有一个居中的浮动 div 并且列表稍微向右推。这是代码:
.homepage-block{
display: table;
background-color: green;
margin: 0 auto;
}
#icons{
list-style-type: none;
display: flex;
background-color: red;
justify-content: center;
}
li{
margin: 0 10px;
}
.fab{
font-size: 2rem;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Danijel Tomić - Portfolio</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/3.0.8/fullpage.min.css" integrity="sha256-+dIh4jG2jQTHZwW81yUo8h6tzXWcNumyNL5XPZbwp1E=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<script src="https://kit.fontawesome.com/8d59324b96.js" crossorigin="anonymous"></script>
</head>
<body>
<div id="fullPage">
<div class="section s1 bg-primary">
<div class="homepage-block">
<h1>Danijel</h1>
<hr>
<ul id="icons">
<li><i class="fab fa-github"></i></li>
<li><i class="fab fa-linkedin"></i></li>
<li><i class="fab fa-twitter"></i></li>
</ul>
</div>
</div>
<div class="section s2">
<h1>hello</h1>
<hr>
</div>
<div class="section s3">
<h1>hello</h1>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/3.0.8/fullpage.min.js"></script>
<script>
new fullpage('#fullPage', {
autoScrolling: true,
navigation: true,
navigationTooltips: ['Home', 'Projects', 'Contact'],
anchors: ['section1', 'section2', 'seciton3'],
showActiveTooltip: true,
})
</script>
</body>
</html>
与 一样,默认情况下 UL 元素具有 padding-left: 40px
,但是在 chrome 中它们的默认样式表中也具有 padding-inline-start: 40px;
。
这对两者都适用:
ul, ol {
padding-left: 0;
padding-inline-start: 0;
}
我想用 fullpage.js 为自己创建一个网站,但我 运行 在某些元素上遇到了一些麻烦。我有这个无序列表,我想将列表居中,以便项目居中。我已经尝试了一切,但没有任何效果。我有一个居中的浮动 div 并且列表稍微向右推。这是代码:
.homepage-block{
display: table;
background-color: green;
margin: 0 auto;
}
#icons{
list-style-type: none;
display: flex;
background-color: red;
justify-content: center;
}
li{
margin: 0 10px;
}
.fab{
font-size: 2rem;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Danijel Tomić - Portfolio</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/3.0.8/fullpage.min.css" integrity="sha256-+dIh4jG2jQTHZwW81yUo8h6tzXWcNumyNL5XPZbwp1E=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<script src="https://kit.fontawesome.com/8d59324b96.js" crossorigin="anonymous"></script>
</head>
<body>
<div id="fullPage">
<div class="section s1 bg-primary">
<div class="homepage-block">
<h1>Danijel</h1>
<hr>
<ul id="icons">
<li><i class="fab fa-github"></i></li>
<li><i class="fab fa-linkedin"></i></li>
<li><i class="fab fa-twitter"></i></li>
</ul>
</div>
</div>
<div class="section s2">
<h1>hello</h1>
<hr>
</div>
<div class="section s3">
<h1>hello</h1>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/3.0.8/fullpage.min.js"></script>
<script>
new fullpage('#fullPage', {
autoScrolling: true,
navigation: true,
navigationTooltips: ['Home', 'Projects', 'Contact'],
anchors: ['section1', 'section2', 'seciton3'],
showActiveTooltip: true,
})
</script>
</body>
</html>
与 padding-left: 40px
,但是在 chrome 中它们的默认样式表中也具有 padding-inline-start: 40px;
。
这对两者都适用:
ul, ol {
padding-left: 0;
padding-inline-start: 0;
}