Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
CSS automatically aligning images?
Old 04-16-2004, 09:17 PM CSS automatically aligning images?
Annie's Avatar
Novice Talker

Posts: 8
Location: Canada
Trades: 0
I'm making a website and the link menu is going to have little animated bullets in front of every link. When coding, I simply placed the image in front of every link. However, instead of aligning to the middle of the text, the images align with the bottom of the text. I wanted to know if I can control the alignment of all my images through css. This is what I put in my stylesheet but it isn't having any effect:

HTML Code:
IMG	   {align: middle}
Is there a way to do this? Or a way to define the "bullet" image and use a proper "list" for my links?

Thanks.
Annie is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-18-2004, 03:48 PM
techwench's Avatar
Code Monkey

Posts: 1,449
Name: Danalyn
Location: Dallas, TX
Trades: 0
Hmmm...

This one is kind of tricky. As far as I know, you can't align middle relative to the text positioning. Aligning images relative to text, you can only use text-top and text-bottom. But, you can use vertical-align according to parent elements.

If you use:

Code:
IMG {vertical-align: middle; }
It'll align your image relative to its parent element. Theoretically (I haven't tested it out), you could do something like:

Code:
<STYLE>
#bullet { vertical-align: middle; }
</STYLE>

<DIV ID="bullet">
  <DIV><IMG SRC="image1.jpg">Link Text 1</DIV>
  <DIV><IMG SRC="image2.jpg">Link Text 2</DIV>
</DIV>
OR

You could use tables, since the default vertical alignment in table cells is middle.

Code:
<TABLE>
  <TR>
    <TD><IMG SRC="bullet1.jpg"></TD>
    <TD>Link Text 1</TD>
  </TR>
  <TR>
    <TD><IMG SRC="bullet2.jpg"></TD>
    <TD>Link Text 2</TD>
  </TR>
</TABLE>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
techwench is offline
Reply With Quote
View Public Profile
 
Old 04-18-2004, 03:53 PM
techwench's Avatar
Code Monkey

Posts: 1,449
Name: Danalyn
Location: Dallas, TX
Trades: 0
Forgot to add, you could also use list-style-image to define images for your list items:

Code:
UL {
    list-style-image: url('image.jpg');
    list-style-type: circle;
}
You should always, when using list images, specify an alternate list style type.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
techwench is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to CSS automatically aligning images?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.22470 seconds with 12 queries