1

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

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

4 Answers 4

3

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>
Sign up to request clarification or add additional context in comments.

Comments

3

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.

Comments

0

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

Comments

0

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" />

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.