Same font size looks different in same web browser - html

I have two JSP pages with the following code:
A.jsp
<fieldset>
<legend class="noBold" >Datos generales</legend>
<table>
<tr>
<td class="etiqueta" colspan="5">
<label for="fxPresentacion">Fecha presentación:</label>
</td>
</tr>
... more code ...
</table>
</fieldset>
B.jsp
<fieldset>
<legend class="">Datos generales</legend>
<table class="estiloTabla">
<tr>
<td class="etiqueta">
<label for="fxSolicitud">Fecha solicitud:</label>
</td>
</tr>
... more code ...
</table>
Both pages uses the same CSS:
label {
color: inherit;
font-size: 0.98em;
border: 0px;
}
And when you open it in a web browser, label tags looks with different font sizes:
A.jsp
B.jsp
Someone knows what's happen?
P.S: I have a web filter in my PC and I can't show the images. Here are the URL's:
A.jsp: http://i.stack.imgur.com/hbxBQ.png
B.jsp: http://i.stack.imgur.com/hbxBQ.png

ZOOM LEVEL - Embarrassing, but my issue turned out to be that I had one browser window zoom level set above 100% whereas the other browser window had a zoom level of exactly 100%. I don't know why I didn't think to check that first, but I'll post the answer here in case it helps someone else who didn't think of it.

I recommend using the browser's devtools for checking the "computed style".
There you can see...
The calculated font-size
The cascading rules which are respected
Without the complete page and the complete stylesheet it is only possible to guess.

using root-ems rem instead of em could do the trick.
If you want to support older browsers you can use fallbacks. In this case it would look like this:
label{
font-size:15px;
font-size:1rem;
}
They work like this:
Older browsers will ignore the css rule they don't know (in this case rem). While newer browsers, which know the css rule, will simply overwrite the previous one.

Related

Email HTML Signature; font size changes when I make change to the table size

I am trying to create a company-wide email signature. Here is the code for it:
<table style="font-family:verdana, arial, sans-serif; color:#7f7f7f; font-size:12px; line-height:15px">
<tr>
<td><div style="font-size:145px; color:#69cd37; line-height:0px; position:relative; top:-17px; left:7px; margin-left:-20px">●</div></td>
<td>
<b>firstName lastName, </b><i>title</i><br />
<b style="color:#69cd37">Company Name</b><br />
Street, City, State, Zip<br />
<b>office </b>###.###.#### | <b> mobile</b>###.###.####
</td>
</tr>
</table>
When I test this email, it looks great and works fine on most of our HTML enabled emails. The problem lies within "Good for Enterprise" email. Most of the higher-ups use "Good" email on their mobile phones. The signature looks fine and the font sizes are all correct, but it wraps, and it wraps bad.
So to fix it, I've tried everything: table width="500", style="min-width:500px", white-space:nowrap;. These all fix the wrapping problem, but they seem to enlarge the font by double! And there's no explanation to it.
Is there any reason it would be enlarging it? When I send an email with the original version (posted above) and a new version with no wrapping, the original version has correct font size, but the wrapped version's font size is huge. Is the wrapping interacting with the phone screen width?
Put all of your text styling in the <td> tag it is contatined in. In many email clients you have to redeclare in every single <td> that contains text. You don't need it in the <table> tag, just the <td> tags.
If that doesn't work, try -webkit-text-size-adjust:none; -ms-text-size-adjust:none; font-size-adjust:none;, in the <td> inline style, although that may be a long shot (not sure what/how "Good" works).
If you are still out of luck, try and find a way to view the code as it is rendered (after "Good" does it's thing). This may help debug the cause and might possibly reveal a way to prevent it.

Inline CSS being stripped on <td> in Gmail (Internet Explorer) and Yahoo (Windows)

I am building HMTL emails and I use nested tables to layout the email. To change text I apply the styles directly to the < td > tags and this works for the most part across the board. I am noticing though on SOME heavily nested tabled (Greater then 5) the style is being removed completely on Gmail in Internet Explorer, and on Yahoo in various browsers (on a PC). Below is my code:
(This code is ~5 tables deep)
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="padding-bottom:10px;font-family:'Century Gothic',Arial, Helvetica, sans-serif; font-size:26px; color:#202020;">The Latest</td>
</tr>
</table>
Has anyone ran into this before or know why they might be stripping the style? It's not only text styles but the padding is also removed on these < td > tags.
I've never had the issue myself, but there is known to be issues with nesting tables too deep. I'm willing to bet that there is a more precise way to layout your email to avoid the issue. Don't be scared to use colspans and rowspans when necessary. Post your code if you like.
I think I may know why this is happening. I've seen issues when using a font-family with quotes throw off the inline CSS. If you move the font-family to the end of your inline styles it may work. See below.
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="padding-bottom:10px; font-size:26px; color:#202020; font-family:'Century Gothic',Arial, Helvetica, sans-serif;">The Latest</td>
</tr>
</table>
In case this is useful for anyone: I ran into this problem with a specific <td> that was getting all the inline CSS stripped. After checking it, I found I had an incorrect property declared, like so:
padding-bottom;
Removing that incorrect property resolved the issue.
It seems to me that Gmail somehow validates the css of each element, and strips it all if it finds an error.
Not a direct answer so my apologise, but could you not use CSS instead of HTML tables? You will be able to achieve the same result I would think?
I just tested an html email that works for Gmail.
Generally speaking, I learned that Gmail tends to strip out the whole inline style attribute when you declare font-family, this behavior sometimes happens when:
1) when you declare a custom font using ' or ", es: <span class="small-text" style="font-family:'Titillium Web',Arial,sans-serif;"></span>
2) if don't put spaces between ; , , and : chars, in a font-family declaration.
3) every time you declare 2 <span> with a font-family in the same <td>, Gmail will strip the second's <span> rules
but I don't know what is the general rule, so my solution was: always declare font-family inside a separate tag, at least, in this way you won't lose all the styles.
example:
<span style="color:#8d8c87;display:block;font-size:12px;line-height:120%;text-align:center">
<span style="font-family:'Titillium Web',Arial,sans-serif;">text</span>
</span>

Text-align right not working in IE7

I have a table that is being generated where one of the columns needs its text to be aligned right. So right it looks something like this:
<td class="generatedClass" id="generatedId" style="width:20px; text-align:right;">
<label id="generatedRowId"> some text here </label>
</td>
It works in IE9 and IE8, but for some reason not IE7. Anyone have an idea as to why this might not be working? To note, the inline styles are being created as json objects. I don't like having inline styles, but it wasn't my call.
Your code looks like it should work. Probably, IE7 is not updating the DOM after these inline styles are being applied.
I recommend opening the page in IE10 and then going to IE7 Page mode. You should then be able to inspect the styles on your element and find out if they're being applied, overridden, etc.
Its seems like width property of your inline style casing problem in IE7. Try to eliminate to apply with in inline style.
<html>
<head>
<title></title>
</head>
<body>
<table width="400">
<tr>
<td class="generatedClass" id="generatedId" style="text-align:right;">
<label id="generatedRowId"> some text here </label>
</td>
</tr>
</table>
</body>
</html>

Can not get CSS style to propagate into a table cell in IE9

The example below works in chrome and fire fox.
Both renders the text red.
Why does IE9 fail?
Here is an example:
<style>
.tableX td
{
color:red;
}
</style>
<table class='tableX'>
<tr>
<td>
My Text
</td>
</tr>
</table>
For some odd reason my browser had gone into a weird mode. Must have tested too many new HTML5 features :-{ Anyways it works after restarting the browser. Thank god i didn't spend more than three hours on it. Yikes.
Was my initially thought.
However the problem is caching related.
To prevent IE from caching the AJAX request, i have added a variable to the querystring containing a random number, like below:
queryString + "?comonIE=" + MATH.random().toString().slice(2)

Tricky CSS layout of external (facebook like and google plusone) buttons

What is the best way to place/layout the google+1 and facebook Like buttons so they align neatly?
Currently, the first "thing" in my body is this heading, appearing on top of all pages (slightly modified after logging in): (linebreaks added for readability) :
<table align="center" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left">
<g:plusone size="small" href="https://www.apebroker.com/">
</g:plusone>
<iframe src="https://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.apebroker.com%2Findex.php&send=false&layout=button_count&width=100&show_faces=false&action=like&colorscheme=light&font=arial&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
</td>
<td align="left"></td><td align="right">It's more fun after you
login
</td>
</tr>
</table>
My problem is that this looks like crap. I know that pages don't need to look exactly the same in every browser, but acceptable ugliness has its limits.
The google button is nicely "vertically centered", while the facebook stuff kind of sticks to the top of the page, 0px down.
See this example:
I tried adding padding:2px; to the style in the facebook iframe, and sure, it came down a bit, but so did the google button too, and the entire heading grew, pushing down the <hr> below.
I obviously don't know much about iframes, but I've managed fine on my own until now.
In my global style sheet I have (amongst other things) this:
body {
margin:0px;
padding:0px;
background-color:#e0e0b0;
color:#302010;
font-family:"Trebuchet MS",Helvetica,Sans-serif;
font-size:100%;
}
And I don't want to change that, as it cascades to all sorts of things that I'm reluctant to break. If you want to check out the complete style sheet and HTML source, an example page can be found here.
Thank you in advance for any hints/suggestions!
How about plus one button, and it's width?
<script type="text/javascript" src="https://apis.google.com/js/plusone.js">
{lang: 'ru'}
</script>
A problem is that the table cells are sizing themself based on the font size even though there isn't any text in the table.
The "correct" answer is not to use tables for layout.
However, if you explicitly set:
<td align="left" style="font-size: 1px">
then your life will get slightly better as you'll be able to explicitly control the height of each of the cells and position things. At the moment despite you "asking" for a height of 21px, you're getting 26px.
After that the FB button will look nice and you'll need to move the +1 button around.
But, the real answer is not to use tables:
http://www.w3.org/2002/03/csslayout-howto
http://www.hotdesign.com/seybold/
and various others...
I've found a fix for this using to encapsulate both fb:like and g:plus separately, and then setting the style of both to style="vertical-align: top;". See example at http://www.clonearmycustoms.com/