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.

CSS Forum


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



Reply
Link background position
Old 10-11-2006, 03:46 AM Link background position
Spud In Disguise's Avatar
Super Spam Talker

Posts: 808
Location: UK... where else?
Trades: 0
Hey, I would like to create a tab/erollover effect using css on some links. The problem is I am not sure how to get the whole of my image displayed in the background of the link.

So for example if my image is 100px wide, but my text only 40px wide only 40px of my background are displayed. How can I solve this?
Spud In Disguise is offline
Reply With Quote
View Public Profile Visit Spud In Disguise's homepage!
 
 
Register now for full access!
Old 10-11-2006, 04:21 AM Re: Link background position
King Spam Talker

Posts: 1,186
Location: Manchester, UK
Trades: 0
- use a smaller image or
- specify a width >= 100px for your text?
gringo is offline
Reply With Quote
View Public Profile Visit gringo's homepage!
 
Old 10-11-2006, 10:27 AM Re: Link background position
Spud In Disguise's Avatar
Super Spam Talker

Posts: 808
Location: UK... where else?
Trades: 0
Can you specify a width for text that easily, or does it need to be in a div or something?
Spud In Disguise is offline
Reply With Quote
View Public Profile Visit Spud In Disguise's homepage!
 
Old 10-11-2006, 10:30 AM Re: Link background position
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
a {
display: block;
width: 100px;
}
That's all you need. Maybe text-align: center to make it look pretty too.

Your issue will be if people resize your link beyond the size of your background, so make sure it tiles well both horizontally and vertically (although if it's 40 px, it's most likely not going to happen.)
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 10-11-2006, 01:41 PM Re: Link background position
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
You might want to have a look at these:
http://www.alvit.de/css-showcase/css...s-showcase.php
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 10-11-2006, 05:37 PM Re: Link background position
Spud In Disguise's Avatar
Super Spam Talker

Posts: 808
Location: UK... where else?
Trades: 0
ok I have set up the following set of links with the following css code - however rather than displaying in a nice line they are stacked horizontally... how can I stop this and have them displayed vertically one next to the other?

HTML LINKS:
PHP Code:
<table border="0" cellpadding="0" cellspacing="0" id="header">
  <tr>
    <td id="logo">
      <?php if ($logo) { ?><a href="<?php print $base_path ?>" title="<?php print t('Home'?>"><img src="<?php print $logo ?>" alt="<?php print t('Home'?>" /></a><?php ?>
      <?php if ($site_name) { ?><h1 class='site-name'><a href="<?php print $base_path ?>" title="<?php print t('Home'?>"><?php print $site_name ?></a></h1><?php ?>
      <?php if ($site_slogan) { ?><div class='site-slogan'><?php print $site_slogan ?></div><?php ?>
    </td>
    <td id="menu">
      <div id="primary">
      
      <a href="http://allcdreviews.com/">Home</a>
      <a href="http://allcdreviews.com/node/58">Browse Reviews</a>
      <a href="http://allcdreviews.com/popular_reviews">Popular</a>
      <a href="http://allcdreviews.com/node/add/content_review">Submit</a>
      <a href="http://allcdreviews.com/contact">Contact Us</a>
      
      </div>
    </td>
  </tr>
  <tr>
    <td colspan="2"><div><?php print $header ?></div></td>
  </tr>
</table>
CSS:
PHP Code:
#header {
  
background#C0C0C0 url(http://www.allcdreviews.com/themes/bluemarine/headerbg.gif) repeat-x;
}
#logo {
  
vertical-alignmiddle;
  
border0;
}
#logo img {
  
floatleft;
  
padding0em 0em 0em 0em;
  
border0;
}

#menu {
  
text-alignright;
  
vertical-alignbottom;
}
#primary {
  
font-size1.2em;
  
color#f5f5f5;
}
#primary a {
    
displayblock;
    
width154px;
    
height:47px;
    
backgroundurl(http://www.allcdreviews.com/themes/bluemarine/home.gif) 0 0 no-repeat;
    
text-aligncenter;
    
font-size12pt;
    
color#FFFFFF;
    
text-indent: -9999px;

    
}
#primary a:hover {
    
displayblock;
    
width154px;
    
height:47px;
    
backgroundurl(http://www.allcdreviews.com/themes/bluemarine/home2.gif) 0 0 no-repeat;
    
text-aligncenter;
    
font-size12pt;
    
color#FFFFFF;
    
text-indent: -9999px;


Spud In Disguise is offline
Reply With Quote
View Public Profile Visit Spud In Disguise's homepage!
 
Old 10-12-2006, 02:20 PM Re: Link background position
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
I think you've got your directions mixed up. If you want them in a HORIZONTAL line, like this:

link.. link... link... link...

then you're going to have to use a colspan to be sure the cell goes all the way across. You might have to string the <a href="lxxxx">links one after the other. If you used an undordered list instead of links in a table cell, all you have to tell it is "display: inline".

What you're getting the links stacking VERTICALLY like this:
link
link
link
link
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 10-12-2006, 06:14 PM Re: Link background position
Novice Talker

Posts: 11
Trades: 0
EEWWWW!!! Don't USE Tables. Too Much code. It drastically changes your code to content ratio if you use divs, td, dd, ul, li. Try those instead. It helps you build a much cleaner site.
cromebiz is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Link background position
 

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.26145 seconds with 12 queries