Forums

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

Home Forums CSS [Solved] How i can give text center position

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #171559
    kenpati
    Participant

    How i can give text center position. please watch this example
    Link

    and when i write some text he can stay only in center position. Please help)

    #171561
    Atelierbram
    Participant

    Setting the p element to display: inline (from default block value) changes it’s box, text-align: center will work, but only on that smaller box (so will have no detectable visual difference). When removing that display property and value, and add: text-align: center will make it centered aligned.

    
    div#line p.line-item1 {
      margin:0 auto;
      /* display:inline; */
      text-align: center;
      outline:1px solid red;
      background:#fff;
    }
    
    #171567
    kenpati
    Participant

    I mean position center only tag p without width:100%;
    tag p occupy only the desired width like display:inline;
    I want to see my gray block)

    #171568
    Paulie_D
    Member
    #171570
    kenpati
    Participant

    Paulie_D, That what i mean. Thanks

    #171572
    kenpati
    Participant

    text-align in div#line like margin:0 auto; ?

    #171573
    Paulie_D
    Member

    text-align in div#line like margin:0 auto; ?

    No…like this.

    div#line {
      text-align: center;
    }
    
    #171575
    kenpati
    Participant

    anyway thanks guys.

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