Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS How do I onclick goto URL through css

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #27037
    mikeman
    Member

    I am hoping i could add to my css style sheet, when a specific class div is clicked on, it will launch a url… I under stand there are things like bracket div onclick=”” etc etc. but thats in the div tag, im hoping to accomplish this through css so i can change the url and it will go across all pages.
    thanks!

    #76793
    TheDoc
    Member

    You can do something like this:

    .divname a {
    display: block;
    width: ##px; height: ##px;
    }

    If you give display: block; to an anchor link, you can give it width and height for a larger clickable area.

    #76796
    TheDoc
    Member

    Can’t do anything with CSS to do that. Is this something that you are thinking about putting in your header or your footer? If so you’ll want to look at using PHP includes.

    #76797
    Johnnyb
    Member

    If you’re looking to have it in an external file so it can be applied easily across all of your pages then why not just have an external js file and put the code in there, and have it linked to from all of the pages just like your CSS file. You can’t do what you need using just CSS I’m afraid, but you can using a couple lines of js.

    #76718
    jamygolden
    Member

    You can’t do that with CSS, but you could use jQuery:


    That will turn any .block into a link to google.com

    #108839
    Arquitician
    Participant

    Thanks!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘CSS’ is closed to new topics and replies.