如何在我的CSS中使字体令人敬畏的图标更大?
我试图使用字体大小:45px;
使字体很棒的图标更大,但似乎在我的网站上不起作用。这是相关的 css ,并且与一个工作示例进行了比较:
我的CSS:
{
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: 'poppins', sans-serif;
}
.topbar{
position: fixed;
background: #fff;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.08);
width: 100%;
height: 60px;
padding: 0 20px;
display: grid;
grid-template-columns: 2fr 10fr 0.4fr 1fr;
align-items: center;
z-index: 1;
}
.logo h2{
color: #d34d4d;
}
.search{
position: relative;
width: 60%;
justify-self: center;
}
.search input{
width: 100%;
height: 40px;
padding: 0 40px;
font-size: 16px;
outline: none;
border: none;
border-radius: 10px;
background: #f5f5f5;
}
.search >label {
position: absolute;
right: 15px;
top: 50%;
transform: translateY(-50%);
}
.user{
position: relative;
width: 50px;
height: 50px;
}
.user img{
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
object-fit: cover;
}
/* sidebar starts here */
.sidebar{
position: fixed;
top: 60px;
width: 260px;
height: calc(100% - 60px);
background: #e26666;
overflow-x: hidden;
}
.sidebar ul {
margin-top: 20px;
}
.sidebar ul li{
width: 100%;
list-style: none;
}
.sidebar ul li a {
width: 100%;
text-decoration: none;
color: rgb(255, 255, 255);
height: 60px;
display: flex;
padding-left: 30px;
justify-content: flex-start;
align-items: center
}
.sidebar ul li a i {
min-width: 60px;
font-size: 24px;
text-align: center;
align-self: flex-start;
}
.sidebar ul li a svg{
margin-right: 15px;
width: 25px !important;
}
/* main section starts here*/
.main {
position: absolute;
top: 60px;
width: calc(100% - 260px);
left: 260px;
min-height: calc(100vh - 60px);
background: #f3f3f3;
}
.cards{
width: 100%;
padding: 35px 20px;
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 20px;
}
.cards .card{
padding: 20px;
display: flex;
align-items: center;
justify-content: space-between;
background: #fff;
border-radius: 10px;
box-shadow: 0 7px 25px 0 rgb(0, 0, 0, 0.08);
}
.number{
font-size: 35px;
font-weight: 500;
color: #e26666;
}
.card-name{
color: #888;
font-weight: 600;
}
.icon-box i {
font-size: 45px;
color: #e26666;
}
屏幕截图:
工作示例(图标调整):
我的网站(未调整的图标):
< img src =“ https://i.sstatic.net/rge79.png” alt =“我的网站”>
任何人都可以帮助我找出为什么我的图标不响应font-size < /代码>?
I'm trying to make Font Awesome icons bigger using font-size: 45px;
but it doesn't seem to work on my website. Here's the relevant CSS and a comparison with a working example:
My CSS:
{
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: 'poppins', sans-serif;
}
.topbar{
position: fixed;
background: #fff;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.08);
width: 100%;
height: 60px;
padding: 0 20px;
display: grid;
grid-template-columns: 2fr 10fr 0.4fr 1fr;
align-items: center;
z-index: 1;
}
.logo h2{
color: #d34d4d;
}
.search{
position: relative;
width: 60%;
justify-self: center;
}
.search input{
width: 100%;
height: 40px;
padding: 0 40px;
font-size: 16px;
outline: none;
border: none;
border-radius: 10px;
background: #f5f5f5;
}
.search >label {
position: absolute;
right: 15px;
top: 50%;
transform: translateY(-50%);
}
.user{
position: relative;
width: 50px;
height: 50px;
}
.user img{
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
object-fit: cover;
}
/* sidebar starts here */
.sidebar{
position: fixed;
top: 60px;
width: 260px;
height: calc(100% - 60px);
background: #e26666;
overflow-x: hidden;
}
.sidebar ul {
margin-top: 20px;
}
.sidebar ul li{
width: 100%;
list-style: none;
}
.sidebar ul li a {
width: 100%;
text-decoration: none;
color: rgb(255, 255, 255);
height: 60px;
display: flex;
padding-left: 30px;
justify-content: flex-start;
align-items: center
}
.sidebar ul li a i {
min-width: 60px;
font-size: 24px;
text-align: center;
align-self: flex-start;
}
.sidebar ul li a svg{
margin-right: 15px;
width: 25px !important;
}
/* main section starts here*/
.main {
position: absolute;
top: 60px;
width: calc(100% - 260px);
left: 260px;
min-height: calc(100vh - 60px);
background: #f3f3f3;
}
.cards{
width: 100%;
padding: 35px 20px;
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 20px;
}
.cards .card{
padding: 20px;
display: flex;
align-items: center;
justify-content: space-between;
background: #fff;
border-radius: 10px;
box-shadow: 0 7px 25px 0 rgb(0, 0, 0, 0.08);
}
.number{
font-size: 35px;
font-weight: 500;
color: #e26666;
}
.card-name{
color: #888;
font-weight: 600;
}
.icon-box i {
font-size: 45px;
color: #e26666;
}
Screenshots:
Working Example (icons resizing):
My Website (icons not resizing):
Can anyone help me figure out why my icons aren't responding to font-size
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
改变您的风格:
change your style like this: