html structure:
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
css:
li{
border-bottom:1px solid -sharpddd;
}
requirements: do not use the selector in css3, compatible with ie8.
html structure:
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
css:
li{
border-bottom:1px solid -sharpddd;
}
requirements: do not use the selector in css3, compatible with ie8.
can I add class to li? If so, you can use a class fit! important attribute to modify.
li {
border-bottom:1px solid-sharpddd;
}
.lastLi {
border-bottom:none!important;
}
do not use css3, but also be compatible with ie8,. If the quantity is determined, add a class, to the last li and then set {border:0;}. If you are not sure, you can only use js to solve the problem. Jq is also relatively simple:
$('ul li:last').css('border','0');
change your way of thinking. Use the +
neighbor selector. Compatible with IE7+
. Recommend an article: 30 CSS selectors you must remember
<style>
li + li{
border-top: 1px solid -sharpddd;
}
</style>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
to get to the point, it should be like this:
li{
border-bottom:1px solid -sharpddd;
}
li:last-child{
border-bottom:none;
}
however, according to the actual needs, the following approach is recommended:
li + li{
border-top:1px solid -sharpddd;
}
li is a fixed number
li+li{
border-top:1px solid -sharpddd;
}
if li is created dynamically
li{
border-bottom:1px solid -sharpddd;
}
li+li:last-child{
border-bottom:0;
}
Previous: Is there a problem with python nesting two for loops?
Next: What is the most efficient serialization and deserialization library in Python
how to make div1 and div2 increase with the height of div3 when div3 has two div3 in div2 and div3 when there is a div3? <!DOCTYPE html> <html> <head> <title>< title> <style type="text css"> *{m...
is there any way to prevent the child element from being compressed when the parent element reduces the width when the child element is not set to fix width and height (stretched by padding)? setting height and width: I am a child element No high w...