CSS - How To Vertical-align The Text To Center For Anchor Tags???
I'm wondering how to "vertical-align: middle" the text in the anchor tags. I haven't got that part to work.
Code: a.aMenuLinks:link { color: #666666; font-family: tahoma, sans-serif; font-size: 8pt; font-style: normal; font-weight: bold; text-decoration: none; text-indent: 15px; width: 100%; height: 25px; display: block; } Thanks... Similar Tutorialsim sure this may be answered somewhere on this forum inside another post, but using search, i could not find anyone who had actually asked this specific question... i found a few posts back in 2002 that never got a responce... i'd hope we'd have an answer 3 years later... anyhow, my question is quite simple... i think.. i have a div that is 50px in height, and has some text inside it.. the text aligned center, and now i want it to vAlign center.. but the CSS doesnt seem to work... my problem is that the text in that field changes quite often, and having to constantly change margins in CSS would be a pain. anyhow, now for a snippit Code: .advertboxtitle { margin:10px 0px 0px 110px; height:50px; border:1px dashed #900; font-family:Arial, Helvetica, sans-serif; font-size:14px; color:#CCFFFF; font-weight:bold; text-align:center; } .advertboxtitlevalign { vertical-align:middle; } Code: <div class="advertboxtitle"> <span class="advertboxtitlevalign">From X-Box to Xbox</span> </div> anyhow, reason why it is in a span is because i read that inline elements react to vertical-align:middle... but apparently not... anyhow, here is a link.. http://defunctgames.com/helpfix/middle.htm the text needs to be align verticaly in the dashed red box. thanks Hi, Does anyone know how to veritcally align text using CSS? like <tr valign='middle'> when using tables. My page is on: http://www.3003online.com/demos/ecoceylon/v2/ You can see a difference in the "Home - About Us - Products - Contact Us" links when viewing from IE and Mozilla Firefox. Basically, I would like the text to be centered vertically in the bar... but CSS by default puts it on top. I tried adding padding,which helped in IE... but Firefox still shows the links a bit higher than they should be.,... any ideas how to fix this? Also, a different problem in case anyone knows how to fix it... you can see a small brown bar on the top bar. It is 50px in height. But I have no idea how to make its width as wide as the remainder of the page (this would change with different resolutions). The main content of the page is 760px wide. I would like a brown box next to that, which is 50px in height and the remainder width. Any ideas? "width: auto;" doesn't work unfortunately [ this is a follow up to my previous thread http://forums.devshed.com/showthread.php?t=270438 Any help would be greatly appreciated. Thanks very much. How exactly can i vertically align text in css, i can't seem to find an easy way to do it, i basically want my text to be in the middle of a divs height, so much easier in tables heh. Tried padding but that then adds to the height, making it pointless for this use hi. i'm trying to have some text in a div, but also i want the text align to the bottom of the div. something like. but i don't know how... have a look at http://www.desorden.net/prueba.html any ideas? thanks in advance I have some text in a DIV that is updated dynamically with removeChild() and appendChild(). I've tried numerous combinations but I can't seem to get it to work correctly. CSS Code: Original - CSS Code div.chatlayer { position: absolute; top: -50px; left: 50px; border: 1px solid black; -moz-border-radius: 10px; padding: 5px; background-color: white; min-width: 100px; width: auto; text-align: center; visibility: hidden; } div.chatlayer { I was having some trouble centering my layout in Firefox. It looked fine in IE6 (yes... it's a pain to work in, but it's the nature of the beast when doing internal intranet stuff) when I simply used "text-align: center;" but the layout wouldn't center until I added "text-align: -moz-center;" under that (in the body style). Is this an acceptable way of doing things? Is this a flaw in Firefox or is it more likely that I'm not doing things right? (yes I know I haven't posted code, this was more a high level question of when/if "text-align: -moz-center;" should be used). I have a <p> tag with text inside of it with a height of 20px and width of 100px. Horizontal text alignment works fine within in, but I want the text to sit in the middle of the tag and I just can't do it. It defaults to sitting at the top. I try vertical-align: middle, but that doesn't work. None of the the vertical aligns do anything in fact OK, I have <h1> and a class .footer_header_link. Both should center the text. But the class code isn't being centered. I thought this would be simple, but I must be overlooking something. Here's my css: Code: h1 { font-family:arial black; color:#666666; font-size:12pt; margin: 0; padding: 2px 0; text-align:center; } .footer_header_link{ text-align:center; font-family:arial black; color:#666666; font-size:12pt; margin: 0; padding: 2px 0; } You can see a sample testhere. Scroll down the 3 column bullet point list. You will see the headers with an underline aren't centered. They have a class of "footer_header_link" Any ideas? thanks I am relatively new to using div tags - transitioning from table tag to organize pages. I want the checkboxes to be aligned to the left inside a container that is centered in the body. Currently it is all aligned to the left for some reason. The body tag has no text-align or any other css rule manually set. Code: <div style="display: block;text-align;left;float: center;margin-left: auto;margin-right: auto; border: .1em solid;width:400px; position: relative; clear:both;"> <div style="display: block;text-align;left;float: left;margin-left: auto;margin-right: auto; border: .1em solid; position: relative; clear:both;"> <INPUT TYPE="CHECKBOX" NAME="cartoon">cartoon<BR> <INPUT TYPE="CHECKBOX" NAME="comicstrips">comicstrips<BR> </div> </div> thanks. Firefox: all looks fine except the checkbox container does not appear to be inside the surrounding container - the outer container div appears as a line (it's border) at the top of the inside div with the checkboxes IE8: on a test page with nothing else - appears as Firefox. In my page with several other divs it appears with one container inside another fine, but the main container is not centered. I have looked at several tutorials about float etc but...wits end... thanks. How do I align an actual text input box to the center of the screen using css? Sorry solved problem but can somebody post a definite solution to making a body { text-align:center } style work in both IE and firefox? I would like to delete this thread but I don't know how to, as another thread answered the question somewhat ambiguously. Thanks. Never had a reason to use this property...not sure I'm understanding it correctly. My intent was to have the the nav links sit on the baseline of the 50px height container. Any help would be greatly appreciated. Thanks! .css #toplinks { float:left; width:580px; background-color:#fffff; height: 50px; text-align:right; vertical-align:bottom;} html <div id="toplinks"> Home | Preferences | Help | Site Map | Contact Us | Log Out</div> I have a td with a div inside it and I'm trying to vertically align the text in the div. The Div has a background image so the height of the div is important. For whatever reason vertical-align:middle just wont work. I've tried in both IE and FF and nothing I do seems to work. Here is my code Code: .globalNav, .globalNav td { margin: 0px; padding: 0px; width: 100%; height:28px; border-bottom: 1px solid #94AEC1; border-collapse: collapse; } .globalDiv{ color:#fff; width:100%; height:28px; background:#94AEC1 url(../images/grad_bar.gif); background-color:#94AEC1; margin:0px; padding: 0px 0px 0px 10px; overflow:hidden; } .globalDiv a{ font-size:10pt; color:#fff; } .globalDiv a:link,.globalDiv a:visited{ text-decoration:underline; } .globalDiv a:hover{ text-decoration:none; } Thanks Hi folks, don't usually post in the CSS forum here, but in the php forum I have got great help so give it a go. Basically I need to know how to center two divs on a page which themselves have float:left attribute. When I set text-align:center on the body a couple of other divs aligned perfectly so I did not have to worry about different res's. But I need these two divs (leftnav and content) next to each other and acheived this by setting the float:left attribute. The CSS code is below, I hope you can help, i have tried but these two divs in one outer div (without any float set) but didn't work. Code: body { font-family: "Lucida Sans"; font-size: 12px; margin: 0px 0px 10px; border-top: 0px none #000000; border-right: 0px none #000000; border-bottom: 5px none #000000; border-left: 0px none #000000; scrollbar-arrow-color: #D20000; scrollbar-3dlight-color: #4F4F82; scrollbar-darkshadow-color: #4F4F82; scrollbar-face-color: #f4f4f0; scrollbar-highlight-color: #FFFFFF; scrollbar-shadow-color: #d0d0d0; scrollbar-track-color: #ffffff; text-align: center; display: block; } .leftnav { float: left; color: #000000; font-size: 12px; font-family: "Trebuchet MS"; border-top: 1px solid #000000; border-right: 1px none #000000; border-bottom: 1px none #000000; border-left: 1px none #000000; padding: 0px; white-space: nowrap; width: 220px; margin: 10px 0px 0px 10px; clear: both; text-align: left; } .content { background-color: #FFFFFF; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #000000; border-right-color: #000000; border-bottom-color: #000000; border-left-color: #000000; float: left; white-space: normal; margin-top: 10px; margin-left: 0px; margin-bottom: 10px; font-family: "Trebuchet MS"; font-size: 13px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; width: 1000px; margin-right: 0%; list-style-type: none; text-align: left; } Thanks very much. Hi, I'm using XHTML & CSS (strict dtd) and using one large table to format my pages. Within the table I have different alignments and any other sort of thing that you would find in a table. W3.org says my XHTML --AND-- CSS are VALID, so why does the main table render off to the left of the page in Netscape?? Everything within the table is great, but the table itself is not centered. I'm using CSS in the following manner to try to center it currently Code: <!-- All the doctype stuff and head tags go here...--> <body style="text-align:center"> <!-- Rest of the document --> It works greate in IE (but what doesen't), so is this the wrong attribute to use to center the documents content in Netscape. As you may know "<center>" is not defined in the XHTML strict dtd so that options out. Thanks for any help or suggestions, Kalan [link removed] In IE6, the category "At-A-Glance Telephone/Address Book" has a large vertical gap inserted at the first space. It only happens on this page (that I've found). It doesn't happen on other pages with the same number of nested lists. Shortening the name of the category so it doesn't wrap just moves the gap to the next category down. Any idea what's causing this? Thanks much in advance. ------- Someone on another forum figured it out. It was just IE6 choking on the left padding used to indent each sublevel. Reduced the padding for IE6 only to fix it. This is a simple question. In my menu system, I want my "items" to look like links. I've put the text in an Anchor tag... but I then get the, for this time at least, undesired blue underline action going on... What CSS do I need to use to prevent this. I want my <div> tag and/or my <a> tags to not change... Thanks. hi I have a simple page which has a horizontal header along the top which is fixed using CSS, and below the rest of the page scrolls underneath this header. However I've noticed when using anchor points, that it aligns to the top of the screen (but underneath the top header). So when I click a link to go to an anchor point the top part of what I wanted to see disappears under the top header. How would this be fixed? cheers nathan Hi, I am trying to get a hover to work with my links. The problem is when i have a list-style-type in css. When that exists, the link text for each link goes behind the bullets instead staying to the right of them. What do i need to do to have a list-style and the hover effect hovering over the links? Have a look at this code. Why is the background not showing up as the appropriate pixel sizes? PHP Code: <html> <head> <title>CSS Testing</title> <style type="text/css"> .test-height { width:200px; height:108px; background-color:yellow; } #test { width:200px; height:108px; background-color:red; } </style> </head> <body> <div class="test-height"><p>This should be 200px high and 108px wide.</p></div> <br /><a href="#" class="test-height">Click Me (This should be 200px high and 108px wide.)</a> <div id="test"><p>This should be 200px high and 108px wide.</p></div> <br /><a href="#" id="test">Click Me (This should be 200px high and 108px wide.)</a> </body> </html> Any feedback is appreciated. Thanks in advance. Regards, CH... |