Patrick
Patrick

Reputation: 8318

asp.net user control displays with different font size

Apologies for this if its simple but I'm a C++ guy working on asp.net.

We've got a website with basically the same data entry form on two pages. It is currently coded separately on the two pages. I'm making some change and so I've whipped the code out into a user control ascx file. On one page (which basically just has the user control on it) it looks as it did before, on the second (which has a table above the user control) the font size has changed to become practically unreadable.

How can I control the font size in the ascx control?

Further info: The two pages both use a master page which has header, menu and footer controls in s. The master page links in the css files.

EDIT: thanks for the answers guys, allowed me to work out a simple fix, I've reset the font size in the table tag which contains the userControl:

<table cellspacing="4" class="tableData" style="font-size:x-small">
    <tag:name id="cntlDetails" runat="server" />
</table>

Upvotes: 1

Views: 1960

Answers (3)

Rikon
Rikon

Reputation: 2706

This feels like a stylesheet problem.

If you use IE developer tools (F12 from your IE [8 or 9] window) or FireFox Firebug plugin, then you can inspect the text on the two pages and see what style elements (be they inline or from css) you're having problems with.

Here's Firebug (our graphics designer prefers it way over IE): http://getfirebug.com/html

I'm taking a shot in the dark that there is a css rule that's based on percent that's mucking it up... For instance if there is css that shrinks all text in a table by a percent, then embedded tables in the page will do what you're describing.

Be wary of this kind of thing:

table p {
   font-size: 70%
}

P tags in embedded elements would shrink it to 70% of 70%... basically unreadable...

Upvotes: 1

bonifaz
bonifaz

Reputation: 598

There are several ways of formatting controls in ASP.net.

  • Properties in the user control directly
  • Themes file
  • Stylesheets

In order to check which style your control gets in the end, I recommend checking the rendered HTML (in IE, right-click / View source), which shows you which CSS class your control gets. For more detailed analysis, open the developer toolbar (hit F12), select your element by clicking CTRL-B and check style.

Upvotes: 1

ibram
ibram

Reputation: 4579

You can add properties, to the user control, which you can set on the page.

Here are examples:

http://msdn.microsoft.com/en-us/library/26db8ysc%28v=vs.85%29.aspx

or here

http://asp.net-tutorials.com/user-controls/using/

Upvotes: 1

Related Questions