tags:

views:

45

answers:

4

Hey,

I want to place a border with some text in it on the left side and a border with some text on the right IN THE SAME LINE. how do i do it?

Thanks.

THANK YOU ALL FOR YOUR ANSWERS, I GOT IT WORKING. THANKS AGAIN.

A: 

Look into float link text

n8wrl
+2  A: 
<div>
  <div style="float:left;border:solid 1px black;">
    Some text
  </div>
  <div style="border:solid 1px black;">
    More text
  </div>
</div>

Is this what you're looking for?

Keith
Thanks....it worked.
Sarthak Srivastava
A: 

There are several options, depending on the situation:

  • use floats: float: left on the left container, float: right on the right container
  • make them inline elements or inline blocks - display: inline-block can do wonders
  • use absolute positioning, combined with the left and right properties
tdammers
A: 

Maybe something like this:

<html><head>
<style type="text/css">

#content{
    border:2px solid #999;
    padding:10px;
}
.titlebox{
    float:left;
    padding:0 5px;
    margin:-20px 0 0 30px;
    background:#fff;
}
</style></head><body>

<div id="content">
    <div class="titlebox">Title</div>
    <p>Lorem ipsum dolor sit amet consectetuer venenatis vitae Nulla fringilla consequat. Wisi magnis volutpat auctor Nulla Vivamus id In elit dictumst mollis. Curabitur auctor consectetuer dui interdum neque Curabitur vel auctor tellus netus. Sed tincidunt condimentum semper Vestibulum sed tellus ridiculus elit In dictum. Turpis lacus pellentesque In ac volutpat mi non nibh vitae laoreet. Elit.</p>
</div>
</body></html>

can be a good start for you. The example only places text on left side by exploiting a negative top margin but it should be easy to customize it! (taken from here)

You could split .titlebox in two parts by having a right aligned subcomponent (text-align: right) on which you have the right title

Jack