Welcome to Dream.In.Code
Become an Expert!

Join 150,101 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,850 people online right now. Registration is fast and FREE... Join Now!




Problem with CSS in Master Page

 
Reply to this topicStart new topic

Problem with CSS in Master Page, Layout doesn't work on page when displayed in browser

ross_petersen
27 Jun, 2008 - 01:41 PM
Post #1

D.I.C Head
**

Joined: 6 Aug, 2005
Posts: 58



Thanked: 1 times
My Contributions
Hi folks

I am developing a master page using CSS/DIV.

Basically, the master page and another ordinary aspx page look OK when viewed inside VWD Express 2008, but when the Default2.aspx page is displayed in the browser, the layout is all wrong.

Here is the source code for the master page:

CODE
<%@ Master Language="VB" CodeFile="CCFAjaxMasterPage.master.vb" Inherits="CCFAjaxMasterPage" %>

<!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>Home Page</title>
    <link href="MasterStyleSheet1.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div id="threecrosses" runat="server">
            
            <asp:Image ID="ThreeCrossesImg" runat="server"
                ImageUrl="05_08_11_three-crosses_thumb.jpg" Height="100px"
                Width="207px" BorderStyle="None" />
            
        </div>
        <div id="coppinglogo" runat="server">
        </div>
        <div id="secondrow" runat="server">
            <asp:SiteMapPath ID="SiteMapPath1" runat="server">
            </asp:SiteMapPath>
            <br />
            <br />
            This is the second row</div>
        <div id="navleft" runat="server">
            <asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1"
                ImageSet="XPFileExplorer" NodeIndent="15" BackColor="Teal">
                <ParentNodeStyle Font-Bold="False" />
                <HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
                <SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False"
                    HorizontalPadding="0px" VerticalPadding="0px" />
                <NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black"
                    HorizontalPadding="2px" NodeSpacing="0px" VerticalPadding="2px" />
            </asp:TreeView>
            <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
        </div>
        <div id="content" runat="server">
            <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
            
            </asp:ContentPlaceHolder>
        </div>
        <div id="footer" runat="server">
            This is just the footer</div>
    </form>
</body>
</html>


And here is the CSS stuff:

CODE

body
{
    margin:0px;
    padding:0px;
}
#threecrosses
{
    float:left;
    width: 20%;
    height: 98px;
}
#coppinglogo
{
    float:left;
    width: 80%;
    height: 100px;
}
#secondrow
{
    background: #FF0000;
    width: 100%;
    height: 100px;
    position: relative;
}
#navleft
{
    clear:both;
    background: #008080;
    width: 25%;
    height: auto;
    position: relative;
}
#content
{
    background: #C0C0C0;
    float: left;
    width: 75%;
    height: auto;
    position: relative;
}
#footer
{
    clear: both;
    background: #FF0000;
    float: left;
    width: 133%;
    height: 100px;
    position: relative;
    display: inline;
}


This is the code for the Default2.aspx page:

CODE

<%@ Page Language="VB" MasterPageFile="~/CCFAjaxMasterPage.master" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <p>
    This is some content for the Default2 web page.</p>
</asp:Content>



Unfortunately, the navleft section is being displayed all the way from Left to Right on the screen instead of just taking up 25% on the left hand side. The text in the content part is being displayed underneath the bottom of the navleft section instead of on the right hand side of the navleft section.

So, if anybody could show me where I have blundered, I would be most appreciative.

Kind regards

Ross smile.gif

This post has been edited by ross_petersen: 27 Jun, 2008 - 05:46 PM
User is offlineProfile CardPM
+Quote Post

dbarselow
RE: Problem With CSS In Master Page
29 Jun, 2008 - 07:13 AM
Post #2

New D.I.C Head
*

Joined: 26 Jun, 2008
Posts: 5

Ross allow me to advise you so that you might get a quicker response. You are having a design problem wright, well in order for a person to help with a decent reply he or she will have to create a website load the code and then figure out what it is you mean by all wrong well that is requesting a very tall order. What you should be doing is narrowing your question to exactly what it is that you are having an issue with and then writing a detailed question specific to your issue. You then just might find an answer to your question. I hope you find this helpful now and in the future reagrding support issues.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 12:35AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month