


Since the HTML email is not an independent HOST page on this site, it is hosted on others. So writing HTML emails is very different from writing HTML pages. Because all mainstream mailboxes for netizens will more or less filter the HTML emails they receive in the background. There is no doubt that JS code is strictly filtered out, including all event listening attributes, such as onclick and onmouseover. This is based on email security considerations. Not only that, CSS code will also be partially filtered. What I want to talk about is how to write HTML emails that are not filtered by major mainstream mailboxes and can be displayed normally.
First, let’s take a look at how the mailbox displays HTML emails. I have never worked on an email system myself, and the filtering algorithms in the background of major mailboxes are not easy for outsiders to know. Therefore, we can only use front-end display to infer which writing methods are accepted by the mailbox and which ones will be filtered out. Through the analysis of gmail, hotmail, 163, sohu, and sina, I divided the mailboxes into two categories:
The first category includes gmail, hotmail, and sohu. For this type of mailbox, the email content is laid out in a certain div in the entire mailbox page. As shown in the picture:
The second category includes 163 and sina. In this type of mailbox, the email content is laid out in a separate iframe. As shown in the picture:
Friends who are familiar with HTML know that iframe content is an independent document and is independent of the elements and CSS of the parent page. It can almost be treated as an independent page. And if the email content is in a div, then the email content is an integral part of the entire mailbox page. Obviously, mailboxes that use iframe as a presentation method will be much more tolerant of email content, because it gives you a sufficiently independent space for expression. The div is not so polite. Just imagine, if you write this CSS sentence in your email, will the font size on the entire email display page become 20px and it will be messed up:
We need to write a unified email template that is compatible with each mailbox, so we must avoid the above external CSS writing method, and something similar to Styles such as float and position that become abnormal content flows will also be filtered. If you write them, it is likely to affect the performance of the external mailbox.
I will list some writing principles below:
1. One of the global rules, do not write the
2. Global rule two, use less pictures. Your mailbox will not filter your img tags, but the system will often not load pictures from strangers by default. If you use a lot of pictures in the mail, they will not be loaded in the email. In some cases, the content is so ugly that the content cannot be seen clearly, and impatient users delete it directly. Be sure to add alt to the image.
3. Do not write float or position in the style, because it will be filtered. So how to implement left and right layout or more complex layout? Use table.
4. The background color can be set in the style content, but the img will be filtered, which means that the background image cannot be set through CSS. But there is a very interesting element attribute, also called background, in which you can define an image path. This is a good alternative. Although this has limited functions, such as being unable to locate the background image, it is better than nothing. For example, to add a background to a cell, you must write like this:
5. Emails in div mode do not support flash, and those in iframe mode need to be verified.
Finally, sohu’s email address is very weird. It adds a space after each text paragraph, causing the original normal layout to not fit on one line and wrap into new lines, thus causing some layout confusion. Therefore, if you want to be compatible with sohu mailboxes, you must be extra careful when encountering some compact layouts, try to reduce the number of text segments and leave sufficient width.

本篇文章带大家了解一下HTML(超文本标记语言),介绍一下HTML的本质,HTML文档的结构、HTML文档的基本标签和图像标签、列表、表格标签、媒体元素、表单,希望对大家有所帮助!

不算。html是一种用来告知浏览器如何组织页面的标记语言,而CSS是一种用来表现HTML或XML等文件样式的样式设计语言;html和css不具备很强的逻辑性和流程控制功能,缺乏灵活性,且html和css不能按照人类的设计对一件工作进行重复的循环,直至得到让人类满意的答案。

总结了一些web前端面试(笔试)题分享给大家,本篇文章就先给大家分享HTML部分的笔试题(附答案),大家可以自己做做,看看能答对几个!

在html中,document是文档对象的意思,代表浏览器窗口的文档;document对象是window对象的子对象,所以可通过“window.document”属性对其进行访问,每个载入浏览器的HTML文档都会成为Document对象。

HTML5中画布标签是“<canvas>”。canvas标签用于图形的绘制,它只是一个矩形的图形容器,绘制图形必须通过脚本(通常是JavaScript)来完成;开发者可利用多种js方法来在canvas中绘制路径、盒、圆、字符以及添加图像等。

html5废弃了dir列表标签。dir标签被用来定义目录列表,一般和li标签配合使用,在dir标签对中通过li标签来设置列表项,语法“<dir><li>列表项值</li>...</dir>”。HTML5已经不支持dir,可使用ul标签取代。

3种取消方法:1、给td元素添加“border:none”无边框样式即可,语法“td{border:none}”。2、给td元素添加“border:0”样式,语法“td{border:0;}”,将td边框的宽度设置为0即可。3、给td元素添加“border:transparent”样式,语法“td{border:transparent;}”,将td边框的颜色设置为透明即可。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 English version
Recommended: Win version, supports code prompts!

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Zend Studio 13.0.1
Powerful PHP integrated development environment