Training page :]

Main page

Headings

This is heading 1

This is heading 2

This is heading 3

This is heading 4

This is heading 5
This is heading 6

Paragraphs

This is a paragraph.

This is another paragraph.


Links

This is my Tumblr link

Images

image

Line breaks

this is a paragraph
with a line break


Font sizes

this is a text with 60px size


Code vs display

This paragraph contains a lot of spaces and lines in the source code, but the browser ignores it.


Backgrounds

this paragraph has a
"powderblue" background and "grey" color font

this paragraph has a
"tomato" background

this paragraph has a
"rgba(10, 55, 73, 0.7)" background, "white" color font
and "courrier" font


Text alignment

this parahraph is centered

this parahraph is aligned left

this parahraph is aligned right


Font styles

This text is bold
This text is important!
This text is italic
This text is emphasized
This is some smaller text.
this word is marked.
this word is deleted
this word is underlined

this is a subscripted text

This is a superscripted text

Comments

in this code, there is a hidden comment


Borders

border time :D

hehehehe

theehee :3

bordered text with 30px padding and 50px margin


Link targets

The target attribute can have one of the following values:

_self - Default. Opens the document in the same window/tab as it was clicked
_blank - Opens the document in a new window or tab
_parent - Opens the document in the parent frame
_top - Opens the document in the full body of the window
This webbed site opens in a new page

Images as links

howl

this image hosts a link to lukas' tumblr page


*Email addresses

you can send an demail to someone@example.com by clicking here


A button!


alink

Jump in the page

jump to heading 6

Floating images

panda A paragraph with a floating image. A paragraph with a floating image. A paragraph with a floating image.

Float the image to the left:

panda A paragraph with a floating image. A paragraph with a floating image. A paragraph with a floating image.


Image mapping

click over different parts of the image to open different links

Puter display keyboard tower

Backgrounds

stuff about backgrounds


Tables

a simple table

Person 1 Person 2 Person 3
Emil Tobias Linus
16 14 10

Table width, height and headers

50% wide HTML Table

Firstname (this column 50% of the table's total space) Lastname (this is part of the header of the table) Age
Jill (this line is 200px) Smith 50
Eve Jackson 94
John Doe 80

Colspans

this is the table's caption
Name Age
Jill Smith 50
Eve Jackson 94

Spacing vs padding


Col groups formatting

Colgroup

Add the a colgroup with a col element that spans over two columns to define a style for the two columns:

MON TUE WED THU FRI SAT SUN
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28

Lists

An unordered HTML list


An ordered HTML list

  1. Coffee
  2. Tea
  3. Milk

A Description List

Coffee
- black hot drink
Milk
- white cold drink

Unordered List with Square Bullets

You may also use other types like : disc, circle, square or none.

A Nested List

Lists can be nested (list inside list):

type="1" The list items will be numbered with numbers (default)
type="A" The list items will be numbered with uppercase letters
type="a" The list items will be numbered with lowercase letters
type="I" The list items will be numbered with uppercase roman numbers
type="i" The list items will be numbered with lowercase roman numbers

The start attribute

By default, an ordered list will start counting from 1. Use the start attribute to start counting from a specified number:

  1. Coffee
  2. Tea
  3. Milk
  4. Sugar
  1. Coffee
  2. Tea
  3. Milk

Span to modify parts of the same paragraph

My mother has blue eyes and my father has brown eyes.


Html classes

click here to see more about classes

Html ids

click here to see more about ids

Scpecific text decoration

My favorite color is red.


Website windows with Iframes

Iframe - Target for a Link

another cool neocity

When the target attribute of a link matches the name of an iframe, the link will open in the iframe.


Beginner JavaScript stuff

A button to display the date & time

What day is it?

JavaScript can change the content of an HTML element:

will i change?

JavaScript can change the style of an HTML element.



JavaScript can change the source of an image.





Html head elements

click here to see more about head elements

  you can use the head element to:
  - define the title of the page
  - define a style
  - link a css stylesheet or a javascript file
  - use some meta tags to:
      * define the character set used:
      * define keywords for search engines:
      * define a description of your web page:
      * define the author of a page
      * refresh document every 30 seconds
      * setting the viewport to make your website look good on all devices
  - set the viewport (size of your pages depending onthe device)
  - define your java scripts
  - use the base tag to define the base target of your links

    

Responsive Text

Resize the browser window to see how the text size scales.

Use the "vw" unit when sizing the text. 5vw will set the size to 5% of the viewport width.

Viewport is the browser window size. 1vw = 1% of viewport width. If the viewport is 50cm wide, 1vw is 0.5cm.


Media queries

the page layout will change depending on the size of the browser

media-queries

Html semantics

Below is a list of some of the semantic elements in HTML.

Tag Description
<article> Defines independent, self-contained content
<aside> Defines content aside from the page content
<details> Defines additional details that the user can view or hide
<figcaption> Defines a caption for a <figure> element
<figure> Specifies self-contained content, like illustrations, diagrams, photos, code listings, etc.
<footer> Defines a footer for a document or section
<header> Specifies a header for a document or section
<main> Specifies the main content of a document
<mark> Defines marked/highlighted text
<nav> Defines navigation links
<section> Defines a section in a document
<summary> Defines a visible heading for a <details> element
<time> Defines a date/time

Special characters

Some Useful HTML Character Entities

Result Description Entity Name Entity Number
non-breaking space &nbsp; &#160;
< less than &lt; &#60;
> greater than &gt; &#62;
& ampersand &amp; &#38;
" double quotation mark &quot; &#34;
' single quotation mark (apostrophe) &apos; &#39;
¢ cent &cent; &#162;
£ pound &pound; &#163;
¥ yen &yen; &#165;
euro &euro; &#8364;
© copyright &copy; &#169;
® registered trademark &reg; &#174;

Html forms

The <form> Element

The HTML <form> element is used to create an HTML form for user input:

<form>
.
form elements
.
<form>

The <input> Element

The HTML<input>element is the most used form element.

An<input>element can be displayed in many ways, depending on the type attribute.

Here are some examples:

Type Description
<input type="text"> Displays a single-line text input field
<input type="radio"> Displays a radio button (for selecting one of many choices)
<input type="checkbox"> Displays a checkbox (for selecting zero or more of many choices)
<input type="submit"> Displays a submit button (for submitting the form)
<input type="button"> Displays a clickable button

Text Fields

The <input type="text"> defines a single-line input field for text input.

A form with input fields for text:

<form>
  <label for="fname">First name:</label><br>
  <input type="text" id="fname" name="fname" placeholder="eto"><br>
  <label for="lname">Last name:</label><br>
  <input type="text" id="lname" name="lname">
</form>

This is how the HTML code above will be displayed in a browser:

First name:

Last name:

Note: The form itself is not visible. Also note that the default width of an input field is 20 characters.

Radio Buttons

Radio buttons let a user select ONE of a limited number of choices.

Choose your favorite Web language:



Check boxes

Checkboxes let a user select ZERO or MORE options of a limited number of choices.

Which do you own?



Submit button

The name attribute

If the name attribute is omitted, the value of the input field will not be sent at all.


Form attributes

Form attributes

List of All <form> Attributes

Attribute Description
accept-charset Specifies the character encodings used for form submission
action Specifies where to send the form-data when a form is submitted
autocomplete Specifies whether a form should have autocomplete on or off
enctype Specifies how the form-data should be encoded when submitting it to the server (only for method="post")
method Specifies the HTTP method to use when sending form-data
name Specifies the name of the form
novalidate Specifies that the form should not be validated when submitted
rel Specifies the relationship between a linked resource and the current document
target Specifies where to display the response that is received after submitting the form

Form elements

Tag Description
<form> Defines an HTML form for user input
<input> Defines an input control
<textarea> Defines a multiline input control (text area)
<label> Defines a label for an <input> element The for attribute of the <label> tag should be equal to the id
attribute of the <input> element to bind them together.
<fieldset> Groups related elements in a form
<legend> Defines a caption for a <fieldset> element
<select> Defines a drop-down list
<optgroup> Defines a group of related options in a drop-down list
<option> Defines an option in a drop-down list
<button> Defines a clickable button
<datalist> Specifies a list of pre-defined options for input controls
<output> Defines the result of a calculation

The textarea Element



The fieldset and legend Elements

The <fieldset> element is used to group related data in a form.

The <legend> element defines a caption for the <fieldset> element.

Personalia:




First name and Last name are part of the same fieldset

Personalia is the legend

The datalist Element

The datalist element specifies a list of pre-defined options for an input element.

Note: The datalist tag is not supported in Safari prior version 12.1.


Form input types

Input Types

Input Restrictions

Here is a list of some common input restrictions:

Attribute Description
checked Specifies that an input field should be pre-selected when the page loads (for type="checkbox" or type="radio")
disabled Specifies that an input field should be disabled
max Specifies the maximum value for an input field
maxlength Specifies the maximum number of character for an input field
min Specifies the minimum value for an input field
pattern Specifies a regular expression to check the input value against
readonly Specifies that an input field is read only (cannot be changed)
required Specifies that an input field is required (must be filled out)
size Specifies the width (in characters) of an input field
step Specifies the legal number intervals for an input field
value Specifies the default value for an input field

The input list attribute

The list attribute refers to a datalist element that contains pre-defined options for an input element.

Form model

<form>
  
    <label for="label_id">[your label]</label>
    <input type="your_type (text, checkbox, password...)" id="label_id" name=label_id" [your restriction]>
    
  
  
        
    <label for="label_id">[your label]</label>
    <input type="your_type (text, checkbox, password...)" id="label_id" name=label_id" [your restriction]>
    
  
  
    
    <input list="list_type" name="list_type">
        <datalist id="list_type">
          <option value="option_1">
          <option value="option_2">
          <option value="option_3">
        </datalist>
       
  
        
          
              
    <fieldset name="identity">
      <legend>Your identity</legend>
      <label for="yourName">What is your name? </label>
      <input type="text" name="yourName" id="yourName" required>
      <label for="yourAge">How old are your</label>
      <input type="number" min="18" max="140">
    </fieldset>
      
  
Your identity
<input type="radio" id="html" name="fav_language" value="HTML"> <label for="html">HTML</label> <input type="radio" id="css" name="fav_language" value="CSS"> <label for="css">CSS</label> <input type="radio" id="javascript" name="fav_language" value="JavaScript"> <label for="javascript">JavaScript</label> <input type="submit"> </form>

Html multimedia

Supported formats

Video: Only MP4, WebM, and Ogg video formats are supported by the HTML standard.

Audio: Only MP3, WAV, and Ogg audio formats are supported by the HTML standard.

Videos

<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>

The controls attribute adds video controls, like play, pause, and volume.

To start a video automatically, use the autoplay attribute.

Add muted after autoplay to let your video start playing automatically but muted.

Audio

<audio controls>
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>

The controls attribute adds audio controls, like play, pause, and volume.

To start an audio automatically, use the autoplay attribute.

Add muted after autoplay to let your audio start playing automatically but muted.

Plug-Ins

Plug-ins are computer programs that extend the standard functionality of the browser.

The object element

The <object> element is supported by all browsers.

The <object> element defines an embedded object within an HTML document.

The embed element

The <embed> element is supported in all major browsers.

The <embed> element also defines an embedded object within an HTML document.

<object width="100%" height="500px" data="snippet.html"></object>
<object data="audi.jpeg"></object>
<embed width="100%" height="500px" src="snippet.html">

HTML Youtube videos

<iframe width="100%" height="315" src="https://www.youtube.com/embed/tgbNymZ7vqY"></iframe>

Add mute=1 after autoplay=1 to let your video start playing automatically (but muted).

<iframe width="420" height="315" src="https://www.youtube.com/embed/tgbNymZ7vqY?autoplay=1&mute=1"></iframe>

Add controls=0 to not display controls in the video player.