Center Text in HTML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sonia
    Member
    • Nov 2012
    • 76

    Center Text in HTML

    <center></center> tags are used in HTML to center text or use a style sheet property.

    Using the <center></center> tags
    Using a style sheet property

    Using a style sheet property : We can also center text using CSS. This is done using the text-align property on the element which contains the text you need to center.

    If you have one or few blocks of text you need to center then you could include the style in the HTML code for the element, such as a <p></p> element, using the style attribute:
    <p style="text-align:center;">This text needs to be centered!</p>
    If you have many blocks of text you would like to center, you can use CSS inside <style></style> tags within the head section on the page to declare that every element be centered.
    <style>
    p { text-align:center; }
    </style>
    If you would like some paragraphs centered while others are not, you can create a style cl*** as seen in the below code.

    <style>
    .center { text-align: center; }
    </style>
  • neharani
    Member
    • Dec 2012
    • 85

    #2
    Can you explain me about Internal styling and external styling in HTML ??

    Comment

    • sonia sharma
      Senior Member
      • Jul 2015
      • 156

      #3
      An internal stylesheet holds the CSS code for the webpage in the head section of the particular file. This makes it easy to apply styles like cl***es or id's in order to reuse the code. The downside of using an internal stylesheet is that changes to the internal stylesheet only effect the page the code is inserted into.

      The External Stylesheet is a .css file that you link your website to. This makes it so that what ever you change in the .css sheet, will effect every page in your website. This prevents you from having to make many code changes in each page. This is for "global" site changes.

      Comment

      • premdayalmca
        Junior Member
        • Aug 2015
        • 5

        #4
        <style>
        text-aline:center;
        </style>
        Cheap Domestic Air Tickets

        Cheap Cab Rates In Chennai

        Comment

        • Daljeet
          Senior Member
          • Dec 2014
          • 205

          #5
          Thanks for sharing this information.

          Comment

          • sangeetanegi
            Senior Member
            • Dec 2015
            • 140

            #6
            Thanks for sharing this informative post.

            Comment

            • shilparana
              Senior Member
              • May 2015
              • 194

              #7
              useful answer @adlersmith. Thanks for sharing.

              Comment

              • sapnathakur
                Member
                • Jan 2016
                • 33

                #8
                Really Informative Post! thanks a lot for sharing this post with us.

                Comment

                • Guest

                  #9
                  Align centre is an attribute that can set the particular image or text in centre of the screen.

                  Comment

                  Working...
                  😀
                  😂
                  🥰
                  😘
                  🤢
                  😎
                  😞
                  😡
                  👍
                  👎