| | |
Text links underneath images
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Dec 2005
Posts: 12
Reputation:
Solved Threads: 0
I'm trying to line up horizontally four images with a small text link underneath them. I can't get the text to go underneath. How can I do this? My code so far:
HTML and CSS Syntax (Toggle Plain Text)
.cards { top: 5px; background: #66AAFF; height: 124px; width: 537px; position: absolute;} .cards ul { margin: 0; padding 0; list-style-type: none; } .cards ul li { width: 103px; display: inline; }
HTML and CSS Syntax (Toggle Plain Text)
<div class="cards"> <ul id="list"> <li><a href="layout.php"><img src="card.png" border="0" /></a>Cards</li> <li><a href="layout.php"><img src="card.png" border="0" /></a>Cards</li> <li><a href="layout.php"><img src="card.png" border="0" /></a>Cards</li> <li><a href="layout.php"><img src="card.png" border="0" /></a>Cards</li> </ul> </div>
Last edited by riscphree; Nov 10th, 2008 at 5:30 pm.
•
•
Join Date: Jun 2004
Posts: 247
Reputation:
Solved Threads: 1
duno why my response didnt show up wrap cards in <p class="imgtxt">Cards</p>
HTML and CSS Syntax (Toggle Plain Text)
p.imgtxt { margin:0; padding:0; width:103px; text-align:center; /* optional */ }
•
•
Join Date: Dec 2005
Posts: 12
Reputation:
Solved Threads: 0
That makes them go vertical though.
http://www.riscit.info/jquery/lols2.html
Anyway to get them back horizontal?
http://www.riscit.info/jquery/lols2.html
Anyway to get them back horizontal?
•
•
Join Date: Jun 2004
Posts: 247
Reputation:
Solved Threads: 1
HTML and CSS Syntax (Toggle Plain Text)
.cards ul li { width: 103px; display: inline; } to .cards ul li { width: 103px; float:left; }
•
•
Join Date: Jun 2004
Posts: 247
Reputation:
Solved Threads: 1
after the </ul> add <div class="clear"></div>
to clear out the float left so you can put stuff below
HTML and CSS Syntax (Toggle Plain Text)
.clear { clear:both; }
to clear out the float left so you can put stuff below
•
•
Join Date: Dec 2005
Posts: 12
Reputation:
Solved Threads: 0
I can't quite figure out the clear stuff. Is it ok to use negative numbers for positioning?
I've updated my page: http://www.riscit.info/jquery/lols2.html
I've updated my page: http://www.riscit.info/jquery/lols2.html
Here's what you need. I've added some span elements to control the portion of the text. Hope this will help you up. Enjoy
html Syntax (Toggle Plain Text)
<html> <head> <title></title> <style type="text/css"> .cards { width: 537px; height: 140px; float: left; margin: 0; padding: 0; background: #66AAFF; overflow: hidden; } .cards ul { list-style-type: none; /* line-height uses the total height of "cards" class */ line-height: 140px; float: left; width: 534px; margin: 0; padding: 0; } .cards li { width: auto; line-height: 140px; float: left; margin: 5px 0 5px 0; padding: 0; display: inline; } .cards span { float: left; clear: both; text-align: left; line-height: 36px; margin: 0; /* Base on 100pixel width image, get the half of it to center your text. So it wil take 50px to the padding to center the text! You may adjust the pixel rate to any desired amount base on the width of your image. */ padding: 0 50px; } .cards li img { margin: 0; padding: 0 5px; border: none; width: auto; height: auto; } </style> </head> <body> <div class="cards"> <ul id="list"> <li><a href="layout.php"><img src="images/type_red1.jpg" border="0" /></a><span>Cards</span></li> <li><a href="layout.php"><img src="images/type_red1.jpg" border="0" /></a><span>Cards</span></li> <li><a href="layout.php"><img src="images/type_red1.jpg" border="0" /></a><span>Cards</span></li></ul> </div> </body> </html>
Last edited by essential; Nov 14th, 2008 at 5:46 am.
![]() |
Similar Threads
- login box not working (JavaScript / DHTML / AJAX)
- I need help with my website. Using Dreamweaver. (JavaScript / DHTML / AJAX)
Other Threads in the HTML and CSS Forum
- Previous Thread: please help me in this question plz.its urgent
- Next Thread: Another ie & ff viewing problem
Views: 1394 | Replies: 7
| Thread Tools | Search this Thread |
Tag cloud for HTML and CSS
2002 appointments asp background backgroundcolor beta browser bug calendar cart center cgi code codeinjection corporateidentity create css deleted design development displayimageinsteadofflash dreamweaver drupal emailmarketing epilepsy explorer firefox flash font fonts form format free frontpage google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft missing mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization perl pnginie6 positioning problem scroll seo shopping studio swf swf. templates textcolor theme timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7 wordpress xml xsl





