css make all text center

/* Using flex to center anything*/
.parent{
  display: flex;
  justify-content: center; /* Centering Horizantly */
  align-items: center; /* Centering Vertically */
  /* Every element inside this div will be centered*/
}
/* Using Line Height*/
.main-div{
  width: 50%;
  height: 40px;
}
.main-div p{
  line-height: 40px; /* Same as parent height*/
  /* p will be centered vertically inside its parent div*/
}
/* CSS Property */
p{
  text-align: center;
}

4.1
10
TeaCupApp 110 points

                                     body {text-align: center;}

4.1 (10 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
css paragraph in center how to center text with css css make all text center css how to align text to the center how to center text css get text in center css how to center the text in css allign text to center css center align text css css centering text center text css class css text align in center text center in css css div text center css align text center how to centre align text in css css text align center make text center css text center div css align text in center in css how to centralize text in css css centered text css how to center text a howt o make all the text in centre using css how to align texts at the centre with css how do you center text in css text in center css how to put the text in the middle in css how do i center text in css css text allign centere css text alig center how to bring text in center in css text center with css how to centralize a text in css text align center css make text display in center css center text align css align text center p css how to center a paragraph in css css text center div how to centre text css how to get text in center in css css set text in center text center css text left center css how to make a text center in css how to align text to the center in css css center align text how to center text in css css centre text center text css align text center css how we display text in center in CSS css styling to center text centering a text css How to center a text in css center text in css how to keep a text center in css css text center center text using css css center text css how to center text
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source