Forums

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

Home Forums CSS Responsive circle with centered text

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

    Hi all!
    I am currently redoing my personal website, and i was in the need of a responsive circle that could have centered text.

    So this is what i came up with. It should work (somewhat) across all browser, and i like it like that. BUT i think it seems abit silly to have a 4 layers of HTML to get the results.

    So i was woundering if anyone could help me clean up the code, and even rewrite it in a different and better way. Because i have at the moment stared my self blind on it.

    Codepen

    Kind regards
    Dennis

    #145542
    eamai
    Participant
    #145576
    Senff
    Participant

    I would add a line-height of 0 to that to get the text vertically centered.

    #145631
    DennisJohnsen
    Participant

    Brilliant guys.

    Adding line-height of 0 to your solution eamai makes it work. Though its limited to one line of text, but that is fine.

    Some times its difficult to think simple ;-)

    #145549
    Nishant
    Participant

    @eamai
    You should add line-height:0; in your PEN. without it , If you are on a really small screen then your “ICON” will no longer available in center.

    TRY iT: http://codepen.io/anon/pen/cqoFv

    @FULL SCREEN : http://codepen.io/anon/full/cqoFv

    #145550
    Nishant
    Participant

    @eamai
    You should add line-height: 0; in your PEN. without it , If you are on a really small screen then your “ICON” will no longer available in center.

    TRY iT: http://codepen.io/anon/pen/cqoFv

    @FULL SCREEN : http://codepen.io/anon/full/cqoFv

    #155115
    gasablanca
    Participant

    Wonderful stuff! Who knows how to align the text at the top and maintain the circle shape?

    best regards,

    gasablanca

    #155120
    Paulie_D
    Member

    Who knows how to align the text at the top and maintain the circle shape?

    Not possible just yet.

    #155223
    paulob
    Participant

    Did you mean something like this?

    Not sure its very useful in this form.

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