Solved

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

Posted on 2016-11-18
5
50 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
  • 3
  • 2
5 Comments
 
LVL 55

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 55

Accepted Solution

by:
Julian Hansen earned 500 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 55

Expert Comment

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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

840 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