Home Web Front-end CSS Tutorial Some CSS/XHTML knowledge summary for learning WEB standards Page 1/3_Experience exchange

Some CSS/XHTML knowledge summary for learning WEB standards Page 1/3_Experience exchange

May 16, 2016 pm 12:04 PM
web standards

1. Many compatibility issues are caused by different tags having different default padding margin values ​​in different browsers. So you can define it in advance

Copy code The code is as follows:


* { padding: 0; margin:0;}

Or

Copy code The code is as follows:


ul,li,h1,h2,h3,h4,h5,h6,p,table,td,p ,img,hr,dd,dt,span,a,dt,dd,ol{margin:0;padding:0;font-size:12px;}



2. Regarding the layout, you can see how the template in Dreamweaver CS3 is written. Its writing method is the best way. For large layouts, you can directly use the default templates in dreamweaver cs3. Then remove the comment and it will work.

3. Use margin/padding appropriately. When adjusting the position of elements in the box, it is better to use the padding of the box. Do not use the margin of the element inside the box.

The reason is that when the elements in the box use margin, it will affect the margin of the box and cause misalignment.

But pay attention to one thing when using padding: For example, if the original width:100px box is set to padding-left:20px, then the width must be subtracted by 20px.

4. For a box, after setting the border, you need to subtract the thickness of the border from the width. For example, if a box with width: 100px has 1px sides on the left and right, the box width should be set to 98px.

5. When adding a box, try not to give width and height if possible.

Height can be expanded by internal elements.

If width is not set, the default is 100% width.

6. The method to set the background image and background color for a box at the same time is to set the background image first, and then set the background color. The code is as follows:

Copy code The code is as follows:


.bg {background:url(/images/blbian.gif) no-repeat}
.style1 {width:100px;height:100px;background-color:#ebf1e5; }





7. When float:left and the like When there are too many things written and it affects the surrounding or lower elements, try using clear:both to clear it.

Copy code The code is as follows:




.clearfloat {
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}



8. When making the following settings


, will cause compatibility issues. There will be a problem with ie6. You will find that the box is not 3px high.
The following settings are required: font-size:1px; so that there will be no problem. Refer to the writing method in clearfloat in the dw cs3 template, and also add line-height:0px. But I found that it’s possible not to add it. But the Canadian Association is more formal.

9. When setting the height for a single line of text, set line-height at the same time. Otherwise, there will be compatibility issues and the text will be slightly misaligned.

10. When using ul li list, be sure to set list-style-type: none; otherwise compatibility problems will occur. The origin will appear under ff, but often not visible under ie.


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)

What are web standards? What are web standards? Oct 18, 2023 pm 05:24 PM

Web standards are a set of specifications and guidelines developed by W3C and other related organizations. It includes standardization of HTML, CSS, JavaScript, DOM, Web accessibility and performance optimization. By following these standards, the compatibility of pages can be improved. , accessibility, maintainability and performance. The goal of web standards is to enable web content to be displayed and interacted consistently on different platforms, browsers and devices, providing better user experience and development efficiency.

What are Web standards and W3C standards? What are Web standards and W3C standards? Feb 19, 2024 pm 02:28 PM

Web standards and what are W3C standards? Specific code examples are required. Web standards are a series of technical specifications and best practices that are formulated by the W3C (WorldWideWebConsortium) and recommended to developers. Its purpose is to ensure that web pages display the same way across different devices and browsers. W3C is an international organization founded in 1994 by Internet pioneer Tim Berners-Lee. It is committed to formulating and promoting Web standards.

Is Debian Strings compatible with multiple browsers Is Debian Strings compatible with multiple browsers Apr 02, 2025 am 08:30 AM

"DebianStrings" is not a standard term, and its specific meaning is still unclear. This article cannot directly comment on its browser compatibility. However, if "DebianStrings" refers to a web application running on a Debian system, its browser compatibility depends on the technical architecture of the application itself. Most modern web applications are committed to cross-browser compatibility. This relies on following web standards and using well-compatible front-end technologies (such as HTML, CSS, JavaScript) and back-end technologies (such as PHP, Python, Node.js, etc.). To ensure that the application is compatible with multiple browsers, developers often need to conduct cross-browser testing and use responsiveness

Check ionic version on mac? Check ionic version on mac? Feb 03, 2024 pm 06:45 PM

This article will introduce how to check the Ionic version on Mac. I hope it will be helpful to everyone, let’s learn about it together. How to use ionic to package and develop IOS programs under Windows. If you use Ionic to develop applications and are not familiar with packaging and publishing applications to iOS and Android, you can follow the steps below: First, run the "ionicbuildandroid" command, Once completed, you will find the generated .apk file in the /platforms/android/build/outputs/apk folder under the project directory. This file is the installation package of your Android application. 2. for

H5: The Evolution of Web Standards and Technologies H5: The Evolution of Web Standards and Technologies Apr 15, 2025 am 12:12 AM

Web standards and technologies have evolved from HTML4, CSS2 and simple JavaScript to date and have undergone significant developments. 1) HTML5 introduces APIs such as Canvas and WebStorage, which enhances the complexity and interactivity of web applications. 2) CSS3 adds animation and transition functions to make the page more effective. 3) JavaScript improves development efficiency and code readability through modern syntax of Node.js and ES6, such as arrow functions and classes. These changes have promoted the development of performance optimization and best practices of web applications.

Analysis of common web standards and their actual cases Analysis of common web standards and their actual cases Jan 13, 2024 pm 03:50 PM

Understand common Web standards and their practical application cases In today's digital era, the World Wide Web has become an important platform for people to obtain information, communicate, and conduct business activities. Web standards are the basis for ensuring that web pages display normally and operate stably on different browsers. This article will introduce some common web standards and illustrate their importance through practical application cases. First of all, HTML (Hypertext Markup Language) is the most basic part of the Web standards and is used to describe the structure and content of web pages. HTML uses tags to define whether

The importance of knowing and understanding web standards and their content The importance of knowing and understanding web standards and their content Jan 13, 2024 pm 12:40 PM

Understanding the importance of web standards and their content requires specific code examples. Web standards are a set of guidelines, rules, and specifications developed and promoted to ensure compatibility and compatibility between web pages, applications, and different browsers on the Internet. consistency. Understanding the importance of web standards is critical for developers, designers, and content creators. The orderly use of web standards can not only improve development efficiency, but also provide a better user experience while reducing development and maintenance costs. Web standards cover many aspects, including HT

What do international web standards cover? What do international web standards cover? Dec 25, 2023 pm 02:38 PM

International web standards cover eight types: "HTML", "CSS", "JavaScript", "XML", "DOM", "SVG", "WebRTC" and "HTTP": 1. HTML, markup used to create web pages Language, which defines the structure and content of web pages; 2. CSS, used to describe the style and layout of web pages; 3. JavaScript, a scripting language, used to add interactive and dynamic effects to web pages; 4. XML, used for transmission and storage Markup language for data, etc.

See all articles