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 trialNathan Begnaud
8,221 PointsTrying To Position Text, Not Working. What Am I Doing Wrong?
It keeps moving when I resize my window from left to right. People tell me it's not good to have everything positioned as absolute so I'm trying to avoid that. Here's me 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;
float: right ;
margin-right: 250px;
margin-bottom: 0px;
font-family:Cambria, "Hoefler Text", "Liberation Serif", Times, "Times New Roman", serif;
font-size: 24px;
width: 450px;
height: 200px;
}
.txtmedia {
float: right ;
position: fixed;
width: 200px;
height: 200px;
margin: 50px 0px 0 0px;
padding: 0 auto;
border: 1px solid white;
}
1 Answer
Colton Fitzgerald
15,815 PointsWell, you have float:right (which will make it all the way to the right of your browser window) and margin-right:250px which is going to push it from the right by 250px. That's why it would be moving. How are you trying to position your text?
Nathan Begnaud
8,221 PointsNathan Begnaud
8,221 PointsI'm trying to position it to the right side of my picture. For some reason it's really complicated.