2 Replies Latest reply on Jan 12, 2018 3:29 PM by BenPleysier

    link a logo via div

    r_tist Level 1

      CSS-Tricks mentioned that to hyperlink your logo you can surround a div with the <a> tags.

       

      <a href="http://example.com"> <div> anything </div> </a>

       

      How would it work in this case?

      <div class="col-sm-12 col-lg-12 clearfix">

             <a target="_blank" href="#"><div class="logo"><img src="images/logo.png" class="img-responsive" alt="Logo"></div></a>            

      </div>

       

      I tried this but it did not seem to work. I tried it on a local server for testing. Can you advise if something is incorrect here?

       

      Thank you!

        • 1. Re: link a logo via div
          WolfShade Level 4

          Seems pretty straightforward.  No reason it shouldn't work.

           

          <DIV>
              <A>
                  <DIV>
                      <img />
                  </div>
              </a>
          </div>
          

           

          V/r,

           

          ^ _ ^

          1 person found this helpful
          • 2. Re: link a logo via div
            BenPleysier Adobe Community Professional & MVP

            Adding to WolfShade reply, you will have to replace the '#' in <a target="_blank" href="#"> with the destination such as

             

            <a target="_blank" href="myPage.html"><div class="logo"><img src="images/logo.png" class="img-responsive" alt="Logo"></div></a> 

             

             

            As a side note: Because Bootstrap 3+ is a mobile first framework it is not neccessar to add all of the classes as in <div class="col-sm-12 col-lg-12 clearfix">. You can remove the class for lg as in

             

            <div class="col-sm-12 clearfix">

             

            1 person found this helpful