【UI】 css li设置list-style:none依然占位置问题的解决

解决
第一种:
在部分IE浏览器下,当把li的“list-style-type”设置为“none”时,前面的·虽然没了,但是却依然空了一截,这时候只需要把“list-style-position”设置为“outside”即可,CSS按如下方法写:

#yourLiID {
	list-style-type:none;
	list-style-position:outside;
}

第二种:
li前边的小黑点用list-style none 去掉后还占空间呢 ,怎样才能不让他占空间
并不是li在占用空间,而是ul,尝试下面的代码

 ul{
     padding:0;
     /*margin:0;*/
 }
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
好的,以下是一个简单的基于CSS的网页模板。这个模板使用了Flexbox来进行布局,并使用了一些常见的CSS样式来美化页面。 HTML代码: ```html <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <title>网页模板</title> <link rel="stylesheet" href="style.css"> </head> <body> <header> <h1>网页模板</h1> <nav> <ul> <li><a href="#">主页</a></li> <li><a href="#">关于</a></li> <li><a href="#">联系我们</a></li> </ul> </nav> </header> <main> <section> <h2>欢迎来到我们的网站</h2> <p>这是一个基于CSS的网页模板,可以用来快速创建一个漂亮的网站。</p> <button>了解更多</button> </section> <section> <h2>我们的服务</h2> <ul> <li>网站开发</li> <li>移动应用开发</li> <li>UI设计</li> </ul> </section> <section> <h2>我们的团队</h2> <ul> <li><img src="https://via.placeholder.com/150" alt="团队成员1"></li> <li><img src="https://via.placeholder.com/150" alt="团队成员2"></li> <li><img src="https://via.placeholder.com/150" alt="团队成员3"></li> </ul> </section> </main> <footer> <p>© 2021 网页模板</p> </footer> </body> </html> ``` CSS代码: ```css /* 全局样式 */ * { box-sizing: border-box; margin: 0; padding: 0; } body { font-family: Arial, sans-serif; font-size: 16px; line-height: 1.5; } /* 页面结构 */ header { background-color: #333; color: #fff; display: flex; justify-content: space-between; align-items: center; padding: 1rem; } nav ul { list-style: none; display: flex; } nav li { margin-right: 1rem; } nav a { color: #fff; text-decoration: none; } main { display: flex; flex-direction: column; align-items: center; padding: 2rem; } section { margin-bottom: 2rem; text-align: center; } section h2 { font-size: 2rem; margin-bottom: 1rem; } section ul { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; margin-top: 1rem; } section li { margin-right: 1rem; } section img { width: 150px; height: 150px; object-fit: cover; border-radius: 50%; } button { background-color: #333; color: #fff; border: none; padding: 0.5rem 1rem; margin-top: 1rem; cursor: pointer; } button:hover { background-color: #666; } footer { background-color: #333; color: #fff; text-align: center; padding: 1rem; } ``` 这个模板使用了典型的HTML结构,包括一个头部、主要内容区域和一个底部。CSS样式使用了Flexbox来实现响应式布局,并使用了一些常见的样式,如颜色、字体大小、边距和背景色等来美化页面。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

fruge365

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值