CSS Bildverlinkung einstellen?

  • Hey Com,


    Da ich ja jetzt mit CSS ein Headerlogo gemacht habe wollte ich mal fragen wie ich da eine Verlinkung hintue?


    PHP
    .head_class { background-image: url(images/Untitled-2.png); width: 510px; height: 140px; margin-top: -100px; }


    Da es ja nicht im HTML Code vorhanden ist :D

  • Mach im HTML Bereich ein <a href="http://www.google.de""> davor, und ein </a> dahinter. Per CSS kannst du das nicht lösen, da CSS nur für die Optik ist.

    PAWNit gratis nutzen?
    Geschenkcode: 2017VQXPKB8V3KA

    Hier könnte Ihre Werbung stehen.

  • Was spricht denn gegen die Nutzung des <img> Tags?


    ist es dann ander gleichen stelle was muss ich dann in der CSS ändern?


    HTML:
    <body>
    <table align ="left">
    <tr>
    <td>
    <div id="root_site">
    <div id="head_main">
    <div class="head_class">
    <a href="http://www.google.de"></a>
    </div>
    </div>
    <div id="navi_main"></div>
    <div id="content_main"></div>
    <div id="footer_main"></div>
    </div>
    </td>
    </tr>
    </table>
    </body>


    SQL
    #root_site { background-color: #558855; margin-top: 40px; width: 860px; height: auto; }
        #head_main { width: auto; height: 60px; }
            .head_class { background-image: url(images/Untitled-2.png); width: 510px; height: 140px; margin-top: -100px; }


    Mfg

  • Code
    <a href="http://www.google.de">
        <img class="head_class" src="images/Untitled-2.png" />
    </a>


    Code
    .head_class { width: 510px; height: 140px; margin-top: -100px; }

    PAWNit gratis nutzen?
    Geschenkcode: 2017VQXPKB8V3KA

    Hier könnte Ihre Werbung stehen.

  • Ich frage mich ebendfalls was gegen den <img> Tag spricht..
    Der Code von Hauke sollte dir eig. weiter helfen.

    das <div id=""> vom bild muss mit dem <a> tag umfasst werden
    und incht in einer einzelnen befehl.


    <a href="http://www.google.de"><div class="header_class"></div></a>

    Wenn man den unerfahrenen Codeschnipsel gibt, sollten die mindestens
    in Ordnung sein...
    Laut w3 Validator ist dein Code nicht Valid.
    "document type does not allow element "div" here;"

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • warum arbeitets du mit einem compiler ? :D , einfach notepad ++ und google chrome.


    mfg kyle



    Sorry, aber wenn man keine Ahnung hat :pinch:


    P.S: Va-li-da-tor

    Main: CPU: Intel Core i5-4440 @ 3,10 GHz | CPU-Cooling: Matterhorn -PURE- | RAM: 16GB Crucial Ballistix Sport DDR3-1600 DIMM CL9-9-9-24 |
    Motherboard: ASRock B85M Pro4 | GPU: Sapphire Radeon R9 390X Nitro 8GB GDDR5 |

    SSD: Samsung SSD 840 Evo 500GB | Power Supply: 550 Watt Corsair CS Series Modular 80+ Gold | Case: beQuiet! Silent Base 800


    As I walk through the valley of the shadow of death
    I take a look at my life and realize there's nothin' left.