Results 1 to 8 of 8

Thread: How to place text over link image

  1. #1
    Join Date
    Sep 2012

    How to place text over link image

    I am trying to figure out how to place text on top of a link image. Instead of all kinds of explaining here is a link to some test code. http://dutchbarn.net/issue01.html I have found some other questions on forums that are simular but none seem to fix my problem. The 1st, 3rd, and 4th buttons perform the way I want. The second is an example of my attempt to place a heading on top of the image of course the image does not respond to the hover condition as the heading text is covering it. I can use an individual image file for each button with the text already part of the image but search engines won't see the text and it won't be part of the "html5 outline". It also does not seem to be a clean way to write the page as more downloading is needed than seems necessary. On the last button I used the image as a background but you will notice it does not display right when hovered over. Any suggestions?

  2. #2
    Join Date
    Sep 2006
    new york
    tyIs this a duplicate post? Thought I already started to reply to this ????

    What you have looks overly complicated and misdirected to me
    <style type="text/css">
    a:link {text-decoration: none;}
    a:visited {text-decoration: none;}
    #sidenav {
    margin:100px 0px 0px 60px;
    .navbtn {
    #btn1 {top:48px;}
    #btn2 {top:101px;z-index:-1;}
    #btn3 {top:154px;}
    #btn4 {top:207px;}
    #txt5 {position:absolute;
    background-image: url('menu_button.png');
    h3 {position:absolute;top:103px;
    <!--[if IE]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <script type="text/javascript">
    function navbtnlong(x)
    function navbtnshort(x)
    Think you should have one navigation button .CLASS with alternate background images for regular a: link and a:hover (if necessary) or. better, avoid nav-link images and just use CSS to style different states [a a:link a:visited a:hover a:focus a:active]

    Have not worked out logistics of extending button width for a:hover (as you seem to want) with just CSS. But check out http://www.auntnini.com/sketch/index.htm (button position:relative parent for position:absolute hover/span notation -- otherwise avoid position:absolute)
    http://www.josephdenaro.com/heads/index.html (using background image) or http://www.jacquimorgan.com -- all of which use CSS to create button effects.

    Reference that might help: http://webdesign.about.com/od/css/a/aa082304.htm (vertical); and http://webdesign.about.com/od/freeme...gation-bar.htm (horizontal).

    Duplicate post at http://www.webdeveloper.com/forum/sh...ver+link+image
    Last edited by auntnini; 11-28-2012 at 07:18 PM. Reason: typo dup Post

  3. #3
    Join Date
    Jan 2010
    Hi bud,
    If you add a class name to the dynamic pseudo classes visited, hover, active and link it will let you style these links without affecting all the other links in your page
      width            : 100px;
      height           : 52px;
      background-image : url('menu_button.png');
      color            : #ffff00;
      text-decoration  : none;
      width            : 100px;
      height           : 52px;
      background-image : url('menu_button.png');
      color            : #ffff00;
      text-decoration  : none;
      width            : 150px;
      height           : 52px;
      background-image : url('menu_button.png');
      color            : #00ffff;
      text-decoration  : none;
      width            : 150px;
      height           : 52px;
      background-image : url('menu_button.png');
      color            : #ff0000;
      text-decoration  : none;
    They need to be in order as well in that the hover must come after the link and visited and the active after hover but I guess you may already be aware of that
    Then all you need to do is add the class name to the link and you are good to go.
    <a class="menu" href="#">Test link</a>
    It is worth having a look at the w3c’s specification for css

  4. #4
    Join Date
    Sep 2012
    Ok, I have gotten rid of the javascript and am using the css hover attribute but I still get an apparent border along the right side of my background image. http://dutchbarn.net/issue03.html Notice that the first button only has a background color of red and no image; it works the way I want, however the last button shows a line or "border" even though I have the border set to 0px. What might be causing this?

  5. #5
    Join Date
    Sep 2006
    new york
    Haven/t tested your code, but suspect it has to due with border added to images used as links. See, for instance, http://www.boutell.com/newfaq/creating/border.html or http://perishablepress.com/css-remov...linked-images/,

    Therefore add CSS style

    a img {
    	text-decoration: none;
    	border: 0 none;

  6. #6
    Join Date
    Nov 2012
    From what I read (I may be wrong at my age) you are looking for text to be a link?
    Here is what you would do:
    <a href="[where ever the page is located without these brackets but use the quotes]">This is my text</a>
    Here is an example: http://variousphotography.com/
    Look at the links like Fire, Food, Industrial.
    Here is the code for Fire: <a target="_blank" href="fire/index.htm" style="text-decoration: none">
    <font color="#CECECE">FIRE</font></a>
    target="_blank" gives you a new window
    href="fire/index.htm" means that in the fire folder it will look for the index.htm page
    style="text-decoration: none" means that the link will not be underlined
    Font color="#CECECE" gives you the color you want for your text
    FIRE is the actual text that you want the people to see and it will be your link
    </font> ends your font
    </a> here makes the text part of the code and actually ends the code
    I hope I understood your request and if so I hope I helped you understand.
    I learned a lot with www.w3schools.com but before I knew about that I would experiment by right clicking on a page and clicking View Source.
    Best of luck!
    Last edited by Grandpa "D"; 11-30-2012 at 08:33 PM.

  7. #7
    Join Date
    Jan 2010
    Hi bud

    It is the image you are using for the background “menu_bottom.png” it has its edge feathered either crop the image to get rid of the semi transparent edge or make a new image making sure that the edge doesn’t have any feathering


  8. #8
    Join Date
    Sep 2012
    Problem Solved! Vince616 is right there was a border pixel in the png file. All I can figure out is that on the first bit of code where I used Javascript this did not show up because Js stretches or interpolates pixels where as the css code tiles the image to stretch it. That might be good to know for other applications. Sorry about the wild goose chase but I did appreciate all the response on this forum.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.11964 seconds
  • Memory Usage 2,927KB
  • Queries Executed 15 (?)
More Information
Template Usage (34):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (8)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (73):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates