Solved

Align text vertical middle on bullet points ... HELP!

Posted on 2013-06-11
4
601 Views
Last Modified: 2013-06-27
This problem should be so easy but im struggling with it.

I have 10 links (dynamically pulled from a database). I am using -webkit-columns to separate them into 2 columns. The problem is that some of the link titles are 2 lines, and some are one. I need the text to be aligned centrally to the bullet point (li).

Please see images for problem.... Incorrect is a screen print. CORRECT has been Photoshop to look correct....

 
Examples - IncorrectExample - CORRECT
Could someone advice on the css to correct this.

JSFiddle Simple Example: http://jsfiddle.net/5cjua/1/


<div id="indexLinks">
	<ul>  
<?php
	mysql_data_seek($result, 0);
	while($row = mysql_fetch_array($result)) {
?>


<li><p><a href="otherEntry.php?questionID=<?php echo $row['questionID']; ?>"><?php echo $row['question']; ?></a></p></li>


<?php } ?>
</ul>
</div>

Open in new window







#indexLinks ul {
	float: left;
	list-style: none;
	text-align:left;
}

#indexLinks {
	border:0px solid red;	
	columns:100px 2;
	-webkit-columns:100px 2; /* Safari and Chrome */
	-moz-columns:100px 2; /* Firefox */
	height:510px;


}

#indexLinks ul li a {
	float: left;

	color: #000;
	background: #ccc;
	text-decoration:none;
	color: #00AFFE;
	background-color: #FFF;
	background:url(arrow1.gif) left no-repeat ;
	border-bottom:1px #8C8C8C double;
	padding:30px 0 0 50px;
	font-size:23px;
	width:360px;
	margin:0px;
	height:60px;
}

#indexLinks ul li a:hover, a:active {
	background: #00AEEF;
	color: #CCC;
	background:url(arrow_gray1.gif) left no-repeat ;

}

Open in new window






Thanks

Steve
0
Comment
Question by:sjtinsley83
4 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 39238070
On the background-position try left center

If that does not work you might need to use an absolute value in pixels or em for the vertical position.

Cd&
0
 

Author Comment

by:sjtinsley83
ID: 39238102
Its not the background image that is the problem. This seems to be in the correct position.
Its the text which is only aligning the first line with the bullet point. I want to whole sentence to align itself in the middle of the bullet...
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39238180
Do you mean like this
http://jsfiddle.net/uJ7fQ/
0
 
LVL 51

Expert Comment

by:Julian Hansen
ID: 39238223
The bullet is a background image using the background-postion: left center as CD& suggested should solve the problem - depending on how the image is defined.

You might need to crop your image so that it terminates top and bottom exactly on the corners of the arrow.

This should work as the background-position positions the image relative to the container.

Your fiddle shows a layout wher bullets don't line up horizontally - is that a requirement or not (your attached images seem to indicate it is). If it is not - you can remove the height style from the <a> to make it work correctly. Currently the height on the single line elements is making the container longer so there is more space below the <a> elements on single lines than wrapped lines.

The other option is to look ath the table-cell css property.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

757 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

22 Experts available now in Live!

Get 1:1 Help Now