[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 175
  • Last Modified:

Centering a ul without width?

I have a ul that looks like the one in the code snipper (below). I'm trying to have the ul centered horizontally but it seems I can only do this if I apply a width to the ul. The only problem with that is that my li's are dynamic and shrink and grow. The blue border i've applied to #footer ul for testing shows it's 100% of the page... I just need it to auto to the combined width of the li's, and center horizontally.


#footer ul{
	margin: 0 auto; padding: 0;
	list-style: none;
	font-size: 11px;
	color: #fff;
	text-transform: uppercase;
	position: relative;
	border: 1px solid blue;
	
}
#footer li{
	float: left;
	padding-left: 40px;
	line-height: 45px;
}

Open in new window

0
level9wizard
Asked:
level9wizard
1 Solution
 
LZ1Commented:
If I am understanding you correctly(I hope), you could add the following code to the #footer ul CSS:
 

	text-align: center;

Open in new window

0
 
level9wizardAuthor Commented:
LZ1, unfortunately that does not work - I did try it and forgot to mention in my original question. Thanks for trying.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now