0

I am trying to style an ASP textbox by linking it to my CSS file. However, the standard textbox remains. Here is my code:

<asp:TextBox ID="txtFName" runat="server" CssClass="tb5"></asp:TextBox>

CSS file:

.tb5 {
    border:2px solid #456879;
    border-radius:10px;
    height: 22px;
    width: 230px;
}

This code is being used off a master page. Is there any other referencing I need to do or anything else missing? Thanks!

9
  • please make sure your css file is loaded Commented Feb 18, 2014 at 12:02
  • Is your css file linked into the page? Commented Feb 18, 2014 at 12:02
  • try <asp:TextBox ID="txtFName" runat="server" class="tb5"></asp:TextBox> Commented Feb 18, 2014 at 12:05
  • 2
    can show the code already rendered (html)? Commented Feb 18, 2014 at 12:06
  • 1
    The fact is that should work, so starting with the basics. Make sure the CSS page is linked in correctly. Then as someone else already said, try refreshing the browser and clearing the cache. This can be done via shift + F5or CTRL + F5. The problem should have been caused by one of these reasons. If the problem is still occurring there maybe some conflicting code. Commented Feb 18, 2014 at 12:10

3 Answers 3

2

Refresh your browser cache (e.g. by pressing Ctrl+R). Examine your text box in browser with Developer Tools, putting attention to styles.

Sign up to request clarification or add additional context in comments.

3 Comments

Double F5 (chrome), or CTRL + F5 (IE, FF) are other approaches.
@scheien Sorry what? Double F5? That would refresh 2 times. Chrome is Shift + F5.
I've experienced that Chrome did not refresh the cache unless I did a double F5. Dunno why, but could be my Chrome that's acting up :) Or some keybindings that are messed up.
1

Make sure you're loading the CSS file with this style.

Open the browser tools to see if the css file is loading, or not - probably not, and correct that.

1 Comment

+1 Yes this is probably the issue. This code works and if the style is attached on the page is works, so is not find it on css.
0

you can try to check by inspect element in Firefox by right click to object page then choose inspect element, then your css rule will appeear.

other step : install phoenix editor extension in your Firefox, it will help you what file .js and .css that loaded in your page.

It usually related with wrong file path to load css file

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.