How to put <style> in content page

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

I use vs2005 to develop web application.
I have used the new feature of master page of VS2005, and I have put some
<style> in the master page.
But I want to override some Style sheet in the content page.
Where to put the <style> in the content page ?
 
I don't think you can because the content place holder puts eveything within
div tags. Try a different aproach, try using css classes to define your
styles, you can then apply them to the relevent tags wherever you want, using
code.
 
Try one of the following in your page's Load event handler.

// Add a style sheet link.
HtmlGenericControl Style = new HtmlGenericControl();
Style.Attributes.Add("type", "text/css");
Style.Attributes.Add("rel", "stylesheet");
Style.Attributes.Add("href", "MyStyle.css");
Header.Controls.Add(Style);

// Add inline style.
HtmlGenericControl Style = new HtmlGenericControl();
Style.InnerText = "h1 { color: #0F0; } .MySelector { background-color:
#F90; }";
Header.Controls.Add(Style);


Good luck!

- Matt


----- Original Message -----
From: ad
Date: 8/4/2006 2:29 AM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top