SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2008
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Add link to images

    Hello
    I want to copy (legal) texts in my website. In this texts are images.

    HTML Code:
    <a href="test123.html" >
    <img src="test456.jpg" width="245" height="165">
    </a>
    <a href="test234.html" >
    <img src="test567.jpg" width="245" height="165">
    </a>
    <a href="test345.html" >
    <img src="test567.jpg" width="245" height="165">
    </a>
    After copying the texts the links to the images are broken.
    What I can do now is changing every link of each image:

    HTML Code:
    <a href="test123.html" >
    <img src="http://www.abc.com/test/test456.jpg" width="245" height="165">
    </a>
    <a href="test234.html" >
    <img src="http://www.abc.com/test/test567.jpg" width="245" height="165">
    </a>
    <a href="test345.html" >
    <img src="http://www.abc.com/test/test567.jpg" width="245" height="165">
    </a>
    My Question:
    Instead of changing every link of each image is there something for example in css to make this link change only one time:

    HTML Code:
    <style type="text/css">
    add: 'http://www.abc.com/test/' to each image
    </style>
    
    <a href="test123.html" >
    <img src="test456.jpg" width="245" height="165">
    </a>
    <a href="test234.html" >
    <img src="test567.jpg" width="245" height="165">
    </a>
    <a href="test345.html" >
    <img src="test567.jpg" width="245" height="165">
    </a>
    Thanks.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,167
    Mentioned
    453 Post(s)
    Tagged
    8 Thread(s)
    No, this is not a job for CSS. You could do it with JavaScript, but really, that's a bandaid approach, as the links should really be there in the HTML. How many pages does this apply to? In a code editor, you can do a search and replace, which would be my preference.


Bookmarks

Posting Permissions

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