Home Web Front-end CSS Tutorial The difference between a.class and a .class, pay attention to the spaces - CSS debugging tips

The difference between a.class and a .class, pay attention to the spaces - CSS debugging tips

Apr 23, 2017 am 11:28 AM
css the difference space

This problem will occur when using picture wizard technology to position pictures. Sometimes a space will cause many problems. This article introduces the difference between a.class and a.class with examples. (CSS video tutorial)

The first group

<a href="#"><span class="ico-manage">管理</span></a>
Copy after login

Use style one:

a:hover{color:black}
a:hover.ico-manage{color:red;}
Copy after login
Copy after login

At this time, the mouse passes over the word "Management" and the color is black

Use style 2:

a:hover{color:black}
a:hover .ico-manage{color:red;} //注意空格
Copy after login
Copy after login

At this time, the mouse passes over the word "Management" and the color is red


The second group

<a href="#" class="ico-manage">管理</a>
Copy after login

Use style One:

a:hover{color:black}
a:hover.ico-manage{color:red;}
Copy after login
Copy after login

At this time, the mouse passes over the word "Management" and the color is red

Use style two:

a:hover{color:black}
a:hover .ico-manage{color:red;} //注意空格
Copy after login
Copy after login

At this time, the mouse passes over the word "Management" and the color is black

For the first group a and .ico-manage, .ico-manage belongs to span The label is of a different level than a; and for the second group of a and .ico-manage, .ico-manage belongs to the label of a, that is, it is of the same level as a. From this, we can draw a conclusion:

1. When class is an attribute in the current tag, the style is written as: tag + class name

2. When class is an attribute of the sub-tag, then The style is written as: tag+space+class name

The above is the detailed content of The difference between a.class and a .class, pay attention to the spaces - CSS debugging tips. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
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

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

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 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.

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

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

Navicat Connection Database: Differences and troubleshooting between remote and local connections Navicat Connection Database: Differences and troubleshooting between remote and local connections Apr 08, 2025 pm 10:51 PM

Remote connections and local connections access databases over the network differently. The remote connection accesses the database on the remote server over the Internet, while the local connection directly accesses the database stored on the local computer.

Monitor Redis Droplet with Redis Exporter Service Monitor Redis Droplet with Redis Exporter Service Apr 10, 2025 pm 01:36 PM

Effective monitoring of Redis databases is critical to maintaining optimal performance, identifying potential bottlenecks, and ensuring overall system reliability. Redis Exporter Service is a powerful utility designed to monitor Redis databases using Prometheus. This tutorial will guide you through the complete setup and configuration of Redis Exporter Service, ensuring you seamlessly build monitoring solutions. By studying this tutorial, you will achieve fully operational monitoring settings

What is the difference between syntax for adding columns in different database systems What is the difference between syntax for adding columns in different database systems Apr 09, 2025 pm 02:15 PM

不同数据库系统添加列的语法为:MySQL:ALTER TABLE table_name ADD column_name data_type;PostgreSQL:ALTER TABLE table_name ADD COLUMN column_name data_type;Oracle:ALTER TABLE table_name ADD (column_name data_type);SQL Server:ALTER TABLE table_name ADD column_name data_

Difference between centos and ubuntu Difference between centos and ubuntu Apr 14, 2025 pm 09:09 PM

The key differences between CentOS and Ubuntu are: origin (CentOS originates from Red Hat, for enterprises; Ubuntu originates from Debian, for individuals), package management (CentOS uses yum, focusing on stability; Ubuntu uses apt, for high update frequency), support cycle (CentOS provides 10 years of support, Ubuntu provides 5 years of LTS support), community support (CentOS focuses on stability, Ubuntu provides a wide range of tutorials and documents), uses (CentOS is biased towards servers, Ubuntu is suitable for servers and desktops), other differences include installation simplicity (CentOS is thin)

Is the syntax of adding columns in different database systems the same? Is the syntax of adding columns in different database systems the same? Apr 09, 2025 pm 12:51 PM

The syntax for adding columns in different database systems varies greatly, and varies from database to database. For example: MySQL: ALTER TABLE users ADD COLUMN email VARCHAR(255); PostgreSQL: ALTER TABLE users ADD COLUMN email VARCHAR(255) NOT NULL UNIQUE;Oracle: ALTER TABLE users ADD email VARCHAR2(255);SQL Server: ALTER TABLE users ADD email VARCH

What are the methods of deleting rows in SQL What are the methods of deleting rows in SQL Apr 09, 2025 pm 12:30 PM

The methods to delete database rows include: DELETE statement: Use the WHERE clause to conditionally delete rows. TRUNCATE TABLE: Delete all data in the table, but retain the table structure (cannot be rolled back). DROP TABLE: Delete the entire table (including structure and data), and cannot be rolled back.

See all articles