The content of this article is about trying to avoid underlines when naming CSS layouts. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Friends who have used css hacks should know that naming with underscores is also a hack. For example, using a name like "_style" can make most browsers other than IE The definition of this style is ignored, so using "_" as the delimiter when naming is irregular. An error message will appear when doing CSS checking, so avoid using underscores in names.
For this purpose, you need to find a symbol that can replace the underscore and is compliant with the standards. Of course, you don’t have to use this kind of separator, it’s just a matter of personal habits.
I did a small test and replaced the underscores with "~", "$", "`", "&" and "-". As a result, only the "-" sign can be used. And the support for js is also normal. Take a look at the test:
The following is the quoted content:
css part:
The code is as follows:
.try-a{ color:#00f; } .try~a{ color:#00f; } .try`a{ color:#00f; } .try&a{ color:#00f; } .try$a{ color:#00f; } .try-b{ color:#f00; } .try~b{ color:#f00; } .try`b{ color:#f00; } .try&b{ color:#f00; } .try$b{ color:#f00; }
html Part:
The code is as follows:
<div id="a" class="try-a">try1</div> <div id="b" class="try~a">try2</div> <div id="c" class="try`a">try3</div> <div id="d" class="try&a">try4</div> <div id="e" class="try$a">try5</div></p> <p><input type="button" value="ok" onclick="b();" />
js part:
The code is as follows:
function b(){ document.getelementbyid("a")。classname="try-b"; document.getelementbyid("b")。classname="try~b"; document.getelementbyid("c")。classname="try`b"; document.getelementbyid("d")。classname="try&b"; document.getelementbyid("e")。classname="try$b"; }
The result is that "try1" turns red and the display is normal. However, in CSS definitions, the id selector is often used. If "_" is used in the id name on the page, the underline "_" will inevitably appear in the css style, so here you must also pay attention to the id. Also avoid using underscores in naming.
The above is the complete introduction to try to avoid underlines when naming css layout. If you want to know more about CSS3 tutorial, please pay attention to the PHP Chinese website.
The above is the detailed content of How to avoid underlines when naming css layout. For more information, please follow other related articles on the PHP Chinese website!

You can make a garden variety anchor link () open up a new email. Let's take a little journey into this feature. It's pretty easy to use, but as with anything

Little confession here: when I first saw Netlify CMS at a glance, I thought: cool, maybe I'll try that someday when I'm exploring CMSs for a new project. Then

In December 2018, Microsoft announced that Edge would adopt Chromium, the open source project that powers Google Chrome. Many within the industry reacted with

I like Gutenberg, the new WordPress editor. I'm not oblivious to all the conversation around accessibility, UX, and readiness, but I know how hard it is to

Using for a menu may be an interesting idea, but perhaps not something to actually ship in production. See "More Details on "

With visual regression testing, we can update a page, take screenshots before and after the fact, and compare the results for unintended changes. In this article, learn how to set up visual regression testing using Playwright.

CSS Houdini may be the most exciting development in CSS. Houdini is comprised of a number of separate APIs, each shipping to browsers separately, and some


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

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

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

Dreamweaver CS6
Visual web development tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment