简体   繁体   中英

css / html - remove space before li tag

I want to remove the space (marked as yellow) before the li tag and i don't know how.

I read other questions about this issue but it doesn't help me, I tried to add margin:0px

this is a screenshot that describes the problem:

在此处输入图片说明

<html dir="rtl">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">
<style type="text/css">

*
{
    font-size:13pt;
    font-family:Arial;
}

hr {
border:1px; Border-Style: solid; border-color: D8D8D8;
}

.menu ol,ul{list-style:none; }
.menu ul li{    display:block; }

.menu{
}
.menu a{
    background:#f9f9f9;
    border-bottom:1px solid #eee;
    display:block;
    padding:13px;
    color:#767676;
    font-size:12px;
}
.menu a:hover{
    background:#fff;
}
header .menu{
    border-top:1px solid #eee;
}
header .menu a{
    padding:15px 15px 15px 25px;
}
header .menu li:last-child a{
    border-bottom:none;
}


a:link, a:visited, a:active {color: #033254 } 
a:hover{color:E19E21} a{text-decoration:none}
</style>
<body bgcolor='#FDFDF7' leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">


            <ul class="menu">


<li><a href="eeee">aaaaaa</a></li>
<li><a href="eeee">aaaaaa</a></li>
<li><a href="eeee">aaaaaa</a></li>
<li><a href="eeee">aaaaaa</a></li>

</ul>       

set padding-right: 0; on your ul

.menu {
    padding-right: 0; 
}

Change

.menu{
}

to

.menu{
    padding: 0;
}

You just need to add padding:0 to your ul element:

ul.menu {
    padding: 0;
}

http://jsfiddle.net/W44ay/1/

Try using this reset css

/*limited reset*/
html, body, div, section, article, aside, header, hgroup, footer, nav, h1, h2, h3, h4, h5, h6, p, blockquote, address, time, span, em, strong, img, ol, ul, li, figure, canvas, video {
margin: 0;
padding: 0;
border: 0;
}

The spacing may, in general, be caused by default margin or padding settings on the ul element or on the li elements. To clear them all (as seems to be appropriate here), set

.menu, .menu li {
  margin: 0;
  padding: 0;
}

If eg some spacing is desired before or after the menu, set that separately after the above rule, eg .menu { margin-bottom: 1em } ,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM