How to resize images in css in email signature? - html

I have a problem with my email signature. I can see it very well, but when the recipient sends a reply the images are very large and the css is no longer taken into account (I can see it in his return email). I do not understand why ?
Here is the code:
<img style = "width: 180px; height: 96px" width = "180px"; height = "96px" src = "liendelimage">
I tried two versions to put the size but in both cases it does not work!
Thank you in advance.

The syntax for your second width and height is wrong, e.g a spurious ; (semi-colon).
However, that's probably not the main problem.
Some email clients ignore styling, though inline styles as you have are more likely to succeed than separate CSS definitions in <head> for example.
Reducing the image size as suggested by #hamid will help in some cases.
However, some clients will ignore HTML altogether and even more will have images switched off by default so always show your name in plain text too.

Related

Javascript/HTML: Need to change font size

I have a question that has been hindering for a while,
https://hastebin.com/fuyipereta.xml
This is my HTML file, is my script
I need to know how to change text size in this instance, please help me
thank you!
Why are you trying to make all the HTML stuff in javascript?
It looks like there's no div with the ID of span. Since you ARE assigning (albeit, in a very strange way) an ID to the span, you could do something like
var fsize = document.getElementById("highlight")
fsize.style.fontSize = '40px';
after you're doing the document.write
You should seriously considering just making the span in HTML and assigning a class/id, then changing the size with CSS. It's just simpler.
There are a lot of other issues with your code, but this should specifically fix the font size.

HTML email background breaking layout in Outlook - using vml method

Currently using http://backgrounds.cm method for background email generation. When not using the code, the email looks correct in most test. When the background image is added, Outlook 2013 will display it, but all the table formating expands to 100%. Not sure if I'm implementing it incorrectly.
Currently applying the background to the topmost table which contains several cells, not the entire body.
I've pasted the code here: http://pastebin.com/dX8zEZDV
I did a couple things to fix it:
Changed your doctype from strict to transitional.
Removed duplicate meta tags.
Closed all unclosed-tags (img and br tags).
Removed your outer two containing tables (#container_table and #container_wrapper).
In #container_table, removed min-width, added margin:0 auto and align="center" so table is centered.
In VML code section, replaced mso-width-percent:1000 to width:850px.
Updated closing VML tags to correct nesting order (closed prematurely).
Optional:
In VML code section, changed the color to better match your background (#292929).
The only instance I've found where VML background images and the inline fallbacks don't work is when I view my Outlook email using the Gmail app on Android. However, when I view my name#gmail.com email in the same app, it's fine. So in the event the background image doesn't load, the bgcolor will display so your users can still see your white text.
Note:
Always remember to validate your code. Even if there are some errors you can't fix (for instance the background attribute in the td won't validate), you can verify all your tags (minus any VML code) are nested/closed properly, as well as finding any accidental special characters you may have copied into your code from Photoshop or Word.
Updated source at jsfiddle: link
If table formatting expands to 100%, it's because you set "Table cell width" setting to "Full email width". It's best to use VML background images on fixed width and height table cells.
Ideal settings for backgrounds.cm are "A single table cell" and set width and height. Otherwise, the result might look different from non-Outlook clients (sometimes it's still OK if it's agreed upfront with stakeholders).

Div width incorrect in Office Outlook Client

I am trying to send an email with html content but I am observing displaying issues.
The following does not get displayed properly in width by Microsoft Office Outlook, any hint?
<div style="width: 650px; border: 1px solid blue">hello</div>
use tables, and on <td> use width="" propery and also style="width:" ... for some clients are reading the width property and others reads the style property
You must reconsider to change the email template to be tables within table and with inline styling
here is a sub link to problem which you may encounter
How to align several tables in td in center
HTML divs and spans don't work particuarly well in office outlook. You are better off using tables for this display.
Reference: "...The best way to combat these issues would be to use a table-based layout." https://litmus.com/blog/a-guide-to-rendering-differences-in-microsoft-outlook-clients
Here is some further information taken from another answer:
"- JavaScript - completely off limits. If you try, you'll probably go straight to email hell (a.k.a. spam folder). This means that LESS is also out of bounds, although you can obviously use the resulting CSS styles if you want to.
- Inline CSS is much safer to use than any other type of CSS (embedded is possible, linked is a definite no). Media queries are possible, so you can have some kind of responsive design. However, there is a long list of CSS attributes that don't work - essentially, the box model is largely unsupported in email clients. You need to structure everything with tables.
There are loads of answers on SO, and lots of other links on the internet at large.
http://www.emailology.org/
http://www.email-standards.org/
http://www.campaignmonitor.com/css/
http://www.getfractal.com/ [DISCLOSURE - I used to work at Fractal.]"
Reference:
Has anyone gotten HTML emails working with Twitter Bootstrap?

Gmail wraps certain HTML elements in a class called im

I have been testing out an HTML e-mail process I've created recently. But as of lately, when I open the e-mail in Gmail, I'm noticing that certain elements are wrapped in a class that I know I didn't put in the original HTML layout. In fact I just triple checked! When viewing the HTML email in Gmail, random sections of my form are being wrapped with...
<div class="im">
....
</div>
As a result, some text turns purple, while other text does not. Why does this happen?
Thanks
Gmail seems to think that you are quoting other emails in a conversation and so is wrapping div.im around the sections of your code that it thinks are previous bits in a conversation.
This might happen if your code has a TABLE with more than one TR. To get around this, rather than several TRs in one TABLE, use several TABLEs with one TR in each.
This might also happen if you have multiple subject lines that are the same, causing Gmail to think this is a conversation. You can fix this by making each subject line unique.
Separate style files do not work for emails. What you can do though is add style for this class in the html as follows:
<head>
<style type="text/css">
.im {
color: #000000 !important;
}
</style>
</head>
This should give style to the class .im in case its found
I also experienced this problem when using a paragraph with single line breaks in it like this:
<p>
line 1<br>
line 2<br>
line 3
</p>
I was able to correct the problem from happening in Gmail from removing all the blank space from that specific part of HTML and bringing that entire paragraph and all it's contents back flush against the left edge of the screen. Sure it looks a little messy and you lose your proper indenting, but I think this helps Gmail not accidentally think you're quoting something inline.
I had similar problems. I was sending emails from an application using templates. So, when I sent multiple emails to same address, lines that are exactly same in all of them got purple. Gmail added this tag automatically:
<div class="im">
.........
</div>
I do not know that for a fact, seemed to me Gmail wraps the common texts in a conversation with the this tag. Similar discussion here.
I have this issue too. And I just added a five-bit random char to every line end and set the color like the background. Then the issue got fixed.
It's not a good way, but if no another way, maybe you can try it.
You ignore style of im class on this way
<b style="color:black;">Some text</b>
Some text does not have purple color
You can use <br> tag in email html if it has style like: <br style="box-sizing:border-box">
Gmail display feature added a span with .im class to some text. To solve this in the styles tag defined in the head of the email I added the following styles:
<head>
<style>
.im {
color: inherit !important;
}
div > span.im {
color: inherit !important;
}
p > span.im {
color: inherit !important;
}</style></head>
Inside my main table I created, as the last child add:
<div style="display:none;">1</div>
and the number 1 increments each time. I am generating the content with js using a template string
`<div style="display:none;">${new Date().toString()}</div>`
You will also need to add style="color:#000;" to the parent.
This will prevent the entire email as showing as quoted, and hence not color the text with the .im class
If you replay to an email Gmail automatically puts your content in a <div class="im">, that's why text colors turn purple.
Just try to compose a new email.
So I had encountered this problem when designing a mailing system for a web application of mine. The solutions given here were a bit time-consuming to implement for me as the mail content was huge and in lots of places span tags were getting added. It's when I come across this document. It turns out Gmail adds the .im class span tags when Gmail client receives two or more emails with the same subject line. All emails are grouped in a conversation group based on the subject line. Gmail detects some of the parts of the second (third, fourth..) email as quoted from the previous email. I simply deleted the previous emails and the problem was solved for me as Gmail didn't group the mails together. The article which helped me =>
https://litmus.com/community/discussions/5189-gmail-changes-color-of-text-im-class
This solution worked for me as the intended behavior of my application was not to share multiple emails at once. Hope so this answer finds helpful
For me, I simply needed to prevent Gmail threading when sending out my email. This would then of course prevent any subsequent emails from getting purple text, as they are not thread children of the initial mail.
If that's your use case as well, you can simply set the SMTP header X-Entity-Ref-ID with any value. This is what Google+ notifications do.
I don't know exactly what this header does, but since it's marked with X at the beginning it means that it is a private header, and therefore shouldn't affect anything else apart from Gmail.
Found this answer here, and I was so happy I needed to share it on.
Please use styles on your page:
div.adm { display: none !important;}
div.h5 { display: block !important;}

Styles for CSS classes in an iframe

Inspired by the new User Flair, but the question applies to the general case as well.
Let's say I want to include something like this on a site that doesn't allow me to specify external styles or use any JavaScript code. The only thing I can do is paste in an object, embed, or iframe, and some other simple HTML. Additionally, the width of the space is only 160 pixels, rather than the 200 needed by default for the flair badge.
To fix this, I want to set styles for the valuable-flair class in the iframe, namely change width to be 160px instead of 200px. Then things will be fine, as long as the username doesn't overlap (and even then, once I figure this out I can use the same technique to play with that as well).
How can it be implemented?
There is no way you can alter the design of the Iframe using CSS if you can't control the page in the SRC attribute.
I recommend you read the src of the iframe on the server side instead (using PHP, Python or what you fancy), e.g. fopen() the src and fread() into a variable, than do some str_replace on this variable (to extract contents, remove < body >,< / body >...) play with the design and place the result in your page.
This way you can control the design.
If the CSS for the width and height were expressed as percentages rather than absolute values, you could adjust the width by adjusting the IFrame. However, if hosting a custom implementation is not possible for you, you are out of luck without JavaScript.