How to use style=“text-align:center;” on the ordinary text?











up vote
0
down vote

favorite












For now I have used <h1></h1>
What to do if I want to center the text without using the header?










share|improve this question


























    up vote
    0
    down vote

    favorite












    For now I have used <h1></h1>
    What to do if I want to center the text without using the header?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      For now I have used <h1></h1>
      What to do if I want to center the text without using the header?










      share|improve this question













      For now I have used <h1></h1>
      What to do if I want to center the text without using the header?







      html html5






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 7 at 20:33









      Mr Korni

      214




      214
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote
















          h1{
          text-align: center;
          }
          p{
          text-align: left;
          }

          <h1>My Text<h1/>
          <p>some other text</p>





          You should start using css to code everything about the html properties, not inside the html code






          share|improve this answer




























            up vote
            1
            down vote













            Text -- regular paragraphs of text -- should be wrapped in paragraph tags (<p></p>). You can then center all p tags (or just the one you're targetting).






            p {
            text-align: center;
            }

            <h1>I am a heading</h1>

            <p>I am regular text</p>





            Alternatively, if you want to center everything, you can style the <body> tag.






            body {
            text-align: center;
            }

            <h1>I am a header</h1>
            <h2>I am a subheader</h2>

            I am unwrapped text.

            <p>I am text in a paragraph tag.</p>





            Note that putting the style on the body will center everything.



            (Some browsers will implicitly wrap your regular text in <p> tags if you don't, but it's much better practice for you to do it yourself.)






            share|improve this answer





















              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














               

              draft saved


              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53197385%2fhow-to-use-style-text-aligncenter-on-the-ordinary-text%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              1
              down vote
















              h1{
              text-align: center;
              }
              p{
              text-align: left;
              }

              <h1>My Text<h1/>
              <p>some other text</p>





              You should start using css to code everything about the html properties, not inside the html code






              share|improve this answer

























                up vote
                1
                down vote
















                h1{
                text-align: center;
                }
                p{
                text-align: left;
                }

                <h1>My Text<h1/>
                <p>some other text</p>





                You should start using css to code everything about the html properties, not inside the html code






                share|improve this answer























                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote












                  h1{
                  text-align: center;
                  }
                  p{
                  text-align: left;
                  }

                  <h1>My Text<h1/>
                  <p>some other text</p>





                  You should start using css to code everything about the html properties, not inside the html code






                  share|improve this answer















                  h1{
                  text-align: center;
                  }
                  p{
                  text-align: left;
                  }

                  <h1>My Text<h1/>
                  <p>some other text</p>





                  You should start using css to code everything about the html properties, not inside the html code






                  h1{
                  text-align: center;
                  }
                  p{
                  text-align: left;
                  }

                  <h1>My Text<h1/>
                  <p>some other text</p>





                  h1{
                  text-align: center;
                  }
                  p{
                  text-align: left;
                  }

                  <h1>My Text<h1/>
                  <p>some other text</p>






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 7 at 20:35









                  Jose Manuel Zuñiga Moreno

                  207




                  207
























                      up vote
                      1
                      down vote













                      Text -- regular paragraphs of text -- should be wrapped in paragraph tags (<p></p>). You can then center all p tags (or just the one you're targetting).






                      p {
                      text-align: center;
                      }

                      <h1>I am a heading</h1>

                      <p>I am regular text</p>





                      Alternatively, if you want to center everything, you can style the <body> tag.






                      body {
                      text-align: center;
                      }

                      <h1>I am a header</h1>
                      <h2>I am a subheader</h2>

                      I am unwrapped text.

                      <p>I am text in a paragraph tag.</p>





                      Note that putting the style on the body will center everything.



                      (Some browsers will implicitly wrap your regular text in <p> tags if you don't, but it's much better practice for you to do it yourself.)






                      share|improve this answer

























                        up vote
                        1
                        down vote













                        Text -- regular paragraphs of text -- should be wrapped in paragraph tags (<p></p>). You can then center all p tags (or just the one you're targetting).






                        p {
                        text-align: center;
                        }

                        <h1>I am a heading</h1>

                        <p>I am regular text</p>





                        Alternatively, if you want to center everything, you can style the <body> tag.






                        body {
                        text-align: center;
                        }

                        <h1>I am a header</h1>
                        <h2>I am a subheader</h2>

                        I am unwrapped text.

                        <p>I am text in a paragraph tag.</p>





                        Note that putting the style on the body will center everything.



                        (Some browsers will implicitly wrap your regular text in <p> tags if you don't, but it's much better practice for you to do it yourself.)






                        share|improve this answer























                          up vote
                          1
                          down vote










                          up vote
                          1
                          down vote









                          Text -- regular paragraphs of text -- should be wrapped in paragraph tags (<p></p>). You can then center all p tags (or just the one you're targetting).






                          p {
                          text-align: center;
                          }

                          <h1>I am a heading</h1>

                          <p>I am regular text</p>





                          Alternatively, if you want to center everything, you can style the <body> tag.






                          body {
                          text-align: center;
                          }

                          <h1>I am a header</h1>
                          <h2>I am a subheader</h2>

                          I am unwrapped text.

                          <p>I am text in a paragraph tag.</p>





                          Note that putting the style on the body will center everything.



                          (Some browsers will implicitly wrap your regular text in <p> tags if you don't, but it's much better practice for you to do it yourself.)






                          share|improve this answer












                          Text -- regular paragraphs of text -- should be wrapped in paragraph tags (<p></p>). You can then center all p tags (or just the one you're targetting).






                          p {
                          text-align: center;
                          }

                          <h1>I am a heading</h1>

                          <p>I am regular text</p>





                          Alternatively, if you want to center everything, you can style the <body> tag.






                          body {
                          text-align: center;
                          }

                          <h1>I am a header</h1>
                          <h2>I am a subheader</h2>

                          I am unwrapped text.

                          <p>I am text in a paragraph tag.</p>





                          Note that putting the style on the body will center everything.



                          (Some browsers will implicitly wrap your regular text in <p> tags if you don't, but it's much better practice for you to do it yourself.)






                          p {
                          text-align: center;
                          }

                          <h1>I am a heading</h1>

                          <p>I am regular text</p>





                          p {
                          text-align: center;
                          }

                          <h1>I am a heading</h1>

                          <p>I am regular text</p>





                          body {
                          text-align: center;
                          }

                          <h1>I am a header</h1>
                          <h2>I am a subheader</h2>

                          I am unwrapped text.

                          <p>I am text in a paragraph tag.</p>





                          body {
                          text-align: center;
                          }

                          <h1>I am a header</h1>
                          <h2>I am a subheader</h2>

                          I am unwrapped text.

                          <p>I am text in a paragraph tag.</p>






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 7 at 20:37









                          Roddy of the Frozen Peas

                          6,97482558




                          6,97482558






























                               

                              draft saved


                              draft discarded



















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53197385%2fhow-to-use-style-text-aligncenter-on-the-ordinary-text%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              這個網誌中的熱門文章

                              Academy of Television Arts & Sciences

                              L'Équipe

                              1995 France bombings