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
Nathan Begnaud
8,221 PointsHow To Position Text To The Side of an Image?
I have a nivoslider image gallery and to the side of it I want to make text. However, The text is either underneath it, or above it. No matter how much I push the margin and padding it won't go to the side of it which confuses me. Here's my code:
<div id="mediatxt"><p>This is our pictures we enjoy media.</p></div><br /><div class="txtmedia"><p>jhf ghfghfghfghfghffg hjgfgh f ydhsdrhdg hdfhf jf jhf gffj jhf ghfnhgfghdgh fdfdhdf hgf hgfghcfg hgfghfghdfghd ghfhgdh gdf hgdfdc ghfdf nhgf hgdfghdf ghf hgc fhdc hd hcfd hcfd cdc hgdf.</p></div>
#mediatxt {
position: relative;
padding-top: 0px;
margin-left: 60%;
margin-bottom: 0px;
font-family:Cambria, "Hoefler Text", "Liberation Serif", Times, "Times New Roman", serif;
font-size: 24px;
overflow:;
color: white;
}
.txtmedia {
position: relative;
padding-top: 100px;
margin-bottom:;
margin-left: 60%;
}
1 Answer
Erik McClintock
45,783 PointsNathan,
For one, you have a break (<br>) set up between your two divs, which is creating a line break between them (as it's meant to).
Secondly, for a simple way to make text flow alongside another container, simply float that container!
Erik