CSS - How Can I Align List Items Horizontally
hello!
i'm trying to line up some text in my unordered list but haven't been able to figure out the CSS to make it look something like this: Code: Accomplishments: Job title some job here another job yet another job Duties Designed company website. Proofread advertisements Code: <div id="resume"> <h4>Accomplishments</h4> <ul> <li>Job title</li> <ul> <li>some job here</li> <li>another job</li> <li>yet another job</li> </ul> <li>Duties:</li> <ul> <li>Designed company website.</li> <li>Proofread advertisements</li> </ul> </ul> </div> so i tried doing stuff like Code: div#resume ul li ul { position:absolute; top:-20px; left:50px; } div#resume ul li ul li{ float:none position:relative; } i can't get the words, "Job title" to line up horizontally with the first list item, then have the list items listed vertically like in my example up top (i know it doesn't line up perfectly in here) can someone correct my css?? thanks! drGiggles Similar TutorialsHi, I have a list of items, but when one item goes onto the next line, It doesn't align with the text above it. Here is an example. Look at the right hand column, and notice how the list items, when they go into 2 lines, the second line aligns with the bullet point and not the text. Anyone know how to fix this? thanks I have a list, Each item has a graphic as a background image, so each li is 60px high Some of the text is long and wraps Some of the text remains on one line This means the the spacing is not consistent and looks a little odd I've tried Code: ul#myListId li { vertical-align:middle; } and Code: ul#myListId li * { vertical-align:middle; } This has no effect in any of the browsers I am trying to make to div tags enclosed inside another div tag align horizontally. I am trying to do this without absolute positioning. See image below Any ideas? Thank you. I'm hoping I can get a bit of help addressing the display of an unordered list. I'm trying to view the list horizontally, and not vertically. Here is the code, and thanks in advance. CSS -------------------------------- #pages { margin-top: 12px; float: right; margin-right: 125px; font: normal 14px "Century Gothic","Trebuchet MS",Arial,Helvetica,sans-serif; color: #000; } #pages ul { list-style-type: none; margin: 0; padding: .5em 0; display: inline; } #pages li a { display: block; width: 1.5em; height: 1.5em; padding: 0; text-align: center; vertical-align: text-middle; text-decoration: none; } #pages a:link, #pages a:visited { margin: 0 10px 0 10px; text-decoration: none; color: #000; } #pages a:link#pagescurrent, #pages a:visited#pagescurrent { border-bottom: 1px solid #000; background: transparent; color: #000; } #pages a:hover { background-color: #949494; color: #fff; } HTML -------------------------- <div id="pages"> <ul> <li><a href="#" id="pagescurrent" title="next slide">1</a></li> <li><a href="#" title="next slide">2</a></li> <li><a href="#" title="next slide">3</a></li> <li><a href="#" title="next slide">4</a></li> </ul> </div> Hi, I have an OL list (the numbered one) and the horz gap between the list item number (as automatically generated by OL) and the text of the LI is too big (according to client). Looks fine in FF but is bigger alright on IE (ahem naturally .....) I've played with the CSS for both the OL & LI styles even setting all margins and paddings to 0 but without effect on the gap. Is there any way to style that gap? Code below. Kevin <ol class="most_read"> <li class="most_read_li">Apples</li> <li class="most_read_li">Oranges</li> </ol> .most_read { text-align:left; color:#808080; font-size:10px; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight:normal; margin-left:30px; padding:0px; margin-top:5px; } .most_read_li { margin-bottom:7px; margin-right:7px; } whats the CSS for creating an unordered list that goes across the page rather than down with no bullet points? I've tried the popular tricks to figure this out, but don't seem to have the touch. In IE, the list item is 2px taller than in FF. page: URL Removed CSS: Code: .mainNav ul {margin: 0; padding: 0; list-style: none;} .mainNav ul li {border-top: 1px solid #27466c; border-bottom: 1px solid #021940; background: url('../images/menu_bg.gif') top left repeat-y; display: block;} .mainNav ul a, .mainNav ul span {display: block; height: 17px; padding-top: 4px; font: 11px Verdana,Sans-Serif; color: #ffffff;} .mainNav ul a:link, .mainNav ul a:visited {text-decoration: none;} .mainNav ul a:hover{text-decoration: none; color: #9fb3cb;} .mainNav ul ul ul a:hover, .mainNav ul ul ul ul a:hover {text-decoration: none; color: #3e5064;} .mainNav ul ul li {border: 0; background: url('../images/sub_menu_bg.gif') top left repeat; border-top: 1px solid #627996;} .mainNav ul ul ul li {border: 0; background: url('../images/sub_sub_menu_bg.gif') top left repeat; border-top: 1px solid #627996;} .mainNav ul ul ul ul li {border: 0; background: url('../images/sub_sub_sub_menu_bg.gif') top left repeat; border-top: 1px solid #627996;} .unselected, .selected, .empty {display: block; float: left; height: 21px; width: 22px;} .currentPage {border-right: 4px solid #000530; margin-right: 1px;} HTML on page (it's quite heavy) Hi Guys, I am trying to incorporate a CSS file into an xml document.I have the following problem. My XML file is: <!-- example of an list item --> <?xml-stylesheet type="text/css" href="styledocument.css" ?> <document> <employee> <firstname>peter</firstname> <lastname>lance</lastname> </employee> </document> My corresponding styledocument css file is : employee {display:list-item;color:red;} firstname {display:inline;} lastname {display:inline;} --- Output in IE5: peter lance ----- The expected output should be peter and lance as list items with bullets preceding them and in red color. But my output is peter lance in just red color without any bullets. List-item value of the display attribute is not recognised at all. Can u help deal with this problem!!! We have a list of items that are not lining up under each other. The list of items is under a class 'item-list', each individual item that is in the list is listed as an instance of the same class ''view-item view-item-RecentReviewSummary'. Each list item consists of a title (a link), a small photo to the left with labels/text wrapping around the photo on the right. It happen when the page is wide (different monitors, resolutions etc) and in cases where the text wraps under it's photo (ie long enough text to require an extra line under the photo). We were trying to use display: block, margins and positions to fix this. any ideas? Thank you. Some HTML/CSS following HTML for first list item: <div class="item-list"> <ul> <li> <div class='view-item view-item-RecentReviewSummary'> <div class='view-field view-data-node_title'><a href="/millennium_park_lake_shore_walk">Millennium Park/Lake Shore Walk</a> </div> <div class='view-field view-data-node_data_field_small_image_field_small_image_fid'><img src="(URL address blocked: See forum rules)/files/ac_millennium_park_small.jpg" alt="Millenium Park" title="Millenium Park in the heart of Chicago" width="150" height="150" /> </div> <div class='view-label view-label-node_data_field_reviewer_rating_field_reviewer_rating_value'>AC Rating </div> <div class='view-field view-data-node_data_field_reviewer_rating_field_reviewer_rating_value'>3 </div> <div class='view-label view-label-node_data_field_description_field_description_value'>Summary </div> <div class='view-field view-data-node_data_field_description_field_description_value'>Check out the amazing "Cloud Gate" sculpture at Millennium Park and then walk across Lake Shore Drive, Stroll along the Lake and then circle back through Grant Park toward Buckingham Fountain. This trip can be made easily with a wheelchair if your attendant likes to hike, however, the roughly two mile stroll may be a lot if you are on your own. Start by parking your car in the Grant Park North Parking Garage. </div> </div> </li><li> CSS: (each list item is a link, fields/labels and an image) #view-label {} .view-label-node_data_field_reviewer_rating_field_reviewer_rating_value { /* AC Rating label */ float: left; padding: 0 5px 0 0; color: #369; font-weight: bold; text-decoration: italicize } .view-label-node_data_field_description_field_description_value { /* Summary label */ color: 369; font-weight: bold; width: 350px; padding: 4px 5px 0 0; } #view-field {} .view-data-node_title { /* attraction title value */ We thought putting code here would fix but didn't.... } .view-data-node_data_field_reviewer_rating_field_reviewer_rating_value { /* rating nbr */ position: relative; top; float right; background: url('fourstars.gif') no-repeat top left; padding: 0 0 0 10px; } .view-data-node_data_field_description_field_description_value { /* summary text */ margin-bottom: 15px; font-size:.8em; } .view-data-node_data_field_small_image_field_small_image_fid { /* image */ float: left; margin-right: 5px; I have an unordered list of 4 items that I have styling to be a horizontal navigation. I have set the css of the li to have a width of 25%. This works fine when the screen is full width but as I scale the browser to have a smaller width the text inside the li wrap - as to be expected. My question is, is there a way of ensuring that all 4 li's have the same height even when the content is of different lengths (thus some of the li's content do not wrap). Also can this be done purely in CSS without the use of Jquery? Thanks in advance At h**p://www.topofferspage.com in IE6, the bullet points do not have images appearing unlike Firefox. Before anyone says it's because of validation errors, it's not. I can turn off the offending stylesheets just fine and I get the same problem. Little help? Why would background images not work in IE6 but every other browser? Hi, I'm having a problem with some padding showing up oin both IE and Firefox with list items on my navbar. Please see: http://81.17.252.110/~wallis1/new/ I want the nav items to come to the edges of the <ul> tag (want to make the white borders on the navigation items come to the edge) but there is this padding there for some unknown reason between the <ul> and the <li> items. Please can you help as I'm tearing my hair out now, Thanks in advance, Hi I'm writing here after spending a few hours searching google without luck. I bought a "mega menu" plug in for wordpress but its acting very odd. It generally works as it should but ive found that theres something wrong with the formatting of the drop down menus. There is an issue where line breaks do not happen at all, and most important - list items are not shown on a new line. The content all seems to flow around its self rather than being formatted. See attached pic: img14 .imageshack .us/img14/964/screenshot047cr .png I did run the css and html though a validator and it spits out hundreds of errors but i think they are pretty much only shown because its css3. I'm really curious what would cause line breaks to not appear after list items. I had thought previously it may be the css clashing with my themes css but i tried a fresh install on a really mimimal theme and the error is still there Hi, I'm using a right-to-left layout and I can't find a way to display my list items correctly on Firefox. When I insert something into the rtl div with a float, the list item does not wrap correctly. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <style type="text/css"> <!-- #content { margin:0 200px 0 20px; border: 2px solid #000; direction:rtl; } #floatdiv { width:100px; height:100px; margin:10px; border: 1px solid #000; float:left; } --> </style> </head> <body> <div id="content"> <div id="floatdiv"</div> <p>This is a test</p> <ul> <li>item 1</li> <li>item 2</li> </ul> </div> </body> </html> Is there a problem in my code? Thanks, Ehud. As the title says... Design constraints unfortunately mean I need to do achieve the basic design shown in the example below (using a list) I have created an example to illustrate the problem I am experiencing. Problem example The list item text is wrapping too early in IE6 and IE7, though fine in my other target browsers such as Firefox and Opera. removing clear:left stops the wrapping, but then when 2 or more nav items have short content they sit on the same line which is no good obviously Any ideas / solutions etc. would be most welcome Hello, I am not sure if this is even possible but is there a way to apply css styles to a specific number of list items sequentially? For example, lets say I have a menu made from an unordered list. There are 5 <li> tags, and I want to make the first 3 have red text, but I want the last two to have white text. I can't assign specific classes because I am using a CMS and it writes the code for me. (I wish I didn't have to use a CMS but I have no choice). Is this possible? Thanks in advance! I have a list that is made sortable via jquery UI's sortable plugin. I have it worked fine in all modern browsers but I get overlapping in IE8 and IE7 is just a mess but I'm less concerned about that. Working Example Click and drag Item 5 up above Item 4 and drop there. You can see the issue. It works initially but I'm not sure why IE8 isn't clearing the float after it is dropped. Maybe it is a javascript issue instead of CSS? Anyway to remove the automatic line break after list items? I'd like to use styles to create roll-over effects in a menu I've used an unordered list to create that menu. But, I'd like a horizontal menu bar rather than a vertical menu column. Thanks! David Goldfeder Hi, I need some help with understanding why netscape is rendering list items differently to IE The Embedded (Dreamweaver-wizard-created) style sheet looks like this: Code: <style type="text/css"> <!-- .bul-mnu-lst { font-family: "Trebuchet MS", "Andale Mono", "Arial Unicode MS", "Eras Medium ITC", "Microsoft Sans Serif"; font-size: 80%; line-height: 140%; color: #666666; list-style-position: inside; display: list-item; font-weight: bold; vertical-align: text-top; list-style-image: url(hme_imgs/bullits/dottedArrw_bul.jpg); list-style-type: none; } --> </style> the HTML using the sheet looks like this: Code: <div id="activitiesMnu" style="position:absolute; width:218px; height:186px; z-index:1; left: 17px; top: 227px; visibility: visible;"> <p class="bul-mnu-lst"> football</p> <p class="bul-mnu-lst"> rugby</p> <p class="bul-mnu-lst"> tennis</p> <p class="bul-mnu-lst"> badminton</p> <p class="bul-mnu-lst"> swimming</p> <p class="bul-mnu-lst"> squash</p> <p class="bul-mnu-lst"> volley-ball</p> </div> The problem is, Netscape based browsers are ignoring the, line-height: attribute or just misinterpreting it and using what looks like double spacing between lines. This is causing the layer to overlap other page items and looks aweful. In I.E, it looks as expected. i've tried changing to percentages instead of pixels for the value as heard percentages are best Also tried, list-style-position from 'outside' to 'inside' values and, list-style-image: to non and used a default preset setting (square) bullet-style. - but the problem persists. any suggs?? Okay, I have an unordered list of images (im usings lists for ajax reasons). I have formatted the list to look much like a 4x4 table. Each cell has an image in it. I need to make the images vertical-align middle. at the moment the code i have is this: Code: <ul style="margin:0;padding:0;list-style-type:none;"> <li style="text-align: center; width: 140px; background-color: #e7e7e7; height: 150px;float: left;"><div style="height: 150px;"><a href="#"><img src="image.gif" style="vertical-align: middle;" ></a></div></li> <li style="text-align: center; width: 140px; background-color: #e7e7e7; height: 150px;float: left;"><div style="height: 150px;"><a href="#"><img src="image.gif" style="vertical-align: middle;" ></a></div></li> <li style="text-align: center; width: 140px; background-color: #e7e7e7; height: 150px;float: left;"><div style="height: 150px;"><a href="#"><img src="image.gif" style="vertical-align: middle;" ></a></div></li> <li style="text-align: center; width: 140px; background-color: #e7e7e7; height: 150px;float: left;"><div style="height: 150px;"><a href="#"><img src="image.gif" style="vertical-align: middle;" ></a></div></li> </ul> I added the div in hopes that this would help the vertical align, however it still aligns at top. Any ideas? I MUST use the list. Thanks for any help! |