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 May 6th, 2014, 01:57 AM
Authorized User
 
Join Date: Jun 2012
Posts: 45
Thanks: 11
Thanked 0 Times in 0 Posts
Default Chapter 3 - layout pages

When using Layout Page scheme, Is there any Easy CSS solution for changing the CONTENT Background-color. I tried including a DIV ID in my content page and then changing it in the CSS many different ways but was unsuccessful.

Thanks
Eddie in Mesquite
 
Old May 6th, 2014, 04:25 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 Eddi,

You can set a background-color on the #MainContent selector which is used to define the content of the page. The sample CSS already has this set.

Hope this helps,

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!
 
Old May 6th, 2014, 10:56 AM
Authorized User
 
Join Date: Jun 2012
Posts: 45
Thanks: 11
Thanked 0 Times in 0 Posts
Default Different Content background-color

Thanks for responding Imar,

How about if I want to Have different background-colors for the Content area, depending on the page. I was able to do it via jQuery, but was having trouble with two ID tags, and not able to do it via a CSS page. (? Would this be easier if the CONTENT was a class instead of an ID. I read a discussion on that, this might be a perfect example)
I set a div/ID for a page and tried to do it via a CSS page but two ID was creating problems...

Thanks Imar, Eddie
(my apologies for not being clearer initially)
 
Old May 6th, 2014, 04:04 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Since there's only 1 MainContent div element in the page, it doesn't really matter if you use an ID or a class.

Adding the following to a page should do the trick:

<style>
#MainContent {
background-color: red;
}
</style>

This overrides the background color set in the main CSS file.

Cheers.

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:
EDGY (May 6th, 2014)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 3 - Passing Data from the Layout to a Section hanci BOOK: Beginning ASP.NET Web Pages with WebMatrix 4 May 12th, 2017 08:21 AM
Chapter 6 DarkGrey.CSS doesn't have any layout information mordigoff BOOK: Beginning ASP.NET 4 : in C# and VB 4 April 4th, 2014 12:33 AM
Chapter 2, pg 82. "R.layout.main" Error Nick Makin BOOK: Beginning Android 4 Application Development 1 July 17th, 2013 08:45 PM
Chapter 3 Nested Layout Pages jpjamie BOOK: Beginning ASP.NET Web Pages with WebMatrix 1 December 31st, 2011 04:36 PM
Chapter 9 Protecting Your Pages malhyp Dreamweaver (all versions) 1 August 20th, 2005 04:14 AM





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