user366312
user366312

Reputation: 16894

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="columns">
            <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.

Upvotes: 0

Views: 849

Answers (2)

Josh Lee
Josh Lee

Reputation: 177520

You forgot rel="stylesheet" on the link element.

Upvotes: 3

Sinan &#220;n&#252;r
Sinan &#220;n&#252;r

Reputation: 118118

<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.

Upvotes: 3

Related Questions