Forums

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

Home Forums CSS [Solved] div as a button

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #181333
    Romchick
    Participant

    Here I am again.

    I cant understand: why is hovered div Join us soon is not a full link, but only the text? What am I missing?
    PS is that ok, that I make div as a button or are there any issues with my “technique”?

    #181338
    Alen
    Participant

    Why make something that is not a button, a button, when you can just use the button.

    The link you provided handles this very badly, in my opinion.

    why is hovered div Join us soon is not a full link, but only the text? What am I missing?

    Because there is a link inside the div.

    See:

    
    <div class="join-button">
      <a href="http://eyes.in.ua/glavnaya/">Join us soon</a>
    </div>
    

    I would have done something like this.
    http://codepen.io/alenabdula/pen/Cmlsh

    #181350
    nixnerd
    Participant

    I’m going to side with Alen. You can style a button any way you please and it’s FAR more semantic. Only use divs when there’s no other HTML element that would be semantically appropriate.

    #181354
    Paulie_D
    Member
    #181356
    Romchick
    Participant

    So many headshots for the morning in Ukraine with you, guys.
    Ok, lets consider that I am using SPAN (as it becomes available to link the whole area) and there are few moments still cant understand: why SPAN kills all my requirements in positioning of this block? Why cant I center it with a lovely “margin: 0 auto” ?

    #181358
    Paulie_D
    Member

    Because span is an inline element which doesn’t react to margins.

    …also the consensus is, i think, that span is probably the worst way to go.

    #181473
    Romchick
    Participant

    Thanks for advices.
    gcyrillus
    p and clearing are from wordpress templates… trying to figure out them.
    Many simple and important things I’ve become to know.

    #181474
    Paulie_D
    Member

    p and clearing are from wordpress templates

    As I recall, there is a setting in WP somewhere that stops everything getting wrapped in p tags.

    #181475
    Romchick
    Participant

    Oh! Thanks gonna find out where it is…

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