Why use HTML5+CSS3

Source: Internet
Author: User
Tags html5 boilerplate

A: Most browsers support, low version also no problem

I read this information, is to do the mobile phone application site (there are three scenarios, this is a backup plan), you can develop a responsive website, can be separated from the development platform for cross-platform.

The introduction of Modernizr in the HTML5 Web page will allow IE to support HTML5 new elements.

HTML5 template file Rapid development (html5boilerplate.com)

Two: The layout, the label saves time and effort

    1. <header>
    2. <!--semantics equivalent to <div class= "header" >-->
    3. <nav> Nav </nav>
    4. </Header>

This way, developers do not have to mark the end of the label, the location will be very convenient, but also easy for the search engine to judge.

<footer> define the tail of the page or section;

<nav> define the (main) navigation area of the page or section;

<section> the logical area or content combination of a page, such as one for "introduction" and another for "News list".

<article> define the body or a complete content, can be directly pasted into other places have independent meaning, such as "blog text."

<aside> definition of supplemental or related content, sidebar, banner, etc.

<a> tags can contain multiple labels

    1. <a href="index.html"><h2> </h2><img src="home.jpg"></a>

<vedio>, <audio> Quick Add video, audio

    1. <video src="Myvideo.ogg" Controls width="640" height= "480"> You are not prompted to use the HTML5-enabled browser </video>//controls to play the control bar; ogg and MP4 formats; responsive video: Normal conditions can be used max-width:100% Height:auto, if external <iframe> video, use Fitvids's jquery plugin


Three: Offline Web applications

Specify which files can be accessed offline through the. manifest file


Four: more flexible CSS3

01. You can display text in multiple columns

Column-width:12em; Tried a few browsers like a lot of invalid ~

02. A wide selection of selectors

Body[id= "2^"]{}//id a label beginning with "2"

Li:first-child, Li:last-child//For List of items

  1. Li:nth-child (2n+1)//First "1" Li element, each "2" color is red
  2. color:red;
  3. }
  4. <ul>
  5. <li>????? </li>
  6. <li>22222222</li>
  7. <li>33333333</li>
  8. </ul>

p::first-line{color:red;}//The first line of text is red

Five: Richer CSS3

Traditional CSS to achieve rounded corners, shadows and other effects, generally with the help of pictures to achieve, using CSS3 instead of pictures, can effectively reduce the HTTP request, get faster page loading speed. Different browsers may use different code for different CSS features, which can be handled using the preprocessor sass or less.

01.CSS3 easy to apply border rounded corners

  1. <html>
  2. <head>
  3. <style>
  4. A
  5. {
  6. background-color:red;
  7. border-top-left-radius:8px;/* fillet position and size */
  8. border-top-right-radius:8px;
  9. Padding:0.8em;
  10. }
  11. </style>
  12. </head>
  13. <body>
  14. <br />
  15. <a href="#"> Rounded corners </a>
  16. </body>
  17. </html>

02. You can use @font-face to embed Web page fonts, you can also use the scalable icon (not picture format, fico.lensco.be)

03. Use Transparent Channels

  1. <style>
  2. body{
  3. Background:url (01.jpg) no-repeat;
  4. }
  5. #wrapper {
  6. Background-color:hsla (100,100%,100%,0.7);/*HSL is a 360 degree hue ring */
  7. width:500px;
  8. height:500px;
  9. }
  10. </style>
  11. </head>
  12. <body>
  13. <div id="wrapper">
  14. Transparent area
  15. </div>
  16. </body>

04 Text Shadows

[HTML]View PlainCopy
    1. text-shadow:5px 5px 2px #333; (plus or minus) right, bottom, shadow degree, color

Emboss Effect:

[HTML]View PlainCopy
  1. <head>
  2. <style>
  3. #wrapper {
  4. height:500px;
  5. Background-color:activeborder;
  6. text-shadow:0px 1px 0px Hsla (0,0%,100%,0.75);
  7. font-size:30px;
  8. }
  9. </style>
  10. </head>
  11. <body>
  12. <div id="wrapper">
  13. Emboss effect
  14. </div>
  15. </body>

Similarly, you can use the box shadow Box-shadow to shadow a photo
05 Color Gradient

[HTML]View PlainCopy
    1. Background:linear-gradient (90deg,red 0%,blue 50%, #ffffff 100%);

You can control the linear gradient direction gradient position, etc., as well as radial (spherical) gradients
06 Writing 2D variants

More code parameters, the site http://www.useragentman.com/matrix/to make it

There is also a picture 3D effect, seemingly not used much. http://webdesignerwall.com/There's a lot of cool stuff about this, and I've also found an article in it that's translated: http://blog.csdn.net/wowkk/article/details/12572447

Finally, the advantages of the form, HTML5 can be without the help of jquery, the user's input behavior judgment (some browsers on the HTML5 form support is not very good, can be solved by webshims Lib).

  1. <head>
  2. <style>
  3. /* Pseudo Selector */
  4. . input:required/* If you do not fill in the required fields, the border becomes red */
  5. {
  6. border:1px solid #f00;
  7. }
  8. . input:focus:invalid/* If the data entered is invalid */
  9. {
  10. }
  11. . input:focus:invalid/* If the data entered is correct */
  12. {
  13. }
  14. </style>
  15. </head>
  16. <body>
  17. <form method="POST">
  18. <div>
  19. <label for="UserName"> enter your user name </label>
  20. <input id="userName" type= "text" placeholder="For example: Admin" Required aria-required="true" autofocus />
  21. <!--placeholder indicates prompt input
  22. Required aria-required="true" is required;
  23. Autofocus indicates that the cursor focus is automatically obtained
  24. The Pattern property can be filled with regular expressions to determine the user's input behavior
  25. -->
  26. <input type="search" value="similar to text, some browser performance is more powerful" />
  27. <!--In addition to Type=number and the like.
  28. <input type="Submit" value= "ok" />
  29. </div>
  30. </form>
  31. </body>


Add:

Use HTML5 boilerplate to write HTML5 website, it has organized folder structure and CSS files, add the current coding best practices, browser bug fixes and JS library.

Why use HTML5+CSS3

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.