Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

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.

Carl,

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; }