noteforW3schoolsHtml

note for w3schools.com/html

The title Attribute

Here, a title attribute is added to the

element. The value of the title attribute will be displayed as a tooltip when you mouse over the paragraph:

<p title="I'm a tooltip">
This is a paragraph.
p>

HTML Horizontal Rules

The


tag defines a thematic break in an HTML page, and is most often displayed as a horizontal rule.
The
element is used to separate content (or define a change) in an HTML page:

<h1>This is heading 1h1>
<p>This is some text.p>
<hr>
<h2>This is heading 2h2>
<p>This is some other text.p>
<hr>

HTML for Short Quotations

The HTML element defines a short quotation.

Browsers usually insert quotation marks around the element.

<p>WWF's goal is to: <q>Build a future where people live in harmony with nature.q>p>

HTML
for Quotations

The HTML

element defines a section that is quoted from another source.

Browsers usually indent

elements.

<p>Here is a quote from WWF's website:p>
<blockquote cite="http://www.worldwildlife.org/who/index.html">
For 50 years, WWF has been protecting the future of nature.
The world's leading conservation organization,
WWF works in 100 countries and is supported by
1.2 million members in the United States and
close to 5 million globally.
blockquote>

it seems useless, but developers can format their own css for quoteblock

HTML For Keyboard Input

The HTML element defines keyboard input:

Example
<kbd>File | Open...kbd>
Result:

File | Open...

// do not understand clearly
format for keyboard input when developers write code articles.

HTML For Computer Output

The HTML element defines sample output from a computer program:

Example
<samp>
demo.example.com login: Apr 12 09:10:17
Linux 2.6.10-grsec+gg3+e+fhs6b+nfs+gr0501+++p3+c4a+gr2b-reslog-v6.189
samp>
Result:

demo.example.com login: Apr 12 09:10:17 Linux 2.6.10-grsec+gg3+e+fhs6b+nfs+gr0501+++p3+c4a+gr2b-reslog-v6.189

about tag

Notice that the element does not preserve extra whitespace and line-breaks.

To fix this, you can put the element inside a

 element:

Example
<pre>
<code>
var x = 5;
var y = 6;
document.getElementById("demo").innerHTML = x + y;
code>
pre>
Result:

 var x = 5;
var y = 6;
document.getElementById("demo").innerHTML = x + y;

HTML For Variables

The HTML element defines a variable.

The variable could be a variable in a mathematical expression or a variable in programming context:

Example
Einstein wrote: <var>Evar> = <var>mvar><var>cvar><sup>2sup>.
Result:

Einstein wrote: E = mc2.

a kind of complex

Conditional Comments

You might stumble upon conditional comments in HTML:

Conditional comments defines some HTML tags to be executed by Internet Explorer only.

HTML rel Attribute

The rel attribute specifies the relationship between the current document and the linked document.

Only used if the href attribute is present.

Attribute Values

Value Description
alternate Links to an alternate version of the document (i.e. print page, translated or mirror)
author Links to the author of the document
bookmark Permanent URL used for bookmarking
help Links to a help document
license Links to copyright information for the document
next The next document in a selection
nofollow Links to an unendorsed document, like a paid link.
(“nofollow” is used by Google, to specify that the Google search spider should not follow that link)
noreferrer Specifies that the browser should not send a HTTP referer header if the user follows the hyperlink
prefetch Specifies that the target document should be cached
prev The previous document in a selection
search Links to a search tool for the document
tag A tag (keyword) for the current document

note about

<a href="http://www.w3schools.com/html/">Visit our HTML tutoriala>

Note: Without a forward slash on subfolder addresses, you might generate two requests to the server. Many servers will automatically add a forward slash to the address, and then create a new request.

The four links states are:

a:link - a normal, unvisited link
a:visited - a link the user has visited
a:hover - a link when the user mouses over it
a:active - a link the moment it is clicked

HTML Links - The target Attribute

The target attribute specifies where to open the linked document.

The target attribute can have one of the following values:

_blank - Opens the linked document in a new window or tab
_self - Opens the linked document in the same window/tab as it was clicked (this is default)
_parent - Opens the linked document in the parent frame
_top - Opens the linked document in the full body of the window
framename - Opens the linked document in a named frame

HTML Links - Create a Bookmark

Example

First, create a bookmark with the id attribute:

<h2 id="tips">Useful Tips Sectionh2>

Then, add a link to the bookmark (“Useful Tips Section”), from within the same page:

<a href="#tips">Visit the Useful Tips Sectiona>

Or, add a link to the bookmark (“Useful Tips Section”), from another page:

<a href="html_tips.html#tips">Visit the Useful Tips Sectiona>

HTML Screen Readers

A screen reader is a software program that reads the HTML code, converts the text, and allows the user to “listen” to the content. Screen readers are useful for people who are blind, visually impaired, or learning disabled.

HTML Images

Note: Always specify the width and height of an image. If width and height are not specified, the page will flicker while the image loads.

Width and Height, or Style?

Both the width, height, and style attributes are valid in HTML5.

However, we suggest using the style attribute. It prevents internal or external styles sheets from changing the original size of images:

Example


<html>
<head>
<style>
img { 
    width:100%; 
}
style>
head>
<body>

<img src="html5.gif" alt="HTML5 Icon" style="width:128px;height:128px;">
<img src="html5.gif" alt="HTML5 Icon" width="128" height="128">

body>
html>

To use an image as a link, simply nest the tag inside the tag:

Example

<a href="default.asp">
  <img src="smiley.gif" alt="HTML tutorial" style="width:42px;height:42px;border:0;">
a>

Note: border:0; is added to prevent IE9 (and earlier) from displaying a border around the image (when the image is a link).

Image Maps

Use the tag to define an image-map. An image-map is an image with clickable areas.

The name attribute of the tag is associated with the ’s usemap attribute and creates a relationship between the image and the map.

The tag contains a number of tags, that defines the clickable areas in the image-map:

Example

<img src="planets.gif" alt="Planets" usemap="#planetmap" style="width:145px;height:126px;">

<map name="planetmap">
  <area shape="rect" coords="0,0,82,126" alt="Sun" href="sun.htm">
  <area shape="circle" coords="90,58,3" alt="Mercury" href="mercur.htm">
  <area shape="circle" coords="124,58,8" alt="Venus" href="venus.htm">
map>

HTML Table

  • still some skill to beauty table, like ,,,,,, mark it for apply

HTML Lists

Horizontal Lists

HTML lists can be styled in many different ways with CSS.

One popular way is to style a list horizontally, to create a menu:

Example


<html>
<head>
<style>
ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #333333;
}
-- amazing apply -->
li {
    float: left;
}

li a {
    display: block;
    color: white;
    text-align: center;
    padding: 16px;
    text-decoration: none;
}

li a:hover {
    background-color: #111111;
}
style>
head>
<body>

<ul>
  <li><a class="active" href="#home">Homea>li>
  <li><a href="#news">Newsa>li>
  <li><a href="#contact">Contacta>li>
  <li><a href="#about">Abouta>li>
ul>

body>
html>

CSS Display

Definition and Usage
The display property specifies the type of box used for an HTML element.

CSS

img {
    float: left;
}

img#test1{ 
float: right;
}

img #test1{ 
float: right;
}

HTML Blocks

The
Element (block-level)

The

element is often used as a container for other HTML elements.

The

element has no required attributes, but both style and class are common.

When used together with CSS, the

element can be used to style blocks of content:

Example

<div style="background-color:black;color:white;padding:20px;">
  <h2>Londonh2>
  <p>London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants.p>
div>

The Element (inline-level)

The element is often used as a container for some text.

The element has no required attributes, but both style and class are common.

When used together with CSS, the element can be used to style parts of the text:

Example

<h1>My <span style="color:red">Importantspan> Headingh1>

Iframe - Target for a Link

An iframe can be used as the target frame for a link.

The target attribute of the link must refer to the name attribute of the iframe:

Example

<iframe src="demo_iframe.htm" name="iframe_a">iframe>

<p><a href="http://www.w3schools.com" target="iframe_a">W3Schools.coma>p>

note:this is the tech we need for SRTP

HTML JavaScript

A Taste of JavaScript



<html>
<body>
<script>
function light(sw) {
    var pic;
    if (sw == 0) {
        pic = "pic_bulboff.gif"
    } else {
        pic = "pic_bulbon.gif"
    }
    document.getElementById('myImage').src = pic;
}
script>

<img id="myImage" src="pic_bulboff.gif" width="100" height="180">

<p>
<button type="button" onclick="light(1)">Light Onbutton>
<button type="button" onclick="light(0)">Light Offbutton>
p>

body>
html>

The HTML Tag

The tag is used to provide an alternate content for users that have disabled scripts in their browser or have a browser that doesn’t support client-side scripts:

Example

<script>
document.getElementById("demo").innerHTML = "Hello JavaScript!";
script>

<noscript>Sorry, your browser does not support JavaScript!noscript>

HTML Head


<html>

<head>
    
    <title>testPagetitle>
    

    
  <meta charset="UTF-8">
  <meta name="description" content="Free Web tutorials">
  <meta name="keywords" content="HTML,CSS,XML,JavaScript">
  <meta name="author" content="Hege Refsnes">

    
  <base href="http://www.w3schools.com/images/" target="_blank">

  
  <style>
    body {background-color: powderblue;}
    h1 {color: red;}
    p {color: blue;}
  style>

  
  <script>
    function myFunction {
        document.getElementById("demo").innerHTML = "Hello JavaScript!";
    }
  script>

  
  <link rel="stylesheet" href="myStyle.css">
head>

<body>
<p>All meta information goes before the body.p>
body>

html>

The HTML Element

The element specifies the base URL and base target for all relative URLs in a page:

Example

<base href="http://www.w3schools.com/images/" target="_blank">

do not understand clearly

CSS Float

The clearfix Hack - overflow: auto;

If an element is taller than the element containing it, and it is floated, it will overflow outside of its container.

Then we can add overflow: auto; to the containing element to fix this problem:

Example

.clearfix {
    overflow: auto;
}

note:overflow:auto; will make sure containing element big than it’s content. when width and height is fixed, container will use scroll bar.

CSS3 Flexbox Concepts

Flexbox consists of flex containers and flex items.

A flex container is declared by setting the display property of an element to either flex (rendered as a block) or inline-flex (rendered as inline).

Inside a flex container there is one or more flex items.

Note: Everything outside a flex container and inside a flex item is rendered as usual. Flexbox defines how flex items are laid out inside a flex container.

Flex items are positioned inside a flex container along a flex line. By default there is only one flex line per flex container.

The following example shows three flex items. They are positioned by default: along the horizontal flex line, from left to right:

Example


<html>
<head>
<style> 
.flex-container {
    display: -webkit-flex;
    display: flex;
    width: 400px;
    height: 250px;
    background-color: lightgrey;
}

.flex-item {
    background-color: cornflowerblue;
    width: 100px;
    height: 100px;
    margin: 10px;
}
style>
head>
<body>

<div class="flex-container">
  <div class="flex-item">flex item 1div>
  <div class="flex-item">flex item 2div>
  <div class="flex-item">flex item 3div> 
div>

body>
html>

w3.css(a setted css file)

The Complete HTML5Shiv Solution

The link to the HTML5Shiv must be placed in the element, after any stylesheets:

Example


<html>
<head>
  
head>
<body>

<section>

<h1>Famous Citiesh1>

<article>
<h2>Londonh2>
<p>London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.p>
article>

<article>
<h2>Parish2>
<p>Paris is the capital and most populous city of France.p>
article>

<article>
<h2>Tokyoh2>
<p>Tokyo is the capital of Japan, the center of the Greater Tokyo Area,
and the most populous metropolitan area in the world.p>
article>

section>

body>
html>

HTML5 Semantics

Why Semantic HTML5 Elements?

With HTML4, developers used their own favorite attribute names to style page elements:

header, top, bottom, footer, menu, navigation, main, container, content, article, sidebar, topnav, …

This made it impossible for search engines to identify the correct web page content.

With HTML5 elements like:

According to the W3C, a Semantic Web:

“Allows data to be shared and reused across applications, enterprises, and communities.”

soga

The Difference Between
and

There is a confusing (lack of) difference in the HTML5 standard, between

and
.

In the HTML5 standard, the

element is defined as a block of related elements.

The

element is defined as a complete, self-contained block of related elements.

The

element is defined as a block of children elements.

How to interpret that?

In the example above, we have used

as a container for related .

But, we could have used

as a container for articles as well.

do not notice the differences

HTML5 Style Guide

this chapter tell us how to code neatly

The element is the document root. It is the recommended place for specifying the page language:


<html lang="en-US">

To ensure proper interpretation, and correct search engine indexing, both the language and the character encoding should be defined as early as possible in a document:


<html lang="en-US">
<head>
  <meta charset="UTF-8">
  <title>HTML5 Syntax and Coding Styletitle>
head>

a myStandard of Html constraction

<header class="fixed">head>
<nav class="horizontalNav fixed">nav>
<aside class="fixed">aside>
<main>
    <section>
        article or others div
    section>
    <section>
        article or others div
    section>
    <section>
        article or others div
    section>

main>
<footer>footer>

end of note

你可能感兴趣的:(note,backup)