html - 如何仅使用 html 和 css(不使用 Bootstrap )设计一个简单的 ListView (如 Android)

标签 html css listview

我想设计一个 Listview,就像 Android 一样,只使用 Html 和 css,而不使用 bootstrap。我试过使用 Ul 和 li,但在这唯一的子弹来了。

<ul>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>

我想要像下图这样的 Listview。 enter image description here 谁能建议我如何实现这一目标。

最佳答案

ul{
width:200px;
background:gray;
color:white;
list-style-type:none;
margin:0;
padding:0;
}
li{
border:2px solid black;
padding:5px;
}
li:last-child{
border-bottom:none;
}
li:hover{
background:red;
color:black;
}
<ul>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>

关于html - 如何仅使用 html 和 css(不使用 Bootstrap )设计一个简单的 ListView (如 Android),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47732566/

相关文章:

HTML 表 CSS?

javascript - 无论浏览器如何,复制文本区域文本

html - 具有 flex 相邻div的居中灵活div

c# - 嵌套 ListView 中的 SelectedItems

html - 移动鼠标后 CSS/HTML 下拉菜单消失

css - thickbox messege alert css change

css - 如何让渐变在 CSS3 线性渐变中停止?

android - 带有水平包裹的 textViews 的 ListView 动态填充

android - 带有 Android 部分的 SimpleCursorAdapter

javascript - 已发布的 Google 文档的 iframe 链接