search
HomeWeb Front-endHTML Tutorialchrome中不可见字符引发的float问题_html/css_WEB-ITnose

  起因是刷知乎时碰到这么个问题:https://www.zhihu.com/question/41400503

  问题代码如下:

<!DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8"><style>    .cf {        zoom: 1;    }    .cf:after {        clear: both;        content: "";        display: block;    }	.cf:before {	    content: "";	  display: block;	}    .out {        width: 730px;        border: 1px solid #ccc;    }    .left {        float: left;        width: 90px;        height: 20px;        margin: 3px 5px;        background: #D7E9F7;    }    .other {        width: 10px;        background: red;    }</style></head><body>    <div class="out cf">        <div class="left"></div>        <div class="left"></div>        <div class="left"></div>        <div class="left"></div>        <div class="left"></div>        <div class="left"></div>        <div class="left"></div>        <div class="left"></div>        <div class="left"></div>        <div class="left"></div>        <div class="left"></div>        <div class="left"></div>        <div class="left"></div>        <div class="left other"></div>    </div></body></html>  

  

  在chrome中,最后一个.other会float到第一行的末尾:

  最开始认为是before伪类的问题:

  给出的解决方案是让提问者删掉.cf的before伪类,然后.other正常float到第二行最后。

  后来细细想了下,没有听说过类似的问题,搜了下也没有发现类似案例,怀疑问题判断有误。copy提问者代码到sublime里面进行排错测试,习惯性把css代码compact,.other居然正常float。

  恰巧前几天见过一个不可见字符导致页面显示错误的问题,灵光一闪地往这方面怀疑起来,设置sublime显示空白:"draw_white_space": "all"。果然有问题:

  

  改用UltraEdit的16进制视图打开:

  

  在display前面有两个编码为e38080的不可见字符,查编码对照表:

  

  

  最近状态不佳,一直无所事事打酱油,碰到个问题不断往深处探究,感觉真是比打DOTA还爽!!!

 

 

 

     

 

 

UltraEdit 

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
HTML and Code: A Closer Look at the TerminologyHTML and Code: A Closer Look at the TerminologyApr 10, 2025 am 09:28 AM

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS, and JavaScript: Essential Tools for Web DevelopersHTML, CSS, and JavaScript: Essential Tools for Web DevelopersApr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

The Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesThe Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesApr 08, 2025 pm 07:05 PM

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.

Is HTML easy to learn for beginners?Is HTML easy to learn for beginners?Apr 07, 2025 am 12:11 AM

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.

What is an example of a starting tag in HTML?What is an example of a starting tag in HTML?Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

How to use CSS's Flexbox layout to achieve centering alignment of dotted line segmentation effect in menu?How to use CSS's Flexbox layout to achieve centering alignment of dotted line segmentation effect in menu?Apr 05, 2025 pm 01:24 PM

How to design the dotted line segmentation effect in the menu? When designing menus, it is usually not difficult to align left and right between the dish name and price, but how about the dotted line or point in the middle...

What HTML elements does the online code editor use to implement code input?What HTML elements does the online code editor use to implement code input?Apr 05, 2025 pm 01:21 PM

HTML Element Analysis in Web Code Editor Many online code editors allow users to enter HTML, CSS, and JavaScript code. Recently, someone proposed...

React static page construction: How to avoid code compression with react-app-rewired?React static page construction: How to avoid code compression with react-app-rewired?Apr 05, 2025 pm 01:18 PM

About how to avoid code compression when building static pages using react-app-rewired Many developers want to deliver to...

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

mPDF

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),

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment