CSS not taking effect
What to look for when I have associated a CSS file with my Default.aspx file but CSS is not putting any effect on it?
This is not working:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ColumnLayout._Default" %>
<!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">
<link type="text/css" href=ColumnLayout.css media="all"/>
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<P>AAAA AAAA AAAA</P>
<DIV ID="col开发者_StackOverflow中文版umns">
<P>BBBB BBBB BBBB</P>
<DIV ID="right">
<P>CCCC CCCC CCCC CCCC</P>
</DIV>
<P>DDDD DDDD DDDD DDDD</P>
</DIV>
<P>EEEE EEEE EEEE EEEE</P>
</div>
</form>
</body>
</html>
ColumnLayout.css
#columns
{
position: relative;
top: 0;
right: 0;
padding-right: 10em;
}
#right
{
position: absolute;
top: 0;
right: 0;
width: 9em;
}
Both are in the same directory.
I am expecting 3 rows. And there should be two columns within the 2nd row.
<link rel="stylesheet" type="text/css" href="ColumnLayout.css" media="all"/>
I am assuming ColumnLayout.css
and the page live in the same location. Otherwise, make sure you specify the right URL for the CSS file.
See Specifying external style sheets.
You forgot rel="stylesheet"
on the link
element.
精彩评论