Forums

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

Home Forums CSS Basic clearing floats

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #34320
    Hand2Mouth
    Member

    Hi

    in this markup:

     

    Some title


    Some text
    Some link

    The h1 and the span, elements are both floated to le left. How would you clear the float to prevent the link from going up… I have seen clearing the float by floating the link aswell, witch is not necessary.

    Do you think its bad practies?

    #87019
    Hand2Mouth
    Member

    Thanks, it only works if the anchor is displayed to block…

    #87027
    thomas
    Member

    You could also add a ::before pseudo-selector to the anchor.

    Example: http://jsfiddle.net/J6nKE/

    #87061

    The simplest method is to do what @wolfcry911 first said, set the anchor to clear: left; and then add display: block; which you also mentioned…

    #87096
    thomas
    Member

    @joshuanhibbert
    Right, and that’s fine if the anchor can be set to block without causing other design problems, but based on Hand2Mouth’s comment, I assume the anchor has to remain as an inline element, in which case the ::before selector will work.

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