HTML - Vertically Aligning Hyperlink Within A List?
Hello all, I am having a problem vertically aligning something inside a <li> element.
This is the code I'm talking about: Code: <ul class="small_nav2"> <li class="small_nav_back"><a href="javascript: ;" onclick="hide_more_nav();" id="scroll_nb"></li> <li class="small_nav_next"><a href="javascript: ;" onclick="hide_more_nav();" id="scroll_nn"></li> </ul> It has the following CSS attached: Code: .small_nav2 { margin: 0 0 40px 0; } .small_nav_back { background:url("images/shadow_left.png") no-repeat scroll right top transparent; height:90px; left:0; position:absolute; top:5px; width:20px; } .small_nav_back a { background:url("images/btn_arrow_left.gif") no-repeat scroll left top transparent; display:block; height:19px; width:14px; top:5px; } As you can see, there is a <li> item, that has a background-image, and a hyperlink within that <li> item, that also has a background-image. Now I want that hyperlink (the block of 19x14) to align vertically within the <li> element. But how can I do that? I've tried (I hope in the right manner) to use vertical-align: middle, and adjusted the line-heigt as well. To no succes. You can see it all in action HERE Similar TutorialsHey there, I have some text in a table that i want to vertically align center, however nothing i try with html or css seems to work. This is my current code atm; Code: <table cellpadding="0"> <tr> <td width="150" height="100" style="vertical-align:middle"> <img src='portals/default.jpg' > </td><td style="vertical-align:middle"> <h3><b><a href="/games/node/2">Welcome to the Halo Portal</a></b></h3><i><div style='font-size:0.9em; line-height: 0.3em;'>Posted by NightFox, on 15/03/09</div></i><br /><div style='line-height: 0.2em'><p>Welcome to the Halo Portal</p> </div>Halo <td></tr> </table> I want it all to vertically aligned centrally so that the text will line up with the center of the thumbnail - attached is wat it looks like atm. If anyone has any ideas please let me know (html, css, or php i don't mind) Regards NightFox Hello, I ran into this problem today in my Basic XHTML class, and it was enough to stump me and the instructor: if you want to put an unordered list in the middle of a page, but you want the list items to be left-aligned so the bullets are one on top of the other...how do you do it? I started with code something like <div align="center"> <ul type="disc"> <li>Wine</li> <li>Women</li> <li>Song</li> </ul> </div> This centers the list on the page, but it also centers each list item. I tried placing a <div align="left"> around the list items, individually and collectively, but depending on the positioning it either had no effect or it nullified the center attribute completely and gave me a left-aligned list on the left edge of the page. Attempts to change the style of the <li> tag, which I haven't done in months and was never all that good at, failed. I know I can do this in ten seconds by putting the list inside a one-cell table, and with much fiddling I could probably do it with a spacer GIF...but what's the 1.0 Strict way? oooooooooops! Hi there, I have a list box which is dynamically populated by data from an SQL Server database. I want there to be 2 columns of data inside the list box but the problem is the first column can be blank on some occasions, resulting in it looking like this: Code: example - example example - example - example example - example - example example - example Is there any way I can divide the list box into 2 seperate columns so the data lines up even in the first column is blank? Like this.... Code: example - example example - example - example example - example - example example - example Thanks! Matt Hi this is my first post. I am frustrated with how the bulleted "inspection" list is not aligned to the top. This is the code I'm working with: Code: <div id="table"> <table> <tr> <td><h4>Auto Repairs</h4> </td> <td><h4>Maintenance</h4></td> <td><h4>Inspections</h4></td> </tr> <tr> <!--Auto Repairs--> <td> <ul> <li><strong>Brake Repair & Brake Pads</strong></li> <li>Custom Exhaust</li> <li>Check Engine</li> <li>Battery</li> <li>Alternators</li> <li>Starters</li> <li>Timing Belt</li> <li>Waterpump</li> </ul> </td> <!--Maintenance--> <td> <ul> <li>30, 60, 90k-mile Service</li> <li>Oil Changes</li> <li>Tune Ups</li> <li>Transmission Service</li> <li>Power Steering Flush</li> <li>Antifreeze/Coolant Service</li> <li>Brake Fluid Flush</li> </ul> </td> <!--Inspections--> <td> <ul> <li>Free 30-Point Inspection</li> <li>MD State Inspections</li> <li>Emissions</li> <li>Diagnostics</li> </ul> </td> </tr> </table> Thanks for helping me. Hey, I've got this problem involving a list in IE. I've basically made a LI within another LI like so:- Code: <ul class="mainNav"> <li><a href="/index.php?frc=1" class="first">Home</a></li> <li><a href="/GamePortal.php">Games</a></li> <li class="headlink"><a href="/edit_profile.php">My Profile</a> <ul> <li><a href="/edit_profile.php">Game Profile</a></li> <li><a href="/link.php">Community Profile</a></li> </ul> </li> <li><a href="/promotions.php">Promotions</a></li> </ul> This generates a sort of list underneith a list to be used as a dropdown menu. I've assigned it some CSS to do this Code: .mainNav li.headlink ul { list-style: none; display: none; float: none; margin: 0px; position: absolute; top: 35px; z-index: 100; min-width: 72px; text-align: center; padding: 5px; } What happens is that when using FF the content displays perfect (no suprises there) but when I use IE for the same page, it moves the drop down list to the end of the item above on it's x axis (the y is fine). I've tried all sorts of different things; I used relative which worked but then expanded the LI item above it shifting everything along in the line. So it has to be absolute positioned to stop that from happening. I've messed about with every single margin I can think of to no avail. Any Ideas. An old chestnut this one, but I can't find reference to this particular technique when searching the forums. http://www.freemanpeer.com is the address and I'm using the technique found here (http://exanimo.com/examples/css/vert...ated-shim.html) to vertically center, however it's sticking fairly rigidly to the top of the browser. Any ideas anyone? Thanks in advance, Jez. I've been trying for 2 days to get my text to vertically-align middle in IE, but it just won't listen. I'm building the site www.acadianacomputerrepair.info; the title and menu items need to be aligned to the middle of their div containers, but they want to clip to the top. I'm setting the parent div's to display as tables and the child as a table-cell. It works great in firefox and perfect, even in IE, on a simple html test page, but I can't get it to work for the site, in IE. I don't know what else to try. Can someone help? Hai there, just a quick question - How do I center an image vertically (as in right in the middle, I don't want to have to mess around with each image to the exact pixel spacings) All I want to know is the code to put this: </A> <A HREF="http://rh.pretsell.co.uk/xlrstats/"> <IMG SRC="http://i28.servimg.com/u/f28/15/38/25/28/xlrsta16.png"> In the middle so it makes the forum look better Thank you! I have a table that is saved from Photoshop. It's a table with a load of cells inside. How can I vertically center the table? Not its content, I mean the actual table itself so it centers itself no matter the resolution of the screen it's being displayed on. Thanks, Simon Good afternoon! Where has the sun gone I'm freezing! Is it possible to have a table with rowspan with the text in the rowspan to read vertically (like taking an entire sentence after its been typed and rotating it 90ccw)? Hey guys been having a few problems finding resources on how to vertically align text. what it is is that i have a division i wish to display text in vertically... Any ideas? div{vertical-align: -50%} thats what i came up with but still no joy... Hello I have two tables in my JSP ; the first table has 3 columns, and should be displayed on top of the page and is used to display elements of a form. Another table should be displayed below that table, has dynamic number of columns. This page opens as a child window from main window The problem is that the tables are displayed beside each other if I have not specified width of table. If I do specify it (like I set it to 100%) the second table is not shown . Could you please help me and tell me how to have two tables displayed vertically inside my page ? Thank you so much Evrim Hi, I've got an image 25x25px which i'm trying to vertically align in a 35px high list element. The css attached to the image is: width: 25px; height: 25px; border: 0px; vertical-align:middle; and the css attached to the list element is: font-size: small; height: 35px; border-style: ridge; border-width: 0px 0px 2px 0px; I'm trying to find a way of getting the browser to vertically align through css. I'm not trying to use padding, etc on the image, because i'm worried that when a user enlarges the text, or its rendered by different brwosers, etc, the image will mis-align itself. I thought vertical align was the right attribute, because i thought it vertically aligned all inline elements. but when i've attached it to the image, nothing has happened. http://www.tendervendors.com/contact.php I'm trying to vertically align the little picture of a house, in the navigation bar. I'm greatful for any help you can give, Matthew Millar Hi everyone, this is my first post. I am hoping to find someone who can help me. I need to make it so a table on my page is centered veritcally (the same way the center tag centers it horizontally) so that it will always be in the center of the page regardless of screen resolution or if the person resizes their browser window - is such a thing possible? If javascript is needed that is fine. Thanks Hello all, I need some help, and I'm hoping someone can assist me . I'm trying to create a html document - an offline webpage. Basically, I want parts of the page to remain static, which contain a logo and some navigation links, and the one part of the table to be a scrolling box. The reason is this: That one cell is going to contain some very large images - 1000 pixels wide by maybe 2000, 3000 high. So while the width can obviously fit on a standard monitor, the height will not. Now, the images themselves are pictures of long flowcharts. Therefore, it's fine for the user to scroll down to navigate the flowchart. But the static navigation links and the title should remain - well, static - while the user is able to scroll up and down that ONE cell containing the flowcharts. Here's a picture to clarify things. As you can see, the bolded cell is the one in question. (apologies for the shoddy drawing) If anyone solves that problem, I have one slightly tougher one for you to solve, but more on that later. Can anyone help me? :sad: Hi, I'm absolute noob when it comes to building websites, so please be gentle. See, for example, this page of my website: http://home.planet.nl/~lever170/hk/hk.html The page is a frame with the photo's on the right and the BACK link on the left. I would like to vertically center the page with BACK so that the vertical line lines up with the thumbnails regardless of screen size. The code for the BACK page is as follows: Code: <html> <body style="background-color:#333333" link="white" alink="white" vlink="white"> <br> <br> <br> <br> <br> <br> <center> <table cellspacing="5" border="0" cellpadding="0"> <tr valign="top" align="left"> <td> <br><br><br><br> <a style="text-decoration:none" href="javascript: history.go(-1)">BACK</a><br><br><br><br><br><br><br><br><br><br><br><br><br><br> </p> </td> <td bgcolor="#FFFFFF"><img src="http://home.planet.nl/~lever170/1pix.gif"><BR></td> </tr> </table> </center> </body> </html> How do I vertically center this? how do i center the body of this page: www.discoveryfilmsuk.com/ i want to align to the middle of the page, vertically and horizontally Hey, I want an image in the dead center of a frame. All I have so far is: <center><img src="images/banner_ani.gif"></center> I don't know how to vertically align the image. Could someone please fix it for me or tell me how. I tried googling everywhere but all I could find was stuff that involved CSS. Thanks Hi there, I'm trying to create a hyperlink that opens a word document. The filename is "C# Essentials.doc". I have the right path, and can open files that don't include special characters in their filenames, but I don't have the hang of putting special characters such as "#" into a hyperlink. Could anyone advise me the code to use for the filename? Thanks! F |