tags:

views:

30

answers:

2

I have the following :

HTML

<th class="sort">
<div>
    <div class="sort"></div><a href="#">Last Name</a>

</div>
</th>

css:

table.tablesorter thead th.sort
{
    padding:0;
}

table.tablesorter thead th div.sort 
{
    margin:0;
    width:15px;
    height:30px;
    float:left;
    background: url("/Content/images/admin/sort.png") no-repeat;
    background-position: 0px center;
    cursor:pointer;
}

table.tablesorter thead tr th.sort a 
{
    cursor:pointer;
 color:inherit;
    vertical-align:middle;
    float: left; 
    padding-top: 7px;
}

I want to display inner and inside vertically aligned middle and always on ONE line so that when a browser window is resized (small) it will not break and will not more underneath inner (which is what is happening now). thanks

A: 

use the "display inline" command...

<div style="display:inline;float left;"><a href="#">First name</a></div>
<div style="display:inline;float right;"><a href="#">Last name</a></div>
David
I'd rather float them both left with a clear:none; command because floating the second div right may place it miles away from the other one if the parent element is very wide. They can then be visually style using margins or padding. Be wary though, ie6 has a nasty double float margin bug - http://www.positioniseverything.net/explorer/doubled-margin.html
webfac
A: 

Its not clear to me what "inner" and "inside" youre referring to (you mught want to update and elaborate a bit, as well as post the complete markup for the table) but it sounds like you basically want everything in the th to be in one continuous line regardless of avialable space. You can turn off the text from wrapping with whitespace: nowrap;. However your content is going to overflow the th because thats how table cells work, so you need to set overflow: hidden on something that wraps the text. Unless yo need more than one elemment inside the cells you dont need the float.

The markup might look like this:

<thead>
  <th><div class="clip sort"><a href="#">First Name</a></th>
  <th><div class="clip sort"><a href="#">Last Name</a></th>
</thead>

Whith the css like so:

.clip {width: 100%; overflow: hidden; whitespace: nowrap;}
th {vertical-align: middle; height: 30px;}
prodigitalson
@prodigitalson - setting the the to vertical-align:middle; will not result in the div being vertically aligned though will it?
webfac
not sure.... normally no, but table-cells have different rules and generally respect vertical-align... but i dont recall if that will apply to a div or not since it a block element...
prodigitalson