Xiaomi Mall Responsive Learning_html/css_WEB-ITnose
What I have always longed for is Taobao’s mobile webpage, which is truly responsive through rem, but I always feel that it is quite different from the original approach on the PC. Maybe I can’t understand it. Over the weekend, I accidentally discovered that Xiaomi’s mobile webpage is also written in em mode. Looking at the source code, I found that this is the responsive wap webpage I am pursuing. Record the learning~
Website: http://m.mi.com
Basic settings
- a tag to click on the background blue-webkit-tap- highlight-color: rgba(0,0,0,0);
- Disable the text size adjustment function of Webkit kernel browser-webkit-text-size-adjust: none;
- Allow long words to wrap to the next line word-wrap:break-word;
Element unit (em)
- Includes: padding, margin, width, height, font-size, line-height, etc.
-
Set the base font size through the global body
body { font-size: 20px;}@media only screen and (max-width: 710px) and (min-width: 640px)body { font-size: 17.77778px;}
Copy after login
iconFont
Global style settings
@font-face { font-family: iconfont; src: url(/static/fonts/iconfont_2337a86.eot?9owfml); src: url(/static/fonts/iconfont_2337a86.eot?#iefix9owfml) format("embedded-opentype"),url(/static/fonts/iconfont_53935e1.woff?9owfml) format("woff"),url(/static/fonts/iconfont_bfbfeef.ttf?9owfml) format("truetype"),url(/static/fonts/iconfont_7a400bd.svg?9owfml#icomoon) format("svg"); font-weight: 400; font-style: normal}[class^=icon-], [class*=" icon-"], .iconfont { font-family: iconfont!important; speak: none; font-style: normal; font-weight: 400; font-variant: normal; text-transform: none; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;}
Copy after loginAdd iconfont element
.page-index .nav-index li a .icon:before { font-size: 4em; color: #5c6066; line-height: 1.375em;}
Copy after login.icon-huafeichongzhi:before { content: "\e608";}
Copy after loginOther settings
.page-index .nav-index li a .icon { display: block; margin: 0 auto .5em; width: 5em; height: 5em; -webkit-background-size: 5em 5em; -moz-background-size: 5em 5em; -ms-background-size: 5em 5em; -o-background-size: 5em 5em; background-size: 5em 5em;}
Copy after login
Layout
- Use display: table;, display: table-row;, display: table-cell;, border-collapse: collapse; or display: box;, box-flex: 1; instead of float:left layout
- Use pseudo-classes such as: first-child for difference processing
The image is adaptive based on the em width and height of the parent
.imgurl img { width: 100%;}li, img, label, input { vertical-align: middle;}
Copy after login- The background image size is set by background-size: 3.85em 2.7em;
Vertically centered content and horizontally centered content
div#DemoArea { display: box; box-align: start; -moz-box-align: start; -webkit-box-align: start; box-align: start;}
Copy after logindiv#DemoArea { display: box; box-align: start; -moz-box-pack:center; -webkit-box-pack:center; box-pack:center;}
Copy after login
Summary and reflection
- Many new CSS3 technologies have been applied which are refreshing
- Is it better to use em as a unit or rem?

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...
