Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 14th, 2012, 07:36 AM
Registered User
 
Join Date: Aug 2012
Posts: 8
Thanks: 2
Thanked 0 Times in 0 Posts
Default MainContent div ignores width setting?

Hi;

I can't get the MainContent div to accept the width setting from the .css stylesheet Styles.css. The box simply ignores the "664px" setting and uses the entire 844px, pushing the Sidebar onto the next line.

I have pasted the relevant code below, any suggestions would be gratefully received!

Code for Frontend.master:

Code:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Frontend.master.cs" Inherits="MasterPages_Frontend" %>

<!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="../Styles/Styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div id="pageWrapper">
        <div id="Header"><a href="~/" runat="server">Header Goes Here</a></div>
        <div id="MenuWrapper">Menu Goes Here</div>
        <div id="Main Content">
        <asp:ContentPlaceHolder ID="cpMainContent" runat="server"></asp:ContentPlaceHolder></div>
        <div id="Sidebar">Sidebar Goes Here</div>
        <div id="Footer">Footer Goes Here</div>
    </div>
    </form>
</body>
</html>

Code for Styles.css:

Code:
#Header
{
    background-color: #C0C0C0;
    width: 844px;
    height: 86px;
}

*
{
    font-family: Arial;
}

h1
{
    font-size: 20px;
}

#PageWrapper
{
    width: 844px;
}

#MenuWrapper
{
    width: 844px;
}

#MainContent
{
    width: 664px;
    float: left;
}

#Sidebar
{
    background-color: Gray;
    width: 180px;
    float: left;
}

#Footer
{
    background-color: #C0C0C0;
    width: 844px;
    clear: both;
}
 
Old August 14th, 2012, 09:02 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You have a space between Main and Content in the id for the div element.....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
hopper3011 (August 14th, 2012)
 
Old August 14th, 2012, 09:15 AM
Registered User
 
Join Date: Aug 2012
Posts: 8
Thanks: 2
Thanked 0 Times in 0 Posts
Default Thank you

Thank you Imar.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Sizing Div Width with window resizing javs Javascript 1 March 20th, 2008 01:13 AM
IE div columns width glitch discgolfer BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 4 February 23rd, 2006 05:51 PM
accessing dynamic div width data Ma7T Javascript 1 August 18th, 2005 03:50 PM
Dynamic div - width Ma7T Javascript How-To 2 August 18th, 2005 09:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.