HTML/CSS

HTML5 New Elements


HTML5 offers new elements for better document structure:

Tag Description
<article> Defines an article in the document
<aside> Defines content aside from the page content
<bdi> Defines a part of text that might be formatted in a different direction
from other text
<details> Defines additional details that the user can view or hide
<dialog> Defines a dialog box or window
<figcaption> Defines a caption for a <figure> element
<figure> Defines self-contained content, like illustrations, diagrams, photos, code
listings, etc.
<footer> Defines a footer for the document or a section
<header> Defines a header for the document or a section
<main> Defines the main content of a document
<mark> Defines marked or highlighted text
<menuitem> Defines a command/menu item that the user can invoke from a popup menu
<meter> Defines a scalar measurement within a known range (a gauge)
<nav> Defines navigation links in the document
<progress> Defines the progress of a task
<rp> Defines what to show in browsers that do not support ruby annotations
<rt> Defines an explanation/pronunciation of characters (for East Asian
typography)
<ruby> Defines a ruby annotation (for East Asian typography)
<section> Defines a section in the document
<summary> Defines a visible heading for a <details> element
<time> Defines a date/time
<wbr> Defines a possible line-break
Advertisements

Rounded Corners Using CSS3


With the CSS3 border-radius property, you can give any element “Rounded Corners“.

css3Here is the code:

<!DOCTYPE html>
<html>
<head>
<style> 
#rcorners1 {
    border-radius: 25px;
    background: #8AC007;
    padding: 20px; 
    width: 200px;
    height: 150px;    
}
#rcorners2 {
    border-radius: 25px;
    border: 2px solid #8AC007;
    padding: 20px; 
    width: 200px;
    height: 150px;    
}
#rcorners3 {
    border-radius: 25px;
    background: url(paper.gif);
    background-position: left top;
    background-repeat: repeat;
    padding: 20px; 
    width: 200px;
    height: 150px;    
}
</style>
</head>
<body>
The border-radius property allows you to add rounded corners to elements.
Rounded corners for an element with a specified background color:
Rounded corners!
Rounded corners for an element with a border:
Rounded corners!
Rounded corners for an element with a background image:
Rounded corners!
</body>
</html>

Check Live Demo Here : Rounded Corners Using CSS3

Puzzle Game using jQuery


puzzleIntroduction

This is a simple puzzle game developed using pure HTML and jQuery. This puzzle consist of an image which is divided into fifteen small parts or we can say it as segments. These parts are randomly arranged on the puzzle board. Your task is you have to rearrange that image segments in proper order. There is no limitations for moves or time you can take your own time to complete this puzzle.

Background

This puzzle game is mainly based on swapping of div’s on puzzle board, Puzzle board consist of total 16 small div’s, 15 are image div’s and one empty div. Div position is set on the puzzle board on random basis. When you click on any div adjacent to the empty div position of selected div and empty div gets changed.

Check Live Demo Here : jQuery Puzzle Game
(more…)

HTML5 − SVG Line


Following is the HTML5 version of an SVG example which would draw a line using <line> tag

<!DOCTYPE html>
<html>
   <head>

<style>
         #svgelem{
            position: relative;
            left: 50%;
            -webkit-transform: translateX(-50%);
            -ms-transform: translateX(-50%);
            transform: translateX(-50%);
         }
      </style>

      <title>SVG</title>
      <meta charset="utf-8" />
   </hea>
   <body>

<h2 align="center">HTML5 SVG Line</h2>

      <svg id="svgelem" height="200" xmlns="http://www.w3.org/2000/svg">
         <line x1="0" y1="0" x2="200" y2="100" style="stroke:red;stroke-width:2"/>
      </svg>
   </body>
</html>

You can use style attribute which allows you to set additional style information like stroke and fill colors, width of the stroke etc.

This would produce following result in HTML5 enabled latest version of Firefox.

svgline

HTML5 − SVG Rectangle


Following is the HTML5 version of an SVG example which would draw a rectangle using tag −

<!DOCTYPE html>
<html>
   <head>

<style>
         #svgelem{
            position: relative;
            left: 50%;
            -webkit-transform: translateX(-50%);
            -ms-transform: translateX(-50%);
            transform: translateX(-50%);
         }
      </style>

      <title>SVG</title>
      <meta charset="utf-8" />
   </head>
   <body>

<h2 align="center">HTML5 SVG Rectangle</h2>

      <svg id="svgelem" height="200" xmlns="http://www.w3.org/2000/svg">
         <rect id="redrect" width="300" height="100" fill="red" />
      </svg>
   </body>
</html>

This would produce following result in HTML5 enabled latest version of Firefox.

svgrectangle

HTML5 – SVG


SVG stands for Scalable Vector Graphics and it is a language for describing 2D-graphics and graphical applications in XML and the XML is then rendered by an SVG viewer.

SVG is mostly useful for vector type diagrams like Pie charts, Two-dimensional graphs in an X,Y coordinate system etc.

SVG became a W3C Recommendation 14. January 2003 and you can check latest version of SVG specification at SVG Specification

Viewing SVG Files

Most of the web browsers can display SVG just like they can display PNG, GIF, and JPG. Internet Explorer users may have to install the Adobe SVG Viewer to be able to view SVG in the browser.

Embeding SVG in HTML5

HTML5 allows embeding SVG directly using <svg>…</svg> tag which has following simple syntax −

<svg xmlns="http://www.w3.org/2000/svg">
   ...    
</svg>

Firefox 3.7 has also introduced a configuration option (“about:config”) where you can enable HTML5 using the following steps −

  • Type about:config in your Firefox address bar.
  • Click the “I’ll be careful, I promise!” button on the warning message that appears (and make sure you adhere to it!).
  • Type html5.enable into the filter bar at the top of the page.
  • Currently it would be disabled, so click it to toggle the value to true.

Now your Firefox HTML5 parser should now be enabled and you should be able to experiment with the following examples.

HTML5 − SVG Circle


Following is the HTML5 version of an SVG example which would draw a circle using <circle> tag

<!DOCTYPE html>
<html>
   <head>
      <style>
         #svgelem {
            position: relative;
            left: 50%;
            -webkit-transform: translateX(-20%);
            -ms-transform: translateX(-20%);
            transform: translateX(-20%);
         }
      </style>
      <title>SVG</title>
      <meta charset="utf-8" />
   </head>
   <body>
      <h2 align="center">HTML5 SVG Circle</h2>
      <svg id="svgelem" height="200" xmlns="http://www.w3.org/2000/svg">
         <circle id="redcircle" cx="50" cy="50" r="50" fill="red" />
      </svg>
   </body>
</html>

This would produce following result in HTML5 enabled latest version of Firefox.

It will produce the following result −svgcircle