• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Css showing text in left and right blocks when wrapped

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Code of html is:
------------------------------­------------------------------­------------
<style>
.container {}
.left-content {
   float: left;
   width: 49%;
   }
.right-content{
   float: right;
   width: 49%;
   text-align: left; /* depends on element width */
   }
</style>
   <div class="container">
  <span class="left-content">
  Content in left itemdsssssssssssssssssssssssss­ssssssssssss sddddddddddddddddddddddddddddd­ddddddd :
  </span>

  <span class="right-content">
  Content in right item
  </span>
</div>

------------------------------­------------------------------­---------------------

what iam getting is

sdsdsdsd sdsdsds itemdsssssssssssssssssssssssssssssssssssss      tobe shown in right
 sdddddddddddddddddddddddddddddddddddd : :::

What i want is

sdfsdfdfdfd item dsssssssssssssssssssssssssssssssssssss                     
 sdddddddddddddddddddddddddddddddddddd ::::                       tobe shown in right

waht i want  is right content aligned with : in 2 line and not on first line..
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like you need some top margin or padding.
 
anand kumarblr
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

If i give margin-top:30px; it will come as required, but the problem is this must apply only when the text is wrapped or else it must show on first line only...
 
Author
Posts: 26
MySQL Database PHP
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm — float works against you in cases like this.

Try using positioning instead:



Might need some adjustments for IE6 and IE7.

Larry
reply
    Bookmark Topic Watch Topic
  • New Topic