Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


I'm trying to get text positioned using a Flex-box approach. I'm having trouble with such..

<div class="photo-container">
<h1 class="name">Keystone</h1> <img src="..//../Images/IMG_2212.jpg"> <p>This section is going to be dedicated to my furry little friend.laslflasjflasjlfjasl;jfsa aljajfjsalfjlsjlfjsljflsjlfjsljfljslfslajlsjfjlaksfljsfjlsajflsjalfjsaj;fjaslflksajlfjlasjflj alsflsajlfjlasjfljslfjsjdjflskdjflajsljflsajfjlsjfjsjfsjdljflasjfjlsjdkfjlsjfljlsflsjfajslfdk aljdfjalsjfljslfjsdkklsjlfjlsdjfjldjjsldjflskdjflkdsnfksdnfnsdkdnlanlnfnkkdladskfnndlasdda.</p>
</div> /*.photo-container is inside a Flex-container*/

Carl Sergile
Carl Sergile
16,570 Points

Are you trying to get the whole div to center, which would make the whole text inside center? Or the text inside the div called photo container?

2 Answers

James Home
James Home
12,011 Points

Please post your CSS too.


I'm trying to get the text right next to the image, aligned at the top of the div .photo-container

*{ box-sizing:border-box; }

body { font: 1em/1.5 , "Open Sans" , "sans-serif"; margin: 0 0; color: #373737; background: #eaeaea; } /* .flex-container{ display:flex; flex-direction:column; min-height:100vh; flex-wrap:wrap; }

*/ h1{ text-align:center; }

/**Main Styles****/

.main-head{ text-align:center; padding-top:25px; font-size:5em; color: #06303A; text-shadow:1px 2px 4px black;


.photo-container p{ justify-content:flex-end; }

.main-side, .photo-container, .main{ color: #fff; padding: 15px; margin: 30px;
background:#06303A ; border-radius: 15px; box-shadow:2px 2px 4px black; }

.main p{ justify-content:flex-end; }

/*****Image Styles******/

img{ border-radius:250px; }