Common naming rules for CSS classes and ids

Common naming rules for CSS classes and ids

Public name of the page:

  • #wrapper - - The outer edge of the page controls the overall layout width
  • #container or #content - - container, used for the outermost layer
  • #layout - - Layout
  • #head, #header - - Header section
  • #foot, #footer - - footer section
  • #nav - - Main navigation
  • #subnav - - Secondary navigation
  • #menu - - Menu
  • #submenu - - Submenu
  • #sidebar - - Sidebar
  • #sidebar_a,#sidebar_b - - Left or right sidebar
  • #main - - The main body of the page
  • #tag - - Tags
  • #msg, #message - - Prompt message
  • #tips - - Tips
  • #vote - - Vote
  • #friendlink - - Friendship Links
  • #title - - Title
  • #summary - - Summary
  • #loginbar - - Login bar
  • #searchInput - - Search input box
  • #hot - - Hot Hot Spots
  • #search - - Search
  • #search_output - - Search output is similar to search results
  • #searchBar - - Search bar
  • #search_results - - Search results
  • #copyright - - Copyright information
  • #branding - - Branding
  • #logo - - Website logo
  • #siteinfo - - Site information
  • #siteinfoLegal - - Legal Notice
  • #siteinfoCredits - - Credits
  • #joinus - Join us
  • #partner - - Partner
  • #service - - Service
  • #regsiter - - Register
  • arr/arrow - - Arrow
  • #guild - - Guide
  • #sitemap - - Sitemap
  • #list - - List
  • #homeepage - - Home
  • #subpage - - Second level subpage
  • #tool,#toolbar - - Toolbar
  • #drop - - Drop down
  • #dorpmenu - - Drop-down menu
  • #status - - Status
  • #scroll - - Scroll
  • .tab - - Tabs
  • .left,.right,.center - - Center, left, right
  • .news - - News
  • .download - - Download
  • .banner - - Advertisement banner (top banner)
  • E-commerce related:
  • .products - - Products
  • .products_prices - Product prices
  • .products_description - Product description
  • .products_review - - Product reviews
  • .editor_review - - Editor review
  • .news_release - - Latest releases
  • .publisher - - Producer
  • .screenshot - - thumbnail
  • .faqs - Frequently Asked Questions
  • .keyword - - Keyword
  • .blog - - Blog
  • .forum - - Forum

Basic naming:

  • Wrap - - For the outermost layer
  • Header - - For header
  • Main content - - used for the main content (middle)
  • main-left - - Left layout
  • Main-right - - Right layout
  • Navigation bar nav - - Web page menu navigation bar
  • Content - - used for the main body of the web page
  • footer - - used for the bottom

CSS file naming:

  • master.css, style.css - - Main
  • module.css - - Module
  • base.css - - Basic common
  • layout.css - - Layout, layout
  • themes.css - - Themes
  • columns.css - - Columns
  • font.css - - Text, fonts
  • forms.css - - Forms
  • mend.css - - Patch
  • print.css - - Print

Naming suggestions:

Whether it is named after the "." (lowercase period) selector or the "#" (pound sign) selector, we finally follow that the main, important, special, and outermost boxes are named after the "#" (pound sign) selector, and the others are named after the "." (lowercase period), while considering the named CSS selectors to be reused in HTML.

This concludes this article about the commonly used naming rules for CSS classes and ids. For more information on CSS class and id naming rules, please search 123WORDPRESS.COM’s previous articles or continue browsing the related articles below. We hope that everyone will support 123WORDPRESS.COM in the future!

<<:  HTML user registration page settings source code

>>:  When div is set to contentEditable=true, the cursor cannot be positioned after resetting its content

Recommend

Mysql 5.6 adds a method to modify username and password

Log in to MySQL first shell> mysql --user=root...

Bootstrap 3.0 study notes CSS related supplement

The main contents of this article are as follows:...

Markup Language - Title

Click here to return to the 123WORDPRESS.COM HTML ...

Using front-end HTML+CSS+JS to develop a simple TODOLIST function (notepad)

Table of contents 1. Brief Introduction 2. Run sc...

JavaScript exquisite snake implementation process

Table of contents 1. Create HTML structure 2. Cre...

Detailed description of shallow copy and deep copy in js

Table of contents 1. js memory 2. Assignment 3. S...

HTML+CSS implementation code for rounded rectangle

I was bored and suddenly thought of the implementa...

Html easily implements rounded rectangle

Question: How to achieve a rounded rectangle usin...

How to maintain MySQL indexes and data tables

Table of contents Find and fix table conflicts Up...

Rsync+crontab regular synchronization backup under centos7

Recently, I want to regularly back up important i...

Analyze the duration of TIME_WAIT from the Linux source code

Table of contents 1. Introduction 2. First, let&#...

Detailed explanation of the correct use of the count function in MySQL

1. Description In MySQL, when we need to get the ...

Summary of several replication methods for MySQL master-slave replication

Asynchronous replication MySQL replication is asy...

MySQL constraint types and examples

constraint Constraints ensure data integrity and ...