How to get rid of white space between css horizontal list items? [duplicate]
Tags: html,css,html-lists,navigationbar
Problem :
This question already has an answer here:
I've got the following test page and css. When displayed, there is a 4px gap between each list item. How do I get the items to be next to each other?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<link type="text/css" rel="stylesheet" href="/stylesheets/test.css" />
</head>
<body>
<div>
<ul class="nav">
<li class="nav"><a class="nav" href="#">One1</a></li>
<li class="nav"><a class="nav" href="#">Two</a></li>
<li class="nav"><a class="nav" href="#">Three</a></li>
<li class="nav"><a class="nav" href="#">Four</a></li>
</ul>
</div>
</body>
</html>
The css:
ul.nav, ul li.nav {
display: inline;
margin: 0px;
padding: 0px;
}
ul.nav {
list-style-type: none;
}
li.nav {
background-color: red;
}
a.nav {
background-color: green;
padding: 10px;
margin: 0px;
}
a:hover.nav {
background-color: gray;
}
Solution :
You need to use display:block
and float:left
on the li
s to remove the space. When they're inline the browser treats them as words, and so leaves space in between.
Also see my similar question.
CSS Howto..
I corrected this just by removing the filter line. My code is now: .arrow-left { width: 0; height: 0; border-top: 70px solid transparent; border-bottom: 70px solid transparent; position:absolute; top:-45px; left:-11px;...
Your problem is probably that you're using isset() incorrectly. As you have it right now, the first if statement will always raise an error. isset( $_POST['date_selected'] === "1d" ) Breaking...
Don't apply css to bootstrap classes if you do so, the whole bootstrap classes in your website will get that css, so i will recommend using a custom class or...
That date picker seems pretty standard fair. Dojo's picker (the one I am most familiar with) will handle it. The skinning will be the trickier part. Dojo has good theme...
This is the solution I found for my question: Filling space with Flexbox
To be honest i'm not really sure of what the problem is so i'll post here a snippet that try to reproduce what you currently have. Feel free to tell...
Simply set the font-size for the :before psuedo. Demo Fiddle p { counter-increment: myIndex; } p:before { content:counter(myIndex); font-size:30px; } ...
Add vertical-align: middle to styles of #my-image img: #my-row{ border:1px solid #ccc; border-width:1px 0; list-style:none; padding:0; text-align:center; background-color: white; } #my-row a{ display:inline-block; padding:10px; color: black;; text-decoration:none; } #my-image img...
Use a wrapper for your header and use the container after the header(for the nav, etc): .head-wrap{ width:100%; background:yourbackground; } header{ max-width:960px; yourstyles; } markup: <div class="head-wrap"> <header> </header> </div>...
You can use the cycle template tag: {% for result in results %} <span class="{% cycle "class-a" "class-b" "class-c" "class-d"%}" > {{result}} </span> <br> {% endfor %} ...
I tried to reproduce your image (without the exact dimensions). Check it out : .img-container { position: relative; width: 250px; height: 350px; -moz-border-radius: 20px; -webkit-border-radius: 20px; border-radius: 20px; overflow: hidden;...
#mast-logo is absolutely positioned. #mast-logo { background: url("http://grfx.cstv.com/schools/iowa/graphics/iowa-10-logo.png") no-repeat scroll 0 0 transparent; height: 133px; left: -13px; position: absolute; top: -4px; width: 198px; z-index: 200; } It is not really...
The syntax $(firstElement, secondElement) doesn't select both elements. It selects firstElement within secondElement, i.e. it's equivalent to $(secondElement).find(firstElement). If you want to combine multiple selectors, they need to be in...
I recommend using this so the function can be used with any element/Img you want later <img id="image" onmouseover="ImageHover(this);" src="source.png"/> function ImageHover(el){ el.classList.add("filter"); }; ...
Completely generic way to do this, that relies on no classes or ID's div ul:last-of-type li:last-child { display:none; } So basically, the div is the parent item that contains the...
you should try this : textview.setText(Html.fromHtml("<p font-color="blue">database content will be here in HTML format</p>")); ...
You are using margin: 0 5px; in #fdw-pricing-table .plan selector. Instead you can add bottom or top margin to have some space. Like so - #fdw-pricing-table .plan { margin: 10px...
You need js, at least to keep track of which is the current image and add a class that triggers the css transition. If I understand correctly, you've almost got...
Read about the built-in Bootstrap carousel control here: http://getbootstrap.com/javascript/#carousel. You should easily be able to fit it into your layout....
Try using a little bit of JavaScript magic (mark the oninvalid attribute): <input type="file" accept="image/*" oninvalid="setCustomValidity('Please, blah, blah, blah ')"/> ...
You can fake this effect by using very large borders: border-left: 20px solid white; border-right: 20px solid white; border-top: 20px solid #333; border-bottom: 20px solid #333; The trick is of...
img.expand { width: 10em; } <img src="http://keenthemes.com/preview/metronic/theme/assets/global/plugins/jcrop/demos/demo_files/image1.jpg" alt="fruit" class="expand" /> or img.expand { width: 50em; } <img...
For 1. CSS does not povide shadows or outlines for image pixell, only boxes (thus box-shadow). Preprocess icon images on the server side using a script + some image library....
See this thread -> How to make user controls know about css classes in ASP.NET
A key concept for building responsive layouts is Absolute Positioning Inside Relative Positioning. Chris Coyier has a great article here: http://css-tricks.com/absolute-positioning-inside-relative-positioning/. This concept allows you to position items absolutely inside...
Just add the same styling you have on the submenu items that have children to the parent level menu (that have children) li.menu-item-has-children, li.menu-item-has-children:hover{ background:url(http://s28.postimg.org/ilizrjzax/arrow_right.png) no-repeat 95% center; } I...
I suggest storing a comma delimited list of strings in a data attribute, then iterating through the images and filtering that way. For example: HTML <div id="backgrounds"> <img id="Hajar" data-tags="hoodie,zipper,green"...
First of all, maybe you should overthink how you generate your table, since you put everything in one row, and then split the single "rows" with <br />... but that's...
They use an image + css sliding door method: http://static01.linkedin.com/scds/common/u/img/bg/bg_sharepostmod_567x400.png You can achieve the same thing without an image by using CSS3 for the rounded corner and background gradient, plus...
Fiddle That's a bit tricky because of the table markup. Basically, you give the tr this css: position: relative; Then you position the title absolute to the top left and...