Reputation: 926
I would like to reproduce the following in the simplest way (probably using a <ul>
):
So, I would like to be able to add as many rows as I want to this list, each row being composed of a picture, a description and a counter. The list should be in a rounded box, and the rows should be separated with lines.
Could someone with CSS skills help me with this?
Thanks a lot!
Upvotes: 0
Views: 6716
Reputation: 1111
HTML:
<ul>
<li>Event</li>
<li>Journal</li>
<li>Task</li>
</ul>
CSS:
ul { -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; background:#3d3d3; border:1px solid gray; width:400px; }
ul li { padding: 5px 5px 5px 20px; border-top:1px solid gray; }
Here is the JsFiddle for that.
Upvotes: -1
Reputation: 5697
I'm working on a JSfiddle here for you.
HTML:
<ul>
<li><img src="http://ghickman.co.uk/images/sidebar/stackoverflow.png"/> <span>text</span> <span class="num">1</span></li>
<li><img src="http://ghickman.co.uk/images/sidebar/stackoverflow.png"/> <span>text</span> <span class="num">1</span></li>
<li><img src="http://ghickman.co.uk/images/sidebar/stackoverflow.png"/> <span>text</span> <span class="num">1</span></li>
</ul>
CSS:
ul {
border-radius:10px;
border:1px solid #DDD;
margin:10px;
width:200px;
}
li:last-child {
padding:7px;
}
li:not(:last-child) {
padding:7px;
border-bottom:1px solid #DDD;
}
span.num {
float:right;
}
img {
width:20px;
}
span {
float:none;
}
Upvotes: 1
Reputation: 101533
Well, here's one way of doing it.
HTML:
<ul>
<li>
<img src="http://www.placekitten.com/16/16">
Item 1
<span>1</span>
</li>
<!-- More list items -->
</ul>
CSS:
/* Container with border and rounded corners */
ul {
border: 1px solid #ccc;
width: 200px;
/* Border radius for Chrome, Webkit and other good browsers */
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
-border-radius: 10px;
border-radius: 10px;
}
/* Only add border to bottom of <li> */
li {
padding: 10px;
border-bottom: 1px solid #ccc;
}
/* Get rid of the last <li>'s bottom border to stop overlap with <ul>'s border */
/* :last-child works in IE7+ */
li:last-child {
border-bottom: none;
}
/* Get the number and float it right */
span {
float: right;
}
Upvotes: 4
Reputation: 7693
It does not seem like you even tried to google for "rounded corners" but anyway, you have 2 options:
background
propertyUpvotes: 0