December 15, 201312 yr hey experts,i've got a very simple css question.this is what I have put together. my goal is, to have floatign elements so the design can be responsive to the screen size.<style type="text/css" media="screen">.float1 { float: left; width: 240px; }.float2 { float: left; width: 240px; }.float3 { float: left; width: 12px; margin-bottom: 1em; }</style><div class="float1"> text menüpunkte, etc. </div><div class="float2"> <img src="bild.jpg" border="0" alt="" width="268" height="177" /></div>following issues with that:its working, but if the screen is big enough, the thext that comes unterthose elements continues on the right side. i want it to continue UNTERit.also, the text is sitting a bit lower than the picture.please advice.thanks!
December 15, 201312 yr Author one more... plz:do i have to use that selector thing, in order to use more than one elements?.selector1 {width:400px;height:200px;}
December 15, 201312 yr You will need to clear the floats. Add a clear propperty to the first element after the floating elements with a value of "left" or "both" to make sure it stays below.
December 15, 201312 yr Author okay, ive tried to add a bunch of clearing commands in there which dont seem to work<style type="text/css" media="screen">.clearing { clear: both; }.selector1 {.clearing { clear: both; }width:500px;} .float1 { float: left; width: 250px; } .float2 { float: left; width: 250px; }.clearing { clear: both; } <br style="clear:both;"> at the end of the text in the second box also dont seem to do the trick
December 15, 201312 yr Author still the image is too low. want it to be on line with the text tried to put it in a table as well as use the align="top" command <div class="float2"> <table><tr><td align="top"><img src="images/FS.jpg" border="0" alt="" width="250" align="top"/></td></tr></table> Edited December 15, 201312 yr by bigisbeautiful
December 16, 201312 yr Why not just use a clearfix? I like to use the micro-clearfix to use it you place class="cf" to the containing element <div class="cf"> <div class="float1"> text menüpunkte, etc. </div> <div class="float2"> <img src="bild.jpg" border="0" alt="" width="268" height="177" /> </div> </div>
Create an account or sign in to comment