Solved

Assign a CSS to a DIV

Posted on 2010-08-30
4
346 Views
Last Modified: 2012-05-10
OK, let me first start by saying I'm NEW to ASP.net, so I hope this question doesn't sound stupid!

I have a DIV inside a Content Place Holder so I can change the width and background color to something different from the Master Page.
Here is an example of what it looks like now:
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
    <div style="width: 1000px; background-color:White">

I would like to move these settings to a CSS file instead of having them set in the form, so I can swap out files at will.  I would like the CSS file to contain my width: 1000px and background-color:White so I can change these files in out based on a report selected.

You see I have a Crystal Report Viewer inside a Content Place Holder and I would like to change the width of the DIV when the report is Landscape vs. Portrait, so that the report shows behide a White Background vs. a green background on the Master Page.

Thanks,
Mark
0
Comment
Question by:smithmrk
  • 3
4 Comments
 
LVL 35

Accepted Solution

by:
YZlat earned 500 total points
ID: 33561924
<div class="fakefile">

one way would be to create a class in your css file and then set <div class="mycalss">

another way would be giving your div an id :

<div id="mydiv">

and then in your css file using div id to set the properties
0
 
LVL 35

Expert Comment

by:YZlat
ID: 33561976
  <div style="width: 1000px; background-color:White">

div.myclass
{
  WIDTH: 1000px;
  BACKGROUND-COLOR: White;
}
0
 
LVL 35

Expert Comment

by:YZlat
ID: 33562008
you could also use jquery:

$("#myDiv").addClass('myClass');
0
 

Author Closing Comment

by:smithmrk
ID: 33562221
Thank You!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now