So, I was messing around with asp.net, and I seem to be stuck in a CSS issue. When I float the div to the right, it works as expected. However, when I move this style to an external stylesheet, it doesn't work at all.
I understand that inline styles have a higher priority and something may interfere, but I can't figure that out.
Here is my page
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <asp:ContentPlaceHolder id="head" runat="server"> </asp:ContentPlaceHolder> <link href="StyleSheet.css" rel="stylesheet" type="text/css" /> </head> <body> <form id="form1" runat="server"> <div> ***********************the div below that has style="float:right"**************** <div class="Header"><div style="float:right"><asp:Label ID="lblMasterMessage" runat="server" /></div>Stephen Granets Site!</div> ******************************************************************************** <div class="ColumnLeft" > //stuff </div> <div class="SiteMap"> <asp:SiteMapPath ID="SiteMapPath1" runat="server"> <CurrentNodeStyle Font-Bold="True" /> <NodeStyle CssClass="ContentLink" Font-Bold="True" /> <RootNodeStyle CssClass="ContentLink" Font-Bold="True" /> </asp:SiteMapPath> </div> <div class="ColumnCenter"> <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </div> </div> <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" /> </form> </body> </html>
And here is the stylesheet
body { } .Header { background-color: #6699FF; font-family: Verdana; font-size: xx-large; font-weight: bold; color: #FFFFFF; padding: 40px 0px 0px 10px; width: 100%; } .ColumnLeft { padding: 7px; background-color: #6699FF; float: left; } a { color: #000000; text-decoration: none; } a:visited { color: #000000; text-decoration: none; } a:link { color: #000000; text-decoration: none; } a:hover { color: #FFFFFF; text-decoration: underline; } .underline { text-decoration: underline; } .ColumnCenter { margin: 7px 7px 7px 175px; } a:hover.ContentLink { color: #000000; text-decoration: underline; } .SiteMap { font-size: large; background-color: #DFEAFF; }
When I use it in an external stylesheet, this is the code
<div class="test">asp label</div>
and my css sheet has this added
.test { float:right; }
Question: So why does a style work when I put it in a string, but it does not work when I move this exact piece of code to an external stylesheet?
source share