|
Posted by Ben C on October 24, 2006, 12:39 pm
Please log in for more thread options
> I can't seem to get the image to align right with the a textbox to the
> right of it.The datepicker image is now right justificed but the top of
> the imiage is about at the middle of the textbox and label:
A float is vertically aligned differently from an inline replaced (e.g.
a normal img).
An inline replaced sits on the baseline. But a float has its top edge
aligned with the top of the line box.
I can think of two solutions.
1. Use a table with one row and two cells with vertical-align: baseline.
Put the text in the first cell and the image in the second.
2. A bit more unusual, set text-direction: rtl on the container, and
text-direction: ltr on the asp:Label, and leave the image as an
inline replaced (i.e. don't float it).
> <td >
> <asp:Label ID="StartDateLabel" runat="server" Text="Start
> Date:"></asp:Label>
> <div style="float:right;vertical-align:top"/>
> <asp:imagebutton ImageAlign=top ID="Imagebutton1" width=20 Height=20
> CommandName=SetDate
> imageUrl="../App_Themes/WinXP_Silver/Images/datepicker.gif"
> runat=server />
> </div>
> </td>
>
> Also, the above is affecting the label pushing it up.
>
>
>
> Ben C wrote:
>> > Is that possible? How?
>>
>> Set text-align: left on the cell as usual (it's likely to be the
>> default), and make the image float: right.
>>
>> To work around a Firefox float bug, better to put the image before the
>> text in the source. Otherwise it will always end up on the next line.
>
|