Solved

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

Posted on 2016-11-18
5
69 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 57

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 57

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 57

Expert Comment

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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

CSS3 Custom checkboxes This article shows how to style the checkbox form element using only CSS. Works in: Chrome, FF, Safari, Opera, IE9+ Uses modernizr.js to check for :checked pseudo class, falling back to plain old checkboxes (IE8 and bel…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
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…

717 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