0

我有以下 HAML 代码

//haml code for template
.activities_section
  %ul.row_one
    %li
      %a{href: "#"} lol
    %li
      %a{href: "#"} watched a movie
    %li
      %a{href: "#"} read a book
    %li
      %a{href: "#"} happy
    %li
      %a{href: "#"} sad

//CSS for section
.activities_section {
  width: 220px;
  height: 176px;
  border-left:$base_border;
  border-right:$base_border;
  border-bottom:$base_border;
  border-top:$base_border;
  background: $light_background_color;
  ul {
    list-style: none;
    display: block;
    padding: 0;
    margin: 0;
    li {
      padding: 5px;
      font-size: 0.8em;
      // text-align: center;
    }
  }
}


//How it looks like currently

在此处输入图像描述

//How I want it to look like

在此处输入图像描述

如何更新我的 css 以使列表处于最后一张图片中看到的“块样式”?

4

3 回答 3

2
li {
      padding: 5px;
      font-size: 0.8em;
      text-align: center;
      border-radius: 6px;
      background: #ccc;
      display: inline-block;
}
于 2012-06-12T05:35:57.020 回答
2

我想你需要这样

http://jsfiddle.net/miqdad/uwLK7/

于 2012-06-12T05:48:20.283 回答
1

试试这个:

ul li {
  padding: 3px 4px;
  font-size: 0.8em;
  text-align: center;
  border-radius: 8px;
  display: inline-block;
  color: blue;
  background-color: #ededed;
}
于 2012-06-12T05:44:16.987 回答