Forums

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

Home Forums CSS [solved] flexible-width contents within a fixed width container using CSS

  • This topic is empty.
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #174886
    jack_Quarry
    Participant

    Hello,
    I have been trying to create a flexible banner strip like this,

    <——————- fixed width ————->

    <- – – – – – – – main container – – – – – – – ->
    ———— Variable text content ————
    <–border–> T E X T <–border–>

    method1:
    define background for main container & center the text content
    example:http://jsfiddle.net/G4DNq/

    But I would like to do the same thing without using background,
    < text content>

    whereby the width of the contents are flexible so that the text content (always center-aligned) pushes out the border styles.
    Ofcourse the width of text content < width of main container.

    example:http://jsfiddle.net/Lz4PC/1/

    But this one is not flexible and the width of the contents are fixed.

    Is this possible using pure css?

    #174887
    Paulie_D
    Member
    #174889
    jack_Quarry
    Participant

    This is great.
    http://codepen.io/TheEnd/pen/zFCne

    But isn’t it possible to do it the other way.

    Variable Text Content

    *whereby the width of the contents are flexible so that the text content (always center-aligned) pushes out the border styles.

    #174891
    Paulie_D
    Member

    You’d have to show me what that would look like.

    Don’t worry about how you achieve it..I ‘m just having trouble working out what it is you are trying to do.

    #174892
    Paulie_D
    Member
    #174895
    jack_Quarry
    Participant

    Check this out.
    http://jsfiddle.net/2u6kV/

    #174897
    Paulie_D
    Member

    So you’ve done it…

    Is this solved?

    #174904
    jack_Quarry
    Participant

    No it’s not done.
    Is it possible to accomplish the same using only CSS?

    #174905
    MDMueller
    Participant
    #174907
    jack_Quarry
    Participant

    Thanks. But is it not possible to make the same without using Pseudo-classes? I hope I am not being too demanding.:/

    I was wondering if it is possible using calc?
    https://developer.mozilla.org/en-US/docs/Web/CSS/calc

    #174908
    Paulie_D
    Member

    But is it not possible to make the same without using Pseudo-classes? I hope I am not being too demanding.:/

    Frankly, yes…I think your expectations are a little unrealistic.

    #174909
    MDMueller
    Participant

    Sure, you could use a normal div aswell, but then you’ve got 1 more (unnecessary) tag. Or you could use border-box and a background-image.

    Why don’t u wanna use pseudo classes?

    #174910
    jack_Quarry
    Participant

    Ok guys. I am being impractical here & sorry for wasting your time. Clean and viable CSS it is then. Lets wrap it up and consider it answered.

    Thank you for your help and time.

    #174944
    jack_Quarry
    Participant

    Thanks for your answer but I am looking to solve this without using Pseudo classes.

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