Home Web Front-end HTML Tutorial 'CSS Website Layout Record' Study Notes (1)_html/css_WEB-ITnose

'CSS Website Layout Record' Study Notes (1)_html/css_WEB-ITnose

Jun 24, 2016 pm 12:05 PM
study layout notes website

Start today and study front-end technology seriously, hahaha~~~Come on~~~

Recommend this "CSS Website Layout Record" (2nd Edition) to beginners , although this book is a bit old, it is still a classic.

Note: The CSS described here are all CSS 2.0 versions.

Chapter 1 Overview of Web Standards and CSS Layout

1.1 History and Development of Web Standards

1.1.1 Web standards

Web standards are a set of specifications developed by W3C (World Wide Web Consortium) and other standardization organizations, including a series of standards, including HTML, XHTML, JavaScript, CSS, etc.

The purpose of Web standards is to create a unified technical standard for the Web presentation layer to display information content to end users through different browsers or terminal devices.

1.1.2 Web presentation layer technology

 The Web itself is composed of a very complex technical architecture, but its ultimate purpose is to Users of browsers or applications and provide the latter with a visual and easy-to-operate information interaction platform. The presentation layer technology refers to the technology that displays information to users and provides users with interactive behaviors. To simply understand, presentation is style. On a technical level, it is a bunch of program code, and what the presentation layer brings is what is seen visually.

At present, the Web standards formulated by W3C are just such a collection of presentation layer technologies, and are currently the only cross-platform and cross-client technology.

1.2 The composition of Web standards

 Web standards are a set of standards composed of three parts: Structure, Presentation and Behavior.

1.2.1 Structure

  Structure is used to organize and classify the information used in web pages. The main Web standard technologies used for structured design include HTML, XML, and XHTML.

 1. HTML (Hyper Text Mark-up Language) Hypertext Markup Language

 This is the most basic description language of the Web. HTML text is descriptive text composed of HTML command tags. HTML tags can describe text, graphics, animations, sounds, tables, links, etc. The structure of HTML includes two parts: Head and Body. The header describes the information required by the browser, and the body contains the specific content to be displayed.

 2. XML (The Extensible Markup Language) Extensible Markup Language

 XML was originally designed to make up for the shortcomings of HTML and meet its powerful expansibility. To meet the needs of network information release, it was later gradually used for the conversion and description of network data.

 3. XHTML (The Extensible HypterText Markup Language) Extensible Hypertext Markup Language

 Simply put, the purpose of establishing XHTML is to realize the transition from HTML to XML.

1.2.2 Presentation

 Presentation technology is used to control the display of structured information, including layout , color, size and other style controls. In the current Web display, the Web standard technology used for performance is mainly CSS technology.

CSS (Cascading Style Sheets) Cascading Style Sheets
The purpose of W3C in creating the CSS standard is to use CSS to describe the layout design of the entire page, separate from the structure responsible for HTML. Using CSS layout combined with the information structure described by XHTML can help designers separate presentation and content, making it easier to build and maintain sites.

1.2.3 Behavior

  Behavior refers to the definition of a model within the entire document and the writing of interactive behaviors. It is used to write documents that users can interactively operate. Web standard technologies that express behavior mainly include: DOM and ECMAScript.

 1. DOM (Document Object Model) document object model

 According to W3C DOM Specification, DOM is an interface that allows the browser to communicate with the Web content structure, making it possible to access standard components on the page. Gives web designers and developers a standard way to access data, scripts, and presentation objects in the site.

 2. ECMAScript scripting language (expanded scripting language of JavaScript)

 It is a standard scripting language (JavaScript) developed by CMA (Computer Manufacturers Association). Used to implement interactive operations of objects on a specific interface.

1.3 The difference between CSS layout and table layout

 From the current Web standards, the most ideal technical structure is to use HTML or XHTML to When designing web pages, it is recommended to use XHTML to write the structure in a more rigorous language, and use CSS to complete the layout of the web page.

1.3.1 Advantages of CSS

CSS is the basis for controlling the layout style of web pages, and is a style design language that can truly separate web page performance and content. Compared with traditional HTML's control over styles, CSS can precisely control the position of objects in web pages at the pixel level, supports almost all fonts and font size styles, and has the ability to control the style of web page object box models, and can Carry out preliminary page interaction design. To sum up, CSS has the following main advantages:

  • Perfect browser support: Web pages designed with CSS styles have the closest style performance on many platforms and browsers.
  • Separation of performance and structure; in CSS design code, through the internal import (Import) feature of CSS, the design code can be separated twice according to design requirements.
  • The style design control function is powerful: the position layout of web page objects can be controlled with pixel-level precision, etc.
  • Superior inheritance performance (cascading processing): CSS code has basic characteristics similar to OOP object-oriented in the browser's parsing order. The browser can proceed in the order in which the same element is defined based on the CSS level. Apply multiple styles.
  • 1.3.2 Traditional table layout and CSS layout

     In fact, the traditional table layout method only takes advantage of the table element of HTML The zero border feature. Since the table element can be displayed with the cell borders and spacing set to 0, that is, no borders are displayed, each element in the web page can be divided according to the layout and placed into each cell of the table, thereby achieving A complex typesetting combination effect.

    The most common form of table layout code is to embed some design code between HTML tags, such as width="100%", border="0", etc., and this hybrid writing of a large amount of style design code Mixed into table cells, their readability is greatly reduced and maintenance costs are high.

    The core of the table layout is to design a table structure that can meet the format requirements, and load the content into each cell. The spacing and spaces are implemented through many transparent gifs as placeholders. The final structure is a complex The form, and such a complex form design makes the web page file huge, which is not conducive to design and modification, and ultimately causes the browser to download and parse too slowly.

    Using CSS layout can fundamentally change this situation. The thinking method of CSS layout is no longer put into the design of the table element, but is replaced by another element div in HTML. A div can be understood as a layer or a block. A div is a simpler element than a table. The function of div is only to mark a piece of information for later style definition.

    When using divs, there is no need to organize the layout through its internal cells like a table. Through the powerful style definition function of CSS, you can control the layout and style of the page more simply and freely than tables. Listed below are some div style design codes:

    >

    1 [html] 2 3 /* 表示页面中定义了一个div,并使用content这个class名称 */4 <div class="content">....</div>
    Copy after login
    The .content{} area indicates that a style name named content is defined in CSS, which is used to control the style of all objects with class content in the page.

    1.4 Transition to Web Standards

     1 [CSS]  2  3 .content { 4  float: right; /* 表示div浮动在当前位置的右侧 */ 5  margin: 10px 20px 10px 10px; /* 设置外边距属性 */ 6  text-align: center; /* div里的文字居中显示 */ 7  line-height: 160%; /* div中的文字行高为原高的160% */ 8  width: 50%; /* 表示这个div的宽度为所处的上一层位置的50% */ 9  background-color: blue; /* 表示div的背景色为蓝色 */10 }
    Copy after login
     

    The purpose of Web standards is to achieve the separation of web page structure, performance, and behavior, achieve the best architecture, and provide Website usability and user experience. It is the most ideal choice to build a website using the following standards and methods.

    1.4.1 From HTML to XHTML

     Why use XHTML

    In fact, XHTML is the next version of HTML, a set of transitional markup languages ​​used to replace HTML and help move to XML. XHTML is not designed for final performance. It is mainly used for structural design of web page content. Its rigorous grammatical structure is conducive to browser parsing. It is a design language oriented towards document structure.

    Currently, XHTML usage standards mainly include three application methods: Transitional, Strict and Frameset. Transitional mode: a loose transitional XHTML application that allows users to use some HTML tags to write XHTML documents. This method is recommended.

    Strict mode: A strict application mode. No style tags and attributes can be used in XHTML.

    Frameset method: The application method for frame web pages.

    1.4.2 Give full play to the role of CSS

  •  1. Reasonable CSS file structure
  •   Although CSS achieves the separation of style design and content, the CSS file itself should also have a good hierarchical structure and specifications in order to further improve the maintainability of style design.

     

    2. Advantages of inheritance and reuse

    The advantage of using CSS lies in its good reuse characteristics. A piece of CSS design code can be used by multiple areas at the same time. In addition to the reuse function, CSS can also implement an inheritance mechanism similar to that in object-oriented programming. Through the inheritance mechanism, the style structure of the website can be further improved.

     3. Design cross-platform code

    CSS also has shortcomings. Due to the different rendering methods between different brands of browsers and different versions, their respective analysis of CSS is also different. There are certain differences. For these reasons, CSS design should also have certain cross-platform compatibility features, and the use of uncommon attributes should be minimized when coding. If you want to be compatible with older versions of browsers, you should also pay attention to leaving certain CSS hack codes.

    CSS hack can be simply translated as CSS hacker program. This is similar to expecting the browser to receive the code, which can effectively fix the browser's parsing problem.

     4. CSS style design with good usability

      The goal of usability is to make interactive products (software, websites) satisfy user needs to the maximum extent. The purpose of CSS style design with good usability is to create a better interactive website through good design so that users can use it.

     5. Use DOM-based scripting language to write interactions

     DOM is also produced to realize cross-platform and cross-browser applications of scripting language. For now, most browsers support the standard DOM. Using a DOM-compliant scripting language, you basically no longer need to detect different versions of the browser and write several different sets of code. As long as the browser is DOM-compliant, the same code can complete all supported operations. The current JavaScript is a scripting language that conforms to the DOM standard.

    1.5 Frequently Asked Questions

    1.5.1 Are tables still useful after using web standards?

     1. About Tables

    After using Web standards, it does not mean that the use of tables is excluded. It is just that using tables as web page layout and layout page elements is unreasonable. Table format is used to display data. of. The function of the table is not to layout the web page, the layout task should be left to CSS.

     2. About other elements

    Based on usage experience, some elements in the XHTML standard are divided into three major categories.

  • Auxiliary layout design elements
  • It refers to div, span and other elements. Their main function is to layout the entire page.

  • Structural elements or information elements
  • Refers to elements such as table, ul, pre, code, etc. They are elements for information display and control.

  • a. meta elements
  • Use them to implement some special functions.

    1.5.2 Can I continue to use HTML to design web pages?

     The answer is yes. The reason why XHTML is recommended is that the design form of HTML can no longer meet the website architecture principle of separation of performance and content. If you continue to use HTML to build your website, there will be no difference in terms of the ultimate goal.

    1.5.3 Why not use XML directly

     XML is the description format of future data. For now, it is not suitable for direct application XML is used to build websites because it is technically difficult.

    1.5.4 What is website reconstruction

     Website reconstruction can be understood as changing the old HTML table layout and using new conformity Web standard website structure and code writing methods. In a deeper sense, we hope to provide an interface that increases website efficiency through Web standards. This benefit can be simply understood as two aspects: scalability and maintainability.

    To be continued....

    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

    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)
    4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. Best Graphic Settings
    4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. How to Fix Audio if You Can't Hear Anyone
    4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    WWE 2K25: How To Unlock Everything In MyRise
    1 months ago By 尊渡假赌尊渡假赌尊渡假赌

    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)

    How to delete Xiaohongshu notes How to delete Xiaohongshu notes Mar 21, 2024 pm 08:12 PM

    How to delete Xiaohongshu notes? Notes can be edited in the Xiaohongshu APP. Most users don’t know how to delete Xiaohongshu notes. Next, the editor brings users pictures and texts on how to delete Xiaohongshu notes. Tutorial, interested users come and take a look! Xiaohongshu usage tutorial How to delete Xiaohongshu notes 1. First open the Xiaohongshu APP and enter the main page, select [Me] in the lower right corner to enter the special area; 2. Then in the My area, click on the note page shown in the picture below , select the note you want to delete; 3. Enter the note page, click [three dots] in the upper right corner; 4. Finally, the function bar will expand at the bottom, click [Delete] to complete.

    What should I do if the notes I posted on Xiaohongshu are missing? What's the reason why the notes it just sent can't be found? What should I do if the notes I posted on Xiaohongshu are missing? What's the reason why the notes it just sent can't be found? Mar 21, 2024 pm 09:30 PM

    As a Xiaohongshu user, we have all encountered the situation where published notes suddenly disappeared, which is undoubtedly confusing and worrying. In this case, what should we do? This article will focus on the topic of &quot;What to do if the notes published by Xiaohongshu are missing&quot; and give you a detailed answer. 1. What should I do if the notes published by Xiaohongshu are missing? First, don't panic. If you find that your notes are missing, staying calm is key and don't panic. This may be caused by platform system failure or operational errors. Checking release records is easy. Just open the Xiaohongshu App and click &quot;Me&quot; → &quot;Publish&quot; → &quot;All Publications&quot; to view your own publishing records. Here you can easily find previously published notes. 3.Repost. If found

    How to add product links in notes in Xiaohongshu Tutorial on adding product links in notes in Xiaohongshu How to add product links in notes in Xiaohongshu Tutorial on adding product links in notes in Xiaohongshu Mar 12, 2024 am 10:40 AM

    How to add product links in notes in Xiaohongshu? In the Xiaohongshu app, users can not only browse various contents but also shop, so there is a lot of content about shopping recommendations and good product sharing in this app. If If you are an expert on this app, you can also share some shopping experiences, find merchants for cooperation, add links in notes, etc. Many people are willing to use this app for shopping, because it is not only convenient, but also has many Experts will make some recommendations. You can browse interesting content and see if there are any clothing products that suit you. Let’s take a look at how to add product links to notes! How to add product links to Xiaohongshu Notes Open the app on the desktop of your mobile phone. Click on the app homepage

    Revealing the appeal of C language: Uncovering the potential of programmers Revealing the appeal of C language: Uncovering the potential of programmers Feb 24, 2024 pm 11:21 PM

    The Charm of Learning C Language: Unlocking the Potential of Programmers With the continuous development of technology, computer programming has become a field that has attracted much attention. Among many programming languages, C language has always been loved by programmers. Its simplicity, efficiency and wide application make learning C language the first step for many people to enter the field of programming. This article will discuss the charm of learning C language and how to unlock the potential of programmers by learning C language. First of all, the charm of learning C language lies in its simplicity. Compared with other programming languages, C language

    Getting Started with Pygame: Comprehensive Installation and Configuration Tutorial Getting Started with Pygame: Comprehensive Installation and Configuration Tutorial Feb 19, 2024 pm 10:10 PM

    Learn Pygame from scratch: complete installation and configuration tutorial, specific code examples required Introduction: Pygame is an open source game development library developed using the Python programming language. It provides a wealth of functions and tools, allowing developers to easily create a variety of type of game. This article will help you learn Pygame from scratch, and provide a complete installation and configuration tutorial, as well as specific code examples to get you started quickly. Part One: Installing Python and Pygame First, make sure you have

    Let's learn how to input the root number in Word together Let's learn how to input the root number in Word together Mar 19, 2024 pm 08:52 PM

    When editing text content in Word, you sometimes need to enter formula symbols. Some guys don’t know how to input the root number in Word, so Xiaomian asked me to share with my friends a tutorial on how to input the root number in Word. Hope it helps my friends. First, open the Word software on your computer, then open the file you want to edit, and move the cursor to the location where you need to insert the root sign, refer to the picture example below. 2. Select [Insert], and then select [Formula] in the symbol. As shown in the red circle in the picture below: 3. Then select [Insert New Formula] below. As shown in the red circle in the picture below: 4. Select [Radical Formula], and then select the appropriate root sign. As shown in the red circle in the picture below:

    Guide to solving misalignment of WordPress web pages Guide to solving misalignment of WordPress web pages Mar 05, 2024 pm 01:12 PM

    Guide to solving misaligned WordPress web pages In WordPress website development, sometimes we encounter web page elements that are misaligned. This may be due to screen sizes on different devices, browser compatibility, or improper CSS style settings. To solve this misalignment, we need to carefully analyze the problem, find possible causes, and debug and repair it step by step. This article will share some common WordPress web page misalignment problems and corresponding solutions, and provide specific code examples to help develop

    How to publish notes tutorial on Xiaohongshu? Can it block people by posting notes? How to publish notes tutorial on Xiaohongshu? Can it block people by posting notes? Mar 25, 2024 pm 03:20 PM

    As a lifestyle sharing platform, Xiaohongshu covers notes in various fields such as food, travel, and beauty. Many users want to share their notes on Xiaohongshu but don’t know how to do it. In this article, we will detail the process of posting notes on Xiaohongshu and explore how to block specific users on the platform. 1. How to publish notes tutorial on Xiaohongshu? 1. Register and log in: First, you need to download the Xiaohongshu APP on your mobile phone and complete the registration and login. It is very important to complete your personal information in the personal center. By uploading your avatar, filling in your nickname and personal introduction, you can make it easier for other users to understand your information, and also help them pay better attention to your notes. 3. Select the publishing channel: At the bottom of the homepage, click the &quot;Send Notes&quot; button and select the channel you want to publish.

    See all articles