CSS - Tight Lists
On my website, the left nav. bar is made using a list.
The list has a border round top, bottom, right & left, and has a blue hover colour. The list however, does not display tight up against each other, and takes a line between each list item. I'd like it to be right above and below one another rather than a gap in between. You can view the list on the site, HERE. The CSS for the nav. bar is: Code: /*-----LEFT MENU-----*/ #leftcontent { width: 120px; } #leftcontent ul { margin-left: 8px; padding-left: 0; list-style-type: none; font-family: Arial, Helvetica, sans-serif; } #leftcontent a { padding: 0px; padding-left: 2px; padding-top: 1px; padding-bottom: 1px; background-color: #fff; border: 1px solid #ccc; text-decoration: none; display:block; } #leftcontent img { display:inline; padding:0; border:0; margin:0; } #leftcontent a:link, #navlist { color: #000; text-decoration: none; } #leftcontent a:visited { color: #000; } #leftcontent a { color: #000000; } #leftcontent a:hover { background-color: #369; display:block; color: #fff; } #leftcontent img a:hover{ display:inline; padding:0; border:0; margin:0; } /*----END LEFT MENU----*/ Note: The img hover, bg colour etc. is so it does not use the same properties as when I open the page up in my content management system it uses small icons, which would use the list properties if I did not define it as an image. Please just ignore it. Cheers. Similar TutorialsI'm having problems with keeping the border of an div tight in against the div's content. At the following URL http://alphaworks.co.uk/problems/box/ I want the next and prev divs to be a little larger than the text inside them and then the outer prev_next div should be a little bigger than the two divs inside it but not stretching to the width of the page as it does now. Can someone show me the error of my ways? Thanks, Geoff Ok here is the problem I have... I have 3 DIVS.... DIV 1 is a container the centers the contents DIV 2 I want to wrap tight around an image DIV 3 I want floating over the image say 100px from the top of DIV2 and 80px left. Currently DIV 2 is as wide as it's container (DIV1). and therefore DIV 3 isn't positioned over the correct part of the image. If I made DIV 2's position absolute then DIV 2 wraps the image tightly and correctly, but it now is shown on the far left of DIV 1, and I want it in the center. here is the HTML i have... <div id="div1" align="center"> <div id="div2"> <img alt="fddsffsd" src="image.jpg"/> <div class='div3'></div> </div> and here is my CSS... #div2 {position: relative} .div3 { position:absolute; width: 80px; height: 80px; top: 100px; left:20px; background-image: url(transparent.png); } http://jordanmeeter.com/?page=resources Okay... WTF is that about? I added another article to the "Articles" list... And it moved the section below it down. My CSS for #noindent : Code: .noindent { float: left; width: 200px; margin-left: 0px; margin-top: 5px; padding-left: 0px; list-style-type: none; } I want to have a list that each listed item has a different image, how can i do this. Thanks Does anyone know how I can fix the gaps on this block level lists? It looks fine on firefox and other browsers but ie6 and ie7 add gaps in between the lists. http://section31.us/study/html/temp...lists_on_ie.php Hi... How do I break a single list into multiple columns? The page I'm talking about is http://jordanmeeter.com/?page=links. I'd like to bring the "Other" category up over to the right, next to the rest of the categories. I tried Code: float: left; width: 200px; And that kind of did what I want... Not really, though. Hey guys I just coded this list which has sub entries in it as well. It looks fine and works great in FireFox. However, when viewed in IE7 something is different. I am not sure if it isn't the normality, I just know it isn't what I want. I've attached and image of what the problem is, left side is IE and right side is FF. The code I'm using is simply Code: <ul> <li>Main</li> <ul> <li>Sub</li> </ul> </ul> Thanks Hey i am trying to create a navigation bar that uses hover lists so that there are a number of links and when these are hovered over, the provide links which are under this section. I have sourced code and used this and it all works apart from that the hovered options are about 0.8cm apart and the first is over the top of the original list, which still needs to be seen. The code for the CSS is below; #navmenu{ width: 100%; float: left; background: #900; height: 100%; } #navmenu ul{ list-style: none; margin: 0; padding: 0; width: 120px; float: left; } #navmenu li{ margin: 3px 0px 3px 0px; padding: 3px 0px 3px 0px; display: inline } #navmenu a{ font: bold 15px Calibri; display: block; border-width:1px; border-style:solid; border-color:#F90; margin: 0; padding: 2px 3px; color: #FC0; background: #900; text-decoration:none; } #navmenu a:hover{ color:#FFF; background:#C30; } #navmenu li { position:relative; } #navmenu ul ul { position:absolute; top: 0; left: 100%; } div#navmenu ul ul{ display: none; } div#navmenu ul li:hover ul {display: block;} div#menu ul ul, div#menu ul li:hover ul ul, div#menu ul ul li:hover ul ul {display: none;} div#menu ul li:hover ul, div#menu ul ul li:hover ul, div#menu ul ul ul li:hover ul {display: block;} body { behavior: url(csshover.htc); } [if IE]> <style type="text/css" media="screen"> body { behavior: url(csshover.htc); font-size: 100%; } #menu ul li {float: left; width: 100%;} #menu ul li a {height: 1%;} #menu a { font: bold 0.7em/1.4em arial, helvetica, sans-serif; } </style> <![endif] and the code for the section of the webpage (btw it is linked in the header) <div id="navmenu"> <ul> <li><a href="index.html" title="Home">Home</a></li> </ul> <ul> <li><a href="products.html" title="Products">Products</a> <ul> <li><a href="rubber.html" title="Rubber">Rubber</a></li> <li><a href="struts.html" title="Struts">Struts</a></li> <li><a href="hardware.html" title="Hardware">Hardware</a></li> </ul> </li> </ul> </div> Thanks help would be appreciated. On the site I am starting, I am following the suckerfish style of using a ul/li menu. That works fine. A little position difference I have to figure out between IE and the real browsers but it does work. Problem I run into is when one of my pages includes a ul in the content. Using the css as is, that ul in content is displaying incorrectly. It should just go down the page but instead goes across the page. In the stylesheet, I tried making two li's, li.menu and li.info. That broke the menu but the content list worked. I tried adding .menu to various other components in the css but couldn't get both to work. I use php to include the code for the menu so I don't have to go to each page if I want to make a change. Could someone give me a hand on making two the two li's work from a style sheet so that both the menu and the content work on that page. Here are the pages. The web page: http://www.cacct.com/new/faq.php The stylesheet: http://www.cacct.com/new/css/sitestyle.css The menu code: http://www.cacct.com/new/php/menu.html This is the first page I built using other methods before changing to stylesheets: You can see what the content should look like. http://www.cacct.com/new/faq.html Thanks tk Hello! I've got a funky IE issue. I'm using IE9 with the compatibility view turned on for this one website. I've got a <ul> lists with hover states. It's acting odd. If I drag my mouse down from the top of the link, the hover state triggers. If I come from the bottom of the link, it doesn't. Do you think this has to do with a transparent PNG? Really appreciate any words of wisdom on this subject. Hi: The return key works fine in HTML lists (for example those in Outlook editor). However, in normal HTML, the return key double spaces inappropriately outside of lists (and between lists, too). Outside of lists, Outlook replaces <p> with <br> to get wordprocessor-like action from the return key, but this doesn't isolate the "new" line/paragragh from the preceeding text, like <p> does. So, attempts to format the "new" paragraph affects the "previous" paragraph. Is there any way to have <p> behave differently inside and outside of lists (maybe making the double-spaced lines half the usual height, or some other approach? Thanks, Terry Hi, can anyone give me a hand with customizing my lists? I am trying to do something like here, http://www.microsoft.com/, but with a semi-transparent background in the nav bar. It works if I have borders around the links, which is fine if I had a solid bg as I can hide them, but being semi-transparent I have a problem, and when I remove them it causes a shift when moving over a link. Any ideas?? http://jordanmeeter.com/new/links.php If you view that page in Firefox, it displays how it is supposed to. But if you view the page in Internet Explorer, you can see that it is severely ****ed up! Any suggestions? Thanks, Jordan hello guys !!! i am using list in a website. i am using list-style-image property to set the image for lists, like Code: list-style-image:url(img/bluestar.png); problem is that the spacing between two list items is too much, how to reduce that ??? Hi, I have a simple question. Is it possible to display and hide a list if i click on a link using CSS? I'm not looking to change pages or anything. I know it can be done using Javascript but I would rather not use it. I've done a few searches for hiding lists in CSS but to no avail. Thanks, To make this easier on everyone, I've turned my idea into an image, so please see the image I attached. I'm absolutely horrible with CSS, so I just need some help with converting that image into CSS/HTML. I'm hoping to have each box an unordered list, so they are still organized nicely even if someone has CSS disabled. Thanks. Question? Okay I know IE for some reason defaults with a left-padding or something for an unordered list. so when I set padding:0 for my unordered list everything is great in firefox. But when I look at it in IE the list-style elements are pulled off of the list object. How can I place no padding on the list and still use the list-symbols in IE? The thought of placing my own list object in the background, but it would be silly if I could just use the disc built into windows ie. thanks! Hi, I'm trying to build a simple menu for a layout in XHTML/CSS. I was thinking about having a list and then giving it a style, such as: Code: <ul class="menu"> <li id="menu_home">Home</li> <li id="menu_about">About Us</li> <li id="menu_contact">Contact Us</li> </ul> But then I would like the CSS to display the "li" items horizontally rather than vertically, and without bullets. Also, having the "Home", "About Us", etc, text replaced with images (CSS). Can this be done? I would really appreciate any guidance with this or any other ideas. Thanks, Ralph I have a couple of nav lists that I'm trying to position. For the first part, in FF the top list (home|site map|help) is not positioning at the top of my div. I want it aligned at the top with no margin or padding so it's flush. I have included a link which shows an image of how I want it to look. The site is APOD The way I want it to look is HERE The CSS is : Code: #hright { width: 240px; height: 66px; float: right; text-align: right; padding-top: 0; } #hright ul { list-style: none; } #hright ul li { display: inline; } HTML Code: <div id="hright"><ul><li><img src="images/apod_new_04.gif" alt="home" title="home"/></li><li><img src="images/apod_new_05.gif" alt="site map" title="site map"/></li><li><img src="images/apod_new_06.gif" alt="help" title="help"/></li></ul> </div> The second issue arises in IE. I have another horizontal list, that I want to appear on the same line. In FF it's behaving properly, but in IE it's not. The CSS is: Code: #hnav { width: 740px; height: 29px; clear: both; background-color: #FFFFFF; padding: 0; text-align: left; } #hnav ul { list-style: none; padding: 0; text-align: left; } #hnav ul li { display: inline; padding: 0; text-align: left; } The HTML is: Code: <div id="hnav"><ul><li><img src="images/apod_new_08.gif" alt="About Us" title="About Us"/></li><li><img src="images/apod_new_09.gif" alt="News" title="News"/></li><li><img src="images/apod_new_10.gif" alt="High School" title="High School"/></li><li><img src="images/apod_new_11.gif" alt="College" title="College"/></li><li><img src="images/apod_new_12.gif" alt="Contact Us" title="Contact Us"/></li></ul></div> There's probably a better way to do this than I'm trying and I'm open to any suggestions. |