I have an image that links to my homepage. Is there an attribute that I can specify to right align the image within its column (my code below)? I don't want to use anything more complicated than using just an attribute. Thanks.
Please note: I just wan开发者_C百科t to right align ONLY this image. Not the whole div.
<div class="leftCol">
<asp:HyperLink ID="HyperLink" runat="server" ImageUrl="~/home.jpg" NavigateUrl="http://myhomepage.edu">HyperLink</asp:HyperLink>
</div>
Use CSS:
<style type="text/css">
.leftCol a img { float: right; }
</style>
<div class="leftCol">
some text here <asp:HyperLink ID="HyperLink" runat="server" ImageUrl="~/home.jpg" NavigateUrl="http://myhomepage.edu">HyperLink</asp:HyperLink>
</div>
or (better)
<style type="text/css">
.rightAlign { float: right; }
</style>
<div class="leftCol">
some text here <asp:HyperLink CssClass="rightAlign" ID="HyperLink" runat="server" ImageUrl="~/home.jpg" NavigateUrl="http://myhomepage.edu">HyperLink</asp:HyperLink>
</div>
Its recommended to place the CSS in your stylesheet file, but for demonstration purposes, I included the style inline here.
<div class="leftCol">
<div>
Stuff that should align left
</div>
<div style="float:right; display:inline;">
<asp:HyperLink ID="HyperLink" runat="server" ImageUrl="~/home.jpg"
NavigateUrl="http://myhomepage.edu">HyperLink</asp:HyperLink>
</div>
</div>
<style type="text/css">
.link
{
float: right;
}
</style>
<div>
<asp:HyperLink ID="HyperLink1" runat="server" ImageUrl="~/logo.png" CssClass="link">HyperLink</asp:HyperLink>
</div>
</form>
精彩评论