最少的編碼

Knowing how to code HTML email can bring you many opportunities, such as working as a digital designer, collaborating with front end developers, finding freelancing projects.

知道如何對HTML電子郵件進行編碼可以為您帶來許多機會,例如擔任數字設計師,與前端開發人員合作,尋找自由職業項目。

On one of my interviews, the lead designer asked me to send him digital design works so he can evaluate my work experience. I sent him 5 different email HTML templates I did at the previous company and got the job offer as a digital designer.

在我的一次采訪中,首席設計師要求我向他發送數字設計作品,以便他可以評估我的工作經驗。 我給他發送了5種電子郵件電子郵件HTML模板,這些模板是我在上一家公司所做的,并獲得了作為數字設計師的工作機會。

The best part is coding an email requires just a little basic knowledge of HTML and CSS. This article, demonstrated by my free series of videos, will show you how to code in the most visual way, with the least code.

最好的部分是編寫電子郵件,只需要一點HTML和CSS的基礎知識。 我的免費視頻系列展示了這篇文章, 它將向您展示如何以最少的代碼以最直觀的方式進行編碼。

Step 1:

第1步:

Create your HTML file

?reate您HTML文件

To start, you need to install Visual Studio Code, or Atom, or any source-code editor. Create a folder in your local computer, then create a new HTML file inside that folder and name it index.html

首先,您需要安裝Visual Studio Code或Atom或任何源代碼編輯器。 在本地計算機中創建一個文件夾,然后在該文件夾中創建一個新HTML文件,并將其命名為index.html

Create a new HTML file in Visual Studio Code
Create folder “Testing” then click on “New file” and name it index.html
創建文件夾“ Testing”,然后單擊“ New file”并將其命名為index.html

To create a new HTML template, type “html:5” and enter. You can start coding your HTML now.

要創建新HTML模板,請輸入“ html:5”并輸入。 您可以立即開始對HTML進行編碼。

If you don’t what is HTML and CSS, let’s take it simple: HTML is all the plain text while CSS is all the styling that make your text and design colourful.

如果您不是HTML和CSS,那就簡單點吧: HTML是純文本,而CSS是使文本和設計色彩豐富的所有樣式。

Image for post
Left: HTML only vs Right: HTML and CSS
左:僅HTML與右:HTML和CSS

Right-click and open “index.html” in the lite server. Always work with the browser on the first half of your screen while the second half of your screen is the code.

右鍵單擊并在lite服務器中打開“ index.html”。 始終在屏幕的前半部分與瀏覽器一起使用,而屏幕的后半部分是代碼。

Step 2

第2步

Bring in your internal and inline CSS

B環的內部和內聯CSS

Now you know that HTML and CSS are two separate components in front-end design. Then how can you link HTML and CSS together so the design can fully display the interface look? There are 3 ways: External CSS, Internal CSS, and Inline CSS. We use external CSS for web design. For web designers, most of the time they’re gonna create another file style.css and they put all the CSS code separately here.

現在您知道HTML和CSS是前端設計中的兩個獨立組件。 那么如何將HTML和CSS鏈接在一起,以便設計可以完全顯示界面外觀? 有3種方式 :外部CSS,內部CSS和內聯CSS。 我們使用外部CSS進行網頁設計 。 對于網頁設計師而言,大多數時候他們將創建另一個文件style.css,并將所有CSS代碼分別放在此處。

The second way is Internal CSS. Internal CSS means you put the styling of CSS inside <head> section. This way is used to set up the CSS reset and put all the repeated code in one place.

第二種方法是內部CSS 。 內部CSS表示您將CSS樣式放在<head>部分中。 這種方式用于設置CSS重置,并將所有重復的代碼放在一個位置。

<head>
<style>

/*CSS reset*/
body,
table,
td,
a {-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;}
table {border-collapse: collapse !important;}</style>
</head>

The third way is Inline CSS where you put the style right next to the element you want to style. For example, I want the heading to have a border so I can put the border style next to <h1>.

第三種方法是Inline CSS,您可以在其中將樣式放置在要樣式化的元素旁邊。 例如,我希望標題具有邊框,以便可以將邊框樣式放在<h1>旁邊。

<h1 style=“border: 1px solid black;">Hello Alex!</h1>

For email design, we’ll use Internal CSS and Inline CSS only.

對于電子郵件設計,我們將僅使用內部CSS和內聯CSS。

Step 3

第三步

Build email layout with <table>

用乙 uild電子郵件布局的<table>

Image for post

Planning the right layout from the beginning is critical because it will save you a lot of time when coding your email. When working with email, tableis the most popular structure. With this layout, you put all the content into different tables. This is how I started: I designed the email in Indesign and calculated I would need 8 different tables to design this email.

從一開始就計劃正確的布局至關重要,因為它可以在編碼電子郵件時節省大量時間。 使用電子郵件時, table是最受歡迎的結構。 使用這種布局,您可以將所有內容放入不同的表中。 這就是我開始的方式:我在Indesign中設計了電子郵件,并計算出需要8個不同的表格來設計此電子郵件。

The code for table is tdmeans table data while trmeans table row. So the basic structure to follow is

表的代碼是td表示表數據,而tr表示表行。 所以要遵循的基本結構是

<table>
<tr>
<td></td>
</tr>
</table>

For our example, we need to repeat the <table></table> for 8 times with the text on the left and the images on the right. Here is the sample code.

對于我們的示例,我們需要將<table> </ table>重復8次,左邊的文本和右邊的圖像。 這是示例代碼 。

Step 4

第4步

Add headings, paragraphs and buttons

到 DD標題,段落和按鈕

Let’s bring in some headings and paragraphs.

讓我們引入一些標題和段落。

<table>
<tr>
<td>
<h1>Hello Designers!</h1>
<p>My name is Rosy. I’m a full stack designer.</p>
</td>
</tr>
</table>

If you don’t want to code buttons, there is an option for you with buttons.cm.You can input the button color, any border style, call-to-action and URL, and copy the automatic-generated code.

如果不想對按鈕進行編碼,可以使用 button.cm 為您提供一個選項。您可以輸入按鈕的顏色,任何邊框樣式,號召性用語和URL,然后復制自動生成的代碼。

Step 5

第5步

Add images and videos

到 DD圖像和視頻

Now we bring in a background image into another table<table></table> . The code to bring in a background image is style=“background-image:url(#);background-size:cover;height:400px;".

現在,我們將背景圖像引入另一個表<table></table> 。 引入背景圖像的代碼是style=“background-image:url(#);background-size:cover;height:400px;"

The most tricky part is the link you bring in has to be a permanent link, not a relative path. Permanent link is when your file is hosted online on the Internet while relative path refers to the local file on your computer. There are two ways to create permanent link: Upload your files (photos, videos) to your website and copy the URL or you can host in for free with Github.

最棘手的部分是您引入的鏈接必須是永久鏈接,而不是相對路徑。 永久鏈接是指文件在Internet上在線托管,而相對路徑是指計算機上的本地文件。 有兩種創建永久鏈接的方法:將文件(照片,視頻)上傳到您的網站并復制URL,或者您可以使用Github免費托管。

To host your files on Github, create your Github account, create repository and upload your files to that repository. Simply add ?raw-true to the URL of your upload. Something looks like this.

要將文件托管在Github上,請創建您的Github帳戶,創建存儲庫,然后將文件上傳到該存儲庫。 只需在上傳的網址中添加?raw-true即可。 看起來像這樣。

<img src="https://github.com/rosyhnguyen/imageudemy/blob/e01769d22be196cb926eb9e950d7824cb5432db7/Asset%201.png?raw=true”>

View this step in more detail with my free Udemy course here.

在這里,通過我的免費Udemy課程更詳細地了解此步驟。

Step 6

第6步

Make your email responsive with @media queries

使您的電子郵件響應@media查詢

Most of your customers will read your newsletters on mobile. So make sure your email is fully responsive. If you want to make your email design responsive, there’re a lot of things to do. I want to show you the three most easiest ways: @media queries, fluid table, responsive images.

您的大多數客戶都會在移動設備上閱讀您的新聞通訊。 因此,請確保您的電子郵件是完全響應的。 如果您想使電子郵件設計具有響應性,則有很多事情要做。 我想向您展示三種最簡單的方法: @media查詢,流體表,響應圖像。

@media only screen and (max-width: 600px) {
body {
background-color: lightblue;
}

max-width is used for mobile style because it means the device cannot grow bigger in 600px while min-width applies for desktop design.

max-width用于移動樣式,因為這意味著設備不能以600px增大,而min-width適用于桌面設計。

So what if fluid table? Fluid table means your table gonna resize when you resize the browser or when you do use different device. All you need to do is to add max-width to tables and images.

那如果流體表呢? 流體表意味著您在調整瀏覽器大小或使用其他設備時將調整表大小。 您需要做的就是為表格和圖像添加max-width

table {max-width: 100% !important;}<img src=“#?raw=true" style="width: 100%; max-width: 600px;">

And one more thing we can do is to add display:block to images to make them fully responsive.

我們可以做的另一件事是在圖像上添加display:block以使它們充分響應。

<img src=“#?raw=true" style="width: 100%; max-width: 600px; height: auto; display: block;">

Step 7

步驟7

Add animation without code

沒有代碼的 dd動畫

Adding GIF to your HTML is a visual way to create animation without any front end code. You need to use Photoshop or familiar tools to create a GIF first. Here are 6 handy animation tutorials to enhance your work.

在HTML中添加GIF是一種創建動畫的可視方式,無需任何前端代碼。 您需要先使用Photoshop或熟悉的工具來創建GIF。 這里有6個便捷的動畫教程,可以幫助您增強工作效率。

After exporting as .gif file, host it either on GitHub or your personal website. Remember to add ?raw=true to the URL to make it the permanent link (refer back to step 5).

導出為.gif文件后,將其托管在GitHub或您的個人網站上。 切記在URL上添加?raw=true使其成為永久鏈接(請參考第5步)。

<img width="600" height="auto" style="max-width: 100%;" src="https://github.com/rosyhnguyen/imageudemy/blob/fedfec0cf9ca639ef3eaf4b4be26b1a4702709dd/cowboy.gif?raw=true">

Step 8

步驟8

Email Accessibility Standards

電子信箱無障礙標準

Email accessibility when you make sure that people what disable or who are using assisted technologies don’t miss out any key information when they receive your email.

當您確保禁用或正在使用輔助技術的人員在收到您的電子郵件時,不會錯過任何關鍵信息。

Making sure your email accessible is really important because you may miss a large portion of the audience if your email fails accessibility standards.

確保電子郵件的可訪問性非常重要,因為如果您的電子郵件不符合可訪問性標準,您可能會錯過很大一部分受眾。

First, always have the language semantic lang=“en” . To know which language code you should use, see the list here.

首先,始終使用語言語義lang=“en” 。 要了解您應該使用哪種語言代碼,請參閱此處的列表。

Second, ensure your text color high contrast. Colorsafe is a my favourite visual tool to check text contrast. 5:1 is a safe ratio.

其次,確保您的文本顏色具有高對比度。 Colorsafe是我最喜歡的視覺工具,用于檢查文本對比度。 5:1是安全比率。

Image for post

Third, have a consistent alignment. For example, all the text in my design is left aligned, which helps reader easy to follow my content sequence.

第三,保持一致。 例如,我設計中的所有文本都保持左對齊,這有助于讀者輕松遵循我的內容順序。

Email layout with the left alignment to pass accessibility standards
All the text in my design is left aligned
我設計中的所有文本都保持對齊

Forth, make sure all of your images have the alt — it’s a description of your image; all of your table has the role=“presentation”

第四,確保您所有的圖像都有alt這是對圖像的描述; 您所有表的role=“presentation”

Step 9

步驟9

Now your HTML templates are ready, how can you send them out?

現在您HTML模板已準備就緒,如何發送出去?

Not many email provider allows you to send your own custom HTML templates for free, like MailChimp and Campaign Monitor do charge you with a paid plan. However, you can import your HTML into MailJet, ConvertKit or Gmail for free with limited quantity. This is my full review about free deployment options.

沒有多少電子郵件提供商允許您免費發送自己的自定義HTML模板,例如MailChimp和Campaign Monitor會向您收取付費計劃的費用。 但是,您可以將HTML數量有限地免費導入到MailJet,ConvertKit或Gmail中。 這是我對免費部署選項的完整評論。

Step i++

步驟i ++

How to find inspiration for your emails

^ h OW找到你的電子郵件靈感

I want to show you how you can find inspiration to create your stunning emails. Everyday I receive many emails from brands I love. I click “View Online” and then right click “View page source” and see all the HTML and CSS that brand uses to create their emails.

我想向您展示如何找到靈感來創建精美的電子郵件。 每天我都會收到許多我喜歡的品牌的電子郵件。 我單擊“在線查看”,然后右鍵單擊“查看頁面源”,然后查看該品牌用于創建其電子郵件的所有HTML和CSS。

Image for post

You can learn their basic HTML and CSS code, how they set up their head section and how they reset all the CSS. Bring this code back to your Visual Studio Code. Now you have an email that look exactly like the email you like. You can apply all the steps in this article to create a new look for your HTML email.

您可以學習它們的基本HTML和CSS代碼,如何設置其頭部以及如何重置所有CSS。 將此代碼帶回到您的Visual Studio代碼。 現在,您將收到一封與您喜歡的電子郵件完全相似的電子郵件。 您可以應用本文中的所有步驟來為HTML電子郵件創建新外觀。

To explain my steps better, I created my free Udemy course after a lot of effort in 2 months self isolation to give back to design community “Design to Code: Turning Email Designs into HTML and CSS”.

為了更好地說明我的步驟,我在兩個月的自我隔離之后付出了巨大的努力,創建了免費的Udemy課程,以回饋給設計社區“從設計到代碼:將電子郵件設計轉換為HTML和CSS”。

If you liked this article, here are some other articles you may enjoy.

如果您喜歡本文,則可能會喜歡其他一些文章。

Feel free to ping me on LinkedIn. For more useful resources, or 1-on1 Q&A chat, read more on my Quora space here!

隨時在 LinkedIn 上對我執行ping操作 欲了解更多有用的資源,或1-ON1 Q&A聊天,了解更多關于我的Quora的空間 在這里

Visit me at my portfolio site ?🤞

在我的投資組合 網站上 訪問我 ?🤞

翻譯自: https://blog.prototypr.io/transform-email-designs-into-html-css-with-the-least-coding-b21a911199cf

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/275621.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/275621.shtml
英文地址,請注明出處:http://en.pswp.cn/news/275621.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Hulu CEO預計網站本年營收將達5億美元

網易科技訊 3月2日動靜&#xff0c;據國外媒體報道&#xff0c;美國在線視頻網站Hulu CEO杰森吉拉爾&#xff08;Jason Kilar&#xff09;明天不日發揮分析&#xff0c;Hulu本年告白及訂閱營收將達5億美元&#xff0c;是去年的兩倍。吉拉爾周一在由互聯網告白局舉辦的“2011年年…

webRTC——瀏覽器里的音視頻通話

背景 webRTC是Google在2010年收購GIP公司之后獲得的一項技術。如下圖所示&#xff0c;它提供了音視頻的采集、處理(降噪&#xff0c;回聲消除等)、編解碼、傳輸等技術。webRTC的目標是實現無需安裝任何插件就可以通過瀏覽器進行P2P的實時音視頻通話及文件傳輸&#xff0c;來看看…

面對 this 指向丟失,尤雨溪在 Vuex 源碼中是怎么處理的

1. 前言大家好&#xff0c;我是若川。好久以前我有寫過《面試官問系列》&#xff0c;旨在幫助讀者提升JS基礎知識&#xff0c;包含new、call、apply、this、繼承相關知識。其中寫了 面試官問&#xff1a;this 指向 文章。在掘金等平臺收獲了還算不錯的反饋。最近有小伙伴看我的…

轉:Python: threading.local是全局變量但是它的值卻在當前調用它的線程當中

原文地址:http://www.cnblogs.com/fengmk2/archive/2008/06/04/1213958.html 在threading module中&#xff0c;有一個非常特別的類local。一旦在主線程實例化了一個local&#xff0c;它會一直活在主線程中&#xff0c;并且又主線程啟動的子線程調用這個local實例時&#xff0c…

matlab的邊緣檢測方法,常用圖像邊緣檢測方法及Matlab研究

2011 年 2 月 15 日第 34 卷第 4 期 現代電子技術 Modern Electronics Technique Feb. 2011 Vol. 34 No. 4 常用圖像邊緣檢測方法及 Matlab 研究 韋  煒 (西安文理學院 , 陜西 西安   710065) 摘  要 :邊緣檢測在數字圖像處理中有著重要的作用。為了在實際應用中能夠選擇最佳…

單選按鈕步驟流程向導 js_創建令人愉快的按鈕的6個步驟

單選按鈕步驟流程向導 jsThere is no modern interactive UI without buttons. They are an fundamental part of every digital solution. Learn how to improve the style of your buttons and delight users with perfect style.沒有按鈕&#xff0c;就沒有現代的交互式UI。…

Android 四大組件之 Activity

什么是 Activity&#xff1f; Activity 是 Android 的四大組件之一&#xff0c;是用戶操作的可視化界面&#xff0c;它為用戶提供了一個完成操作指令的窗口。 當我們創建完 Activity 之后&#xff0c;需要調用 setContentView(view) 方法來完成界面的顯示&#xff0c;以此來為用…

axios怎么封裝,才能提升效率?

大家好&#xff0c;我是若川。今天分享一篇axios封裝的文章。學習源碼系列、面試、年度總結、JS基礎系列。作為前端開發者&#xff0c;每個項目基本都需要和后臺交互&#xff0c;目前比較流行的ajax庫就是axios了&#xff0c;當然也有同學選擇request插件&#xff0c;這個蘿卜白…

圖片有花

http://www.56.com/u50/v_NTUwMzE1NDM.html http://www.56.com/u39/v_NTUwMzE2MjA.html http://www.cnblogs.com/coffee_cn/archive/2009/11/30/1613823.html http://www.imagemagick.org/script/binary-releases.php?ImageMagickmm3e9bn5mtos6eiaelh9d4aoe4#windows 轉載于:h…

java 代碼執行el,專屬于java的漏洞——EL表達式注入

前言“FSRC經驗分享”系列文章&#xff0c;旨在分享焦點科技信息安全部工作過程中的經驗總結&#xff0c;包括但不限于漏洞分析、運營技巧、sdl推行、等保合規、自研工具等等。歡迎各位安全從業者持續關注~0x01EL簡介表達式語言(Expression Language 以下簡稱EL)是以JSTL(JavaS…

護膚產生共鳴_通過以人為本的設計編織共鳴的20個指針

護膚產生共鳴Deep into a project right now, I can’t help but reflect on how I practice empathy in design. Human centered design means empathising with and designing for people, keeping our focus on people throughout. It is not just one stage, it is a minds…

谷歌已推送 Android Q Beta 1

開發四年只會寫業務代碼&#xff0c;分布式高并發都不會還做程序員&#xff1f; >>> 今日凌晨&#xff0c;谷歌正式推送了 Android Q 的首個 Beta 版本&#xff0c;Pixel 全系列手機可以嘗鮮體驗這款最新的系統。 據官方博客介紹&#xff0c;Android Q 為用戶帶來了…

對使用CodeSmith模板生成NHibernate的代碼的分析

CodeSmith是我們常用的代碼生成工具&#xff0c;其跟據不同的模板生成不同代碼的方式能大大加快我們的項目開發&#xff0c;減少重復勞動。NHibernate模板就是其常用模板之一。從這里可以下載到最新的模板文件。現在最新的版本為NHibernate-v1.2.1.2125&#xff0c;可以生成NHi…

若川誠邀你加源碼共讀群,每周一起學源碼

小提醒&#xff1a;若川視野公眾號面試、源碼等文章合集在菜單欄中間【源碼精選】按鈕&#xff0c;歡迎點擊閱讀&#xff0c;也可以星標我的公眾號&#xff0c;便于查找。回復pdf&#xff0c;可以獲取前端優質書籍。最近我創建了一個源碼共讀的前端交流群&#xff0c;希望嘗試幫…

matlab 規范,matlab-代碼-規范

matlab-代碼-規范 1. 標識符命名原則 標識符的名字應當直觀&#xff0c;其長度應當符合“最小長度&#xff0c;最大信息量”原則。 1) 非矩陣變量&#xff1a; 變量名應該以小寫字母開頭的大小寫混合形式 譬如&#xff1a;shadowFadingTable&#xff0c;servingSector&#xf…

zoom視頻會議官網_人性化視頻會議的空間(Zoom等)

zoom視頻會議官網第二部分&#xff1a;房間的創造力 (Part Two: The Creativity of Rooms) In Part One I shared thoughts on how virtual spaces can often leave little room to embody our most human selves. The lack of a public sphere that parallels our shared publ…

KOFLive Postmortem

為期兩個月的團隊項目完成了&#xff0c;我們的游戲也已經發布。在這個名叫KOFLive的小游戲里&#xff0c;我們集成了五個真人角色&#xff0c;每個角色有拳腳基本招數以及三個小招、一個大招&#xff0c;硬值、防御、集氣、雙人對戰、人機對戰、練習模式等格斗游戲的Feature基…

單調隊列優化多重背包

就是按照 % 體積的余數來分組&#xff0c;每組單調隊列優化。 直接上模板好了。 1 #include <bits/stdc.h>2 3 typedef long long LL;4 const int N 100010;5 6 int n, V, cnt[N], cost[N];7 LL f[2][N], val[N], p[N], top, head;8 9 inline void Max(LL &a, const…

2021年7月 蝦皮、貨拉拉、有贊等面經總結

大家好&#xff0c;我是若川&#xff0c;加我微信 ruochuan12 進源碼交流群。今天分享一篇7月份新鮮出爐的面經&#xff0c;文章較長&#xff0c;可以收藏再看。學習源碼系列、面試、年度總結、JS基礎系列。本文來自作者幾米陽光 投稿 原文鏈接&#xff1a;https://juejin.cn/p…

Oracle對表名大小寫敏感嗎,讓Oracle 大小寫敏感 表名 字段名 對像名

一、解決方案1、在表名、字段名、對象名上加上雙引號&#xff0c;即可實現讓oracle大小寫區分。2、但是這又引起了另一個問題&#xff1a;在數據庫操作中&#xff0c;sql語句中相應的表名、字段名、對象名上一定要加雙引號。解決辦法是&#xff1a;使用"\"轉義。如&a…