Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to center-justify a multi-line text block that is centered in div using flex?

Posted on 2016-11-18
5
Medium Priority
?
95 Views
Last Modified: 2016-11-23
I'm new to flex. Here is what I'm trying to use so far?

.communityPromo{
  width:100%;
  max-width: none !important;
  display: flex;
  flex-flow: row wrap;
  justify-content: center;    // center text block
  align-content:center;

This centers the text block in the div, but the text block remains left-justified.
}
0
Comment
Question by:dlearman1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 59

Expert Comment

by:Julian Hansen
ID: 41894116
Can you show us more of your code - the style is not enough to replicate the problem.
0
 

Author Comment

by:dlearman1
ID: 41894326
0
 
LVL 59

Accepted Solution

by:
Julian Hansen earned 2000 total points
ID: 41894548
Add text-align: center to the <p>
communityPromo  > p{
  max-width:50rem;
  text-align: center;
}

Open in new window

justify-content is about how to arrange space around the child elements.
0
 

Author Closing Comment

by:dlearman1
ID: 41899684
Thanks Julian... that worked great
0
 
LVL 59

Expert Comment

by:Julian Hansen
ID: 41899728
You are welcome.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question