Home Web Front-end H5 Tutorial Example tutorial on the combined use of H5 and CSS3

Example tutorial on the combined use of H5 and CSS3

May 24, 2017 pm 01:31 PM
css3 html5

Now, HTML5 and CSS3 are eagerly waiting for everyone. Let’s see if they can really bring our design to the next level.

Web designers can use HTML4 and CSS2. 1 Finished something cool. We can complete the logical structure of documents and create content-rich websites without using the old table-based layout. We can add beautiful and subtle styling to our website without using inline and
tags. In fact, our current design capabilities have taken us far away from that terrible era of browser wars, proprietary protocols, and those ugly web pages full of flashes, scrolls, and flashes.

Although we have commonly used HTML4 and CSS2.1 now, we can do better! We can restructure our code and make our page code more semantic. We can reduce the amount of styling code that gives pages a beautiful look and make them more scalable. Now, HTML5 and CSS3 are eagerly waiting for everyone. Let’s see if they can really bring our design to the next level...

In the past, designers often used the The table has no semantic layout. But in the end, thanks to innovators like Jeffrey Zeldman and Eric Meyer, smart designers slowly accepted the relatively more semantic

layout instead of the table layout, and began to call external style sheets. But unfortunately, complex web design requires a lot of different tag structure code, we call it "

-soup" syndrome. Maybe you are familiar with the following code:

The code is as follows:

 <p class="section"> 
      <p class="article"> 
        <p class="header"> 
            <h1>p Soup Demonstration</h1> 
            <p>Posted on July 11th, 2009</p> 
        </p> 
        <p class="content"> 
            <p>Lorem ipsum text blah blah blah.</p> 
            <p>Lorem ipsum text blah blah blah.</p> 
            <p>Lorem ipsum text blah blah blah.</p> 
        </p> 
        <p class="footer"> 
            <p>Tags: HMTL, code, demo</p> 
        </p> 
      </p> 
      <p class="aside"> 
        <p class="header"> 
            <h1>Tangential Information</h1> 
        </p> 
        <p class="content"> 
            <p>Lorem ipsum text blah blah blah.</p> 
            <p>Lorem ipsum text blah blah blah.</p> 
            <p>Lorem ipsum text blah blah blah.</p> 
        </p> 
        <p class="footer"> 
            <p>Tags: HMTL, code, demo</p> 
        </p> 
      </p> 
  </p> 
</p>
Copy after login

Although this is a bit reluctant, the above example can still illustrate the use of HTML4 for a Complex designs are still too bloated after being coded (in fact, xHTML1.1 is nothing more than that). But what’s exciting is that HTML5 solves the “

-soup” syndrome and gives us a new set of structural elements. These new HTML5 elements have more detailed semantics to replace the meaningless

tags, and at the same time provide "natural" CSS hooks for CSS calls.

The following is an example of an HTML5 solution:

The code is as follows:

<section> 
      <article> 
        <header> 
            <h1>p Soup Demonstration</h1> 
            <p>Posted on July 11th, 2009</p> 
        </header> 
        <section> 
            <p>Lorem ipsum text blah blah blah.</p> 
            <p>Lorem ipsum text blah blah blah.</p> 
            <p>Lorem ipsum text blah blah blah.</p> 
        </section> 
        <footer> 
            <p>Tags: HMTL, code, demo</p> 
        </footer> 
      </article> 
      <aside> 
        <header> 
            <h1>Tangential Information</h1> 
        </header> 
        <section> 
            <p>Lorem ipsum text blah blah blah.</p> 
            <p>Lorem ipsum text blah blah blah.</p> 
            <p>Lorem ipsum text blah blah blah.</p> 
        </section> 
        <footer> 
            <p>Tags: HMTL, code, demo</p> 
        </footer> 
      </aside> 
  </section> 
</section>
Copy after login

As we can see, HTML5 allows us to use many more semantic structures Use code tags to replace a large number of meaningless

tags. This semantic feature not only improves the quality and semantics of our web pages, but also greatly reduces the class and id attributes that must be called for CSS in the code. In fact, CSS3 also allows us to ignore all classes and ids.

Say goodbye to class attributes and welcome neat tags 

Combined with HTML5 rich in new semantic tags, CSS3 provides web designers with magic for their web pages. General strength. With the power of HTML5, we will get more control over the document code. With the power of CSS3, our control will be infinite!

Even without those advanced CSS selectors, we can still call different containers through powerful HTML5 clauses without bothering with attributes such as class and id. Like the previous p layout, we may have to call it like this in css: p#news {}

The code is as follows:

p.section {} 
p.article {} 
p.header  {} 
p.content {} 
p.footer  {} 
p.aside  {}
Copy after login

Let’s take a look at an example based on HTML5: section {}

The code is as follows:

article {} 
header  {} 
footer  {} 
aside  {}
Copy after login


This is progress, but there are still some problems that need to be solved. In the

example, we need to call the element in the page through the class or id attribute. This logic will allow us to apply styles to any element in the document, whether as a whole or individually. For example, in the

example, the .section and .content elements are easy to locate. But in the HTML5 example, there will be many section elements in the actual document. Actually we could add some specific attribute selectors to call those different section elements, but thankfully I don't have a handful of advanced CSS selectors to target the different section elements now.

Locating HTML-5 elements without using class and id

Let’s take a look at how to locate an instance of HTML5 page elements without using class and id. We can use three A CSS selector to locate and identify elements within an instance. As follows:

Descendant selector: [CSS 2.1]: EF
Sibling selector: [CSS 2.1]: E + F
Child element selector: [CSS 2.1]: E > F

Let’s take a look at how to locate the section elements in the document without using class and id:

Locate the outermost

element

Considering that our example is not a complete set of HTML5 code, we assume that there is a

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)

Table Border in HTML Table Border in HTML Sep 04, 2024 pm 04:49 PM

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

Nested Table in HTML Nested Table in HTML Sep 04, 2024 pm 04:49 PM

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

HTML margin-left HTML margin-left Sep 04, 2024 pm 04:48 PM

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

HTML Table Layout HTML Table Layout Sep 04, 2024 pm 04:54 PM

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

HTML Input Placeholder HTML Input Placeholder Sep 04, 2024 pm 04:54 PM

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

HTML Ordered List HTML Ordered List Sep 04, 2024 pm 04:43 PM

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Moving Text in HTML Moving Text in HTML Sep 04, 2024 pm 04:45 PM

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

HTML onclick Button HTML onclick Button Sep 04, 2024 pm 04:49 PM

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

See all articles