Getting different font size with same css file in IE - asp.net

I have created a couple of ASP.Net (aspx) pages which are supposed to run with existing ASP pages in a website.
Both ASP and ASP.Net pages use the same css file. In both the pages, there are headings which are styled using tag from css file.
The problem is that headings in .asp and .aspx pages are rendering in different size in Internet Explorer. It works fine in FF and Chrome.
Please suggest some workaround for this, as I have to make my .aspx pages similar in look and feel to the existing .asp pages.
Thanks in advance!
Updated:
I can paste a part of css file here, since it is a large file:
TH, FONT, TD, P, B, I, STRONG, U, EM, BLOCKQUOTE, LI, OL, CAPTION, DL, DT, DD,select,pre {font-size:11px;font-family:Arial, Helvetica, sans-serif;}
body{
font-family: Arial, Helvetica, sans-serif;
color: #000000;
line-height: 1.166;
margin: 0px;
padding: 0px;
}
h2{
font: bold 150% Arial, Helvetica, sans-serif;
color: #000000;
margin: 0px;
padding: 0px;
}
The aspx page (heading part) looks like this:
<table style="left: 35px; position: static; top: 231px">
<tr>
<td style="height: 85px; width: 2087px;">
<h2><asp:Localize id="lblHeading" runat="server" Text="Welcome to XYZ" meta:resourcekey="lblHeading"></asp:Localize>
</h2>
</td>
</tr></table>
ASP page has a simple tag:
<h2>Welcome to XYZ</h2>
Updated:
The weirdest thing happened. I tried stripping down the css file and started adding each style one by one, and refreshing the page to check which styles are getting applied to the heading. I noticed that if I remove the first line of css (keeping all the other styles intact):
<STYLE type="text/css">
then the headings look same in both asp and aspx pages. As soon as I add the above line in css file, the heading in aspx page becomes bigger.
Any comments as to why this is happening?

Make sure you are using the proper and the same Doctype at the top of the ASP and ASPX pages. You can also use the developer tools in FF and in IE to make sure that the same styles are applied to headings on ASP and ASPX pages in both browsers. What version of IE are you using?

You might be interested in section about w3schools recommendation for font-size
The suggested way, as I understand is to declare in body:
body{
font-size: 100%; // which default is 16px
}
and everywhere else use em (instead of % or px), as explained in the link.
So in your header you should not have 150%, but instead DesiredSizeInPx divded by 16, for example if you want to have 24px you write 24/16em, which is 1.5em

The problem could be that two different styles are being applied.
The ASP page is getting the straight h2 style
h2{
font: bold 150% Arial, Helvetica, sans-serif; etc.
Whereas the ASPX might be getting another style
id="lblHeading"
Check to see if #lblHeading is giving a different size.

Related

Google font just will not work

I have followed the instructions on the google fonts website over an over and my webpage displays as it should on MY laptop, however, the fonts 'FJALLA ONE' does not load on any other computer or device.
Am I doing something wrong? Can I store the fonts in a folder and link them like a css file?
Here is my html - part 1:
head>
<link href='http://fonts.googleapis.com/css?family=Fjalla+One' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
part 2:
<div class="box">
<h1 class="animated bounceInDown">SHEREE WALKER </h1> </div>
My CSS
.box h1 {
font-family:'FjallaOne', sans-serif; !important;
font-size:45px;
text-align:center;
color:#FFF;
padding-top: 10%; }
Am I missing something? Any help would be amazing. I'm at my wits end.
Your problem probably exists in this piece of code:
font-family:'FjallaOne', sans-serif; !important;
it should be
font-family:'Fjalla One', sans-serif !important;
OR
font-family:'Fjalla One', sans-serif;
If that still does not fix it try removing , sans-serif
Your problem is not with your code. It is fine. I would remove the !important though, it's not necessary and the syntax is also not correct, but the code will still work even with wrong syntax.
What your real problem is: the text is white so you will never see it on a white background. You can see it here working with red text-> http://jsfiddle.net/sxntrvrj/1/
h1 {
font-family: 'Fjalla One', sans-serif;
font-size:45px;
text-align:center;
color:red;
padding-top: 10%;
}

Google Chrome seems to ignore cellpadding + cellspacing

I have a table with a tr and two tds. First td contains an input(text), the second another input (image). The second input is supposed to be a button. I've set cellpadding and cellspacing to zero so that the text input and the image button can be attached with no spaces in between. This works fine in IE and Firefox but not in Chrome. Chrome keeps leaving a few pixels of space between the text input and the button. I tried using CSS but nothing seems to work. Any idea what Chrome's problem might be?
<head>
<style type="text/css">
.search{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: normal;
color: #4D4D4D;
border: 1px solid #CCCCCC;
height: 21px;
outline: none;
}
</style>
</head>
<body>
<table cellpadding="0" cellspacing="0">
<form method="post">
<tr><td><input type="text" size="30" class="search"></td>
<td><input type="image" src="button.gif" name="submit" id="submit" width="77px" height="21px"></td></tr>
</form>
</table>
</body>
First off, you need to move the <form> tag outside of the <table> you're going to cause yourself trouble that way.
Next, you need to set the padding on your tds to 0:
form td {
padding: 0;
}
That should get rid of any extra spacing you're seeing.
A stackoverflow user said:
Just mentioning that cellpadding and cellspacing have been made obsolete, and I received a shock when Google Chrome 23 didn't support it.
Anyway I can't find any reference on the internet!
For what you want, try border-collapse: collapse on the table via css.
Also, you might want to look into other means as using a table for layout is not the way forward these days and it sounds like that's what you're doing.

Fonts bigger in IE 9 than IE 8 and other browsers?

I have a problem getting the fonts in links for a menu to look the same across browsers. It wouldn't be such a problem if it was just a small difference, but the fact of the matter is that in IE 9 the font looks to be at least a couple of pixels or more bigger than in the others, while using the exact same css.
Now being in a main menu, this looks pretty bad. Anyone know why this happens, and what I can do about it?
Here's the css rule:
ul#menu li a
{
width: 80%;
text-align: center;
font-family: HelveticaNeueLight, Helvetica, Arial, Sans-Serif;
font-weight: bold;
font-size: 12px;
text-decoration: none;
line-height: 38px;
color: #333;
text-shadow: 0px 1px 0px #e5e5ee;
display: block;
/*Hiding dots around clicking on links*/
outline: none;
overflow: hidden;
}
If this is truly vital, and you do not mind using Conditional Comments to send IE-targeted CSS to the browser, you can create a Conditional Comment stylesheet for IE 9 like so:
<!--[if IE 9]>
<link rel="stylesheet" type="text/css" href="/ie9.css" />
<![endif]-->
With another CSS rule for the font-size property in this css file.
Otherwise, a good first step is to always use a CSS Reset to normalize between browsers. Commonly used resets are Eric Meyers and YUI.
Perhaps the CSS for some other property is inconsistent? I'd try using a CSS reset file (http://developer.yahoo.com/yui/reset/) or adding zoom: 100% in there to see if that fixes it.

IE 8 - font-family display problem

I have an application that has an initial login page that
has a user name and password input box.
This page works fine in IE 7, Safari , Firefox 4 & 5 but not
in IE 8 and 9. In IE 8/9 the user name and password display with
different size input boxes when you adjust the zoom percent.
While doing some testing I noticed in IE 8/9 the Document Mode is in Quirks Mode.
So I tried setting the Document Mode in IE 9 to IE 9 Standards mode and
the page displays correctly. However in IE 8 it has no affect.
The only thing I have been able to get to work is to redefine
the font-family in the style sheet for the input boxes. This works
for IE 7,8 and 9 and also Safari and Firefox.
I have also tried setting the DOCTYPE and meta tags but none of those
combinations seem to work in IE 8.
I included a test stylesheet and html below that reproduces
the problem.
Does anyone know why IE 8/9 would require this ? Is there another
way to handle this other than redefining the font-family ?
Thank you.
The stylesheet below works in IE 7, Safari and Firefox 4 & 5. In IE 8/9 it causes
the user name and password to display with different lengths unless I use the commented
out line:
stylesheet:
body { font-size: x-small; font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular;}
form { font-size: 100%; }
input { font-size: 110%; }
/*input { font-size: 110%; font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular; }*/
INPUT.TEXT { font-size: 100%; }
select { font-size: 110%; }
textarea { font-size: 110%; }
html:
<html>
<head>
<title>Login</title>
<link rel="stylesheet" type="text/css" href="./mystyle.css">
</head>
<body>
<table>
<tr><td>User Name: </td><td><input type=text name=username size=20 value=""></td></tr>
<tr><td>Password: </td><td><input type=password name=pass size=20></td></tr>
<tr><td> </td><td><input type=submit value=Login></td></tr>
</table>
</body>
</html>
Your input length is based on your font-size. But many form element do not inherit your font-family.
Test it with a funky font (Comic Sans MS) and a big font-size.
Related (except the first answer is wrong, input type do not inherit font-family).
You could set your input size in CSS (width:200px).
Little note : INPUT.TEXT points to no element. .text is a class.

CSS fixed repeated background problem

I'm designing a site with a fixed repeated background but can't work out why it has one problem.
If you load the site in a small window, then scroll right, the background doesn't carry on and the background colour show's instead.
Any ideas?
Site is: http://new.focalpix.co.uk/
CSS for the background is:
body {
background: url(http://media.focalpix.co.uk/img/gradbackground.png) repeat-x fixed;
}
Try the following CSS:
body, html {
color:#fff;
background: #000 url(http://media.focalpix.co.uk/img/gradbackground.png) fixed repeat-x;
text-align:center;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "DejaVu Sans", "Bitstream Vera Sans", "Liberation Sans", Verdana, "Verdana Ref", sans serif;
}
body {
font-size: 70%;
}
It looks like (in both Opera and Chrome) the browser is treating the area outside the browser's initial viewport as part of the HTML tag but not part of the BODY. You can verify this by putting the background-image on the HTML but not the BODY tag - and then see how it appears only in the scroll-to-view area of the document. I have no idea why this is happening - anyone?
CSS above appears to fix the problem, though.
you have defined body background: url in style.css line 13, but also defined rules for body background in the rule starting on line 17.
The rule on line 17 is for body, html, but the one starting on line 11 is just for body. You could probably condense these into one rule, defining exactly what you want the background to be -- a colour or an image from a url
This is due to the fact that the <body> tag is set by default to 100% of the width of browser window - not the site. This means when the width of the window is less than 960px - the width of your site, the body block ends. To fix this, simply set:
body {min-width: 960px}
Unfortunately, min-width does not work in old versions of Internet Explorer without a JavaScript hack called minmax. I would suggest enclosing the javascript embed code for it inside some conditional comments to prevent an unnecessary HTTP request and potential compatibility errors in new browsers. So embed minmax like so:
<!--[if lte IE 7]>
<script type="text/javascript" src="minmax.js"></script>
<![endif]-->
Also, a general tip - these issues are fairly easy to resolve by playing with firebug.

Resources