Jump to content

100% Width Floating Div


danbopes

Recommended Posts

Here is my predicament:

links.jpg

 

I have some text, followed by a 1px line with a left and right border to make it "fade-out" so to say.  All I need is the line to fill up whatever space is left in the line.

 

I can't do:

<div style="float: left; width: 100px">iO Links</div><div style="float: left; width: 400px" class="bar"></div>

Because I don't know if the bar is always going to be 400px (Because "iO Links" might be some other text like "iO HTML Help", which wouldn't fit in 100px).  Whenever I do 100% for the bar, it will automatically drop to the next line.  So I am not exactly sure what to do.  If you have any questions, feel free, as I can clarify.

Link to comment
Share on other sites

get rid of the DIV for the bar. instead, make it a background on the box. then, on the title, do a background of black to hide the first part of the line:

 

<div style="background: #000 url(bar.gif) repeat-x top left; padding: 10px;">
  <div style="float: left; background: #000; padding-right: 10px;">IO Links</div>
  <div style="clear: left; padding: 5px;">Some links that we ... us feedback</div>
</div>

Link to comment
Share on other sites

<style type="text/css">
  .pima {
    width: 300px;
    color: #FFF;
    padding: 5px;
    background: #000;
    color: #FFF;
    font-family: sans-serif;
    font-size: 0.7em;
  }
  .pima table {
    width: 100%;
    color: #FFF;
    font-size: 1.2em;
  }
  .pima td.pimaTitle {
    width: 1%;
    white-space: nowrap;
    padding-right: 5px;
  }
  .pima .pimaBody {
    padding: 5px;
  }
  
</style>
<div class="pima">
  <table cellspacing=0 cellpadding=0>
    <tr>
      <td class="pimaTitle">iO Links</td>
      <td>[bar code here]</td>
    </tr>
  </table>
  <div class="pimaBody">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque commodo. Sed ut quam eu dui mattis volutpat. Nam convallis, urna a eleifend gravida, augue magna fringilla.</div>
</div>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.