gpt4 book ai didi

CSS 背景放置

转载 作者:行者123 更新时间:2023-11-28 04:38:02 25 4
gpt4 key购买 nike

.container {
width: 800 px;
margin: 0 auto;
}
#main {
background: url(images/header_slice.jpg) repeat-x;
}
#main.container {
background: url(images/header.jpg) no-repeat;
}
#sidebar {
float: left;
}
#sidebar h3 {
font-size: 24px;
color: #044055;
font-weight: normal;
}
#sidebar ul li a {
font-size: 14px;
color: #393838;
}
ul#subscribe li a {
font-size: 18px;
padding-left: 30px;
}
#sidebar ul {
list-style: none;
}
#sidebar {
float: left;
margin-left: 155px;
margin-top: 35px;
background: #d4d6d3;
border: 1px solid #BEBDBD;
padding: 15px 15px 30px 30px;
}
#sidebar h3 {
font-size: 24px;
color: #044055;
font-weight: normal;
padding-bottom: 20px;
padding-left: 15px;
}
#sidebar ul {
list-style: none;
padding-bottom: 25px;
}
#sidebar ul li a {
font-size: 14px;
color: #393838;
}
ul#subscribe li {
padding-bottom: 5px;
}
ul#subscribe li a {
font-size: 16px;
padding-left: 40px;
}
ul#subscribe li {
padding-bottom: 5px;
padding-left: 35px;
}
li#rss {
background: url(images/rss_icon.png) no-repeat;
background-size: 20px;
}
li#email {
background: url(images/email_icon.png) no-repeat;
background-size: 20px;
}
li#twitter {
background: url(images/twitter_icon.png) no-repeat;
background-size: 20px;
}

我正在学习如何制作一个基本网站:https://code.tutsplus.com/tutorials/design-and-code-your-first-website-in-easy-to-understand-steps--net-6062容器的标题背景未加载。

enter image description here

侧边栏图标也被文本覆盖。我尝试在侧边栏 anchor 中添加填充,但没有用。我做错了什么?

最佳答案

拳头在您的图标左侧有一些填充,因此您的文本不会与它重叠,然后对于背景来说,它应该出现在左侧,垂直居中。我展示了如何在 Twitter 上使用 li

li#twitter {
padding-left: 66px;
background: url(your-icon-path.png) no-repeat left center;
}

这里我假设您的图标大小为 50 像素,并且我为该图标的左侧填充添加了 16 像素,这样您的图标就不会被您的内容覆盖。

如果你想看一下我之前给别人的答案Link

关于CSS 背景放置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41373961/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com