Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2009
    Thanked 0 Times in 0 Posts

    Text truncating with hyperlink

    I couldnt find what I was looking for in a search and am kinda pressed for time so Im hoping this question isnt a stupid one to ask here ...

    I am working on a portfolio. It has a image above a short, 4 line, description. However I'd like to be able to add more description and have it truncate to 4 lines. Instead of a link to expand the div though, i'd rather just have a hyperlink to the project page instead. Is this something that can be done automatically or do I need to just limit the div myself and add the hyperlink there ?

    Basicly i'd like ...

    Project Screenshot |

    Project Name
    short description of the project goes here and
    truncates after 3 lines.

    [ view complete description ] <-- This just links to the project page instead of expanding the div to fit all the text. (which is what i mainly find online)

    Thanks in advance

  • #2
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Some say it's everything.
    Thanked 397 Times in 390 Posts
    Server-side scripting could do this but limiting it to 4 lines on the page would be difficult. You could limit it to a specific number of words or characters very easily though. Were you looking specifically for a javascript solution for this or is server-side something that you're interested in?
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting


    Posting Permissions

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