Solved

ul li a text-indent not working

Posted on 2009-04-13
1
1,990 Views
Last Modified: 2013-11-19
Trying to replace text with a background image in CSS - I'm assuming the fact that my list is display:inline could be causing the issue

Does anyone know how to fix this?


#header{

	margin: 0;

	padding: 0;

	height: 85px;

	width: 100%;

	text-indent: -9000px;

}

#header ul {

	margin: 0;

	padding: 0;

	width: 540px;

	list-style: none;

	display: inline;

}

#header ul li {

	margin: 0;

	padding: 0;

	width: 175px;

	height: 40px;

	display: inline;

}

#header ul li a.home{

	width: 92px;

	height: 32px;

	font-size: 33px;

	background: #fff url('../images/sprite.gif') 0px 0px no-repeat;

}

#header ul li a.services{

	width: 105px;

	height: 32px;

	font-size: 33px;

	background: #fff url('../images/sprite.gif') -105px 0px no-repeat;

}

#header ul li a.aboutUs{

	width: 150px;

	height: 32px;

	font-size: 33px;

	background: #fff url('../images/sprite.gif') -255px 0px no-repeat;

}

#header ul li a.contactUs{

	width: 160px;

	height: 32px;

	font-size: 33px;

	background: #fff url('../images/sprite.gif') -410px 0px no-repeat;

}
 
 

==============
 
 

		<div id="header">

			<ul>

				<li><a class="home" href="index.php">Home</a></li>

				<li><a class="services" href="services.php">Services</a></li>

				<li><a class="aboutUs" href="aboutUs.php">About Us</a></li>

				<li><a class="contactUs" href="contactUs.php">Contact Us</a></li>

			</ul>

		</div>

Open in new window

0
Comment
Question by:trickyidiot
1 Comment
 
LVL 42

Accepted Solution

by:
David S. earned 500 total points
ID: 24134805
The width and height properties don't apply to (non-floated, non-absolutely-positioned) elements with display:inline. Those <a>s need display:block

What happens if a visitor has images disabled in their browser? I use and recommend the Gilder/Levin Method of CSS Image Replacement: http://levin.grundeis.net/files/20030809/alternatefir.html
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Button Css BootStrap 2 33
Remove greater than sign 3 42
Regular Expression Calculator Tester 2 48
Show/Hide ASP.NET controls with JQuery best practices 3 10
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now