Sergio Tapia
Sergio Tapia

Reputation: 41208

Using CSS on a webform that's using a MasterPage

How can I apply CSS to a Web Content Form that is using a MasterPage?

I can't apply Class="" anywhere. :S Any help?

Upvotes: 1

Views: 1526

Answers (4)

balexandre
balexandre

Reputation: 75113

in Web Controls the attribute is CssClass and not Class as it is in HTML Controls

<style type="css/text">
    .myClass { font-size: x-large; }
</style>

then

<asp:Label ID="myLabel" runat="server"
           CssClass="myClass" Text="This is a WebControl Label" />

as opposed to:

<span class="myClass">This is a HTML Lable</span>

Upvotes: 3

Robert Williams
Robert Williams

Reputation: 1340

Be sure you stylesheet is referenced properly in your web content form.

<link id="link1" rel="stylesheet" href="myStyleSheet.css" type="text/css" runat="server" />

Upvotes: 0

Aaron Daniels
Aaron Daniels

Reputation: 9664

I've never had an issue with this. If it's not rendering, then make sure your path to your CSS file is correct.

Upvotes: 0

SLaks
SLaks

Reputation: 888077

Why can't you?

CSS works in content pages the smae way it works in regular pages.

If you're actually asking how to add CSS rules for the content page, you need to add a placeholder in the HEAD element in the master page, then add CSS rules or files to that placeholder in the content page.

Upvotes: 3

Related Questions