Hiển thị các bài đăng có nhãn HTML5. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn HTML5. Hiển thị tất cả bài đăng

Thứ Ba, 18 tháng 6, 2013

Learn how to create a simple Html5 website

http://xdesigns.net/2013/06/how-to-create-website-html5/
This tutorial will show you how to Learn how to create a simple Html5 website using Html5 & CSS code from the scratch.
 Learn how to create a simple Html5 website
Check out the demo and download here!
HTML5 is a W3C specification that defines the fifth major revision of the Hypertext Markup Language (HTML). One of the major changes in HTML5 is in respect to how HTML addresses Web applications. Other new features in HTML5 include specific functions for embedding graphics, audio, video, and interactive documents. It’s completely open and controlled by a standards committee, of which Apple is a member. HTML5 introduces a number of new attributes, input types, new features, easy option and other elements for your markup toolkit.
Step 1 : This is the simple design layout that we are going to build using HTML5. 
HTML5 Tutorial
Step 2 : First create the below files and folder
index.html (File)  - Here we will build the basic html5 website.
style.css (File)   - Where to define styles against any HTML element.
images (Folder)  - Used to store images used in the basic html5 website.
Step 3 : Always ensure to start the Html5 website with <!doctype html> before any other HTML code, so that the browser knows what type of document to expect.
The doctype for HTML5 is very simple than the previous versions of HTML. The <!DOCTYPE> tag does not have an end tag.
Step 4 : Hence the skeleton structure of a simple basic Html5 website is
<!doctype html>
<html>
  <head>
  </head>
  <body>
  </body>
</html>
Step 5 : Html5 uses the new sectional and structural semantic elements such as
*  <header></header> (i.e, instead of <div id =”header”></div>) - Specifies a header for a document or section.
*  <nav></nav> (i.e, instead of <div id =”menu”></div>) - Represents a section of a page that links to other pages or to parts within the page: a section with navigation links.
*  <article></article> - Used to represent an article that is independent/self-contained content on the site.
*  <section></section> – Represents a generic section of a document. And also a thematic grouping of content, typically with a heading. It can be nested inside sections, articles, or asides.
*  <aside></aside> - Represents a section of a page containing not the main content of the page but some content which is indirectly related to the main content.
*  <hgroup> (i.e, <h1> to <h6>) - Represents the heading of a section, which consists of all the <h1> to <h6> element children of the hgroup element. The element indicate subheadings or subtitles.
*  <div id=”footer”></div> - The ending elements.
*  <a href> - The ‘link tag’ or the ‘hyperlink tag’. This makes text ‘hyper’ so that when we click on it we can load another page or activate/call some JavaScript.
Step 6 : The image below is the outline of the parts of our HTML webpage.
HTML5 Tutorial
Now define the basic skeleton structure of the HTML webpage using the new structural elements specified in Step 5. Here is a simple example of some code that uses these elements.
<!doctype html>
<html>
         <head>                  
         </head> 
         <body> 
         </body>
</html>
The <body> tag includes all the main page’s structure.
<!doctype html>
<html>
         <head>                   
         </head> 
         <body>
                  <header></header>
                  <h1></h1>
                  <nav></nav> 
                                    <article>
                                    <section></section>
                                    <section></section>
                                    <section></section>
                                    </article>
                  <aside></aside> 
                  <div id=”footer” ></div>              
         </body>
</html>
Step 7 : Have a rough structure of all the element in the html layout, so that it will be easy to code the css. We need to start with the basic page structure. In this case we will use some dummy content to create the two column website.
Step 8 : We can wrap all the tags inside the divisions of the <body> tag using the “wrapper” tag for centering the content in the browser.
<!doctype html>
<html>
         <head>
           <meta charset=”UTF-8″> – Used to declare the charset         
         </head>
         <body>
                  <div id=”wrapper” >  – The wrapper tag includes the closing ‘content’ div tag
                  <header><h1></h1></header>                  
                  <nav>
                  <a href=”#”>Home</a>
                  <a href=”#”>About Us</a>
                  <a href=”#”>Services</a>
                  <a href=”#”>Contact</a>
                  </nav>
                                    <article>
                                    <section id=”article1″><h2></h2></section>
                                    <section id=”article2″></section>
                                    <section id=”article3″></section>
                                    </article>
                  <aside></aside> 
                  <div id=”footer” ></div>  – The footer tag includes the closing ‘content’ div tag
                  </div>            
         </body>
</html>
Step 9 : Let’s first start styling for the page element wrapper, header and navigation in the division. Then for the main content section with a featured article with sections, a sidebar and finally a footer.
Step 10 : CSS rules are coded and stored in an external file, named “style.css” separately. And also linked to the style inside the head tag to reuse the CSS code on many pages.
<link href=”style.css” rel=”stylesheet” type=”text/css” />
Step 11 : The wrapper is holding the page togather. Hence we can wrap and restrict the overall page width to 900px and center of the browser. It’s a division so we have to use the symbol “#” before the code in the CSS style sheet.
In addition, always remember “margins” will include the spacing outside the box and “paddings” will include the spacing inside the box.
Note : margin:10px 7px 0 auto; – Here the first value is for the Top portion of the box(i.e, 10px), second value is for Right portion of the box(i.e, 7px), third value is for the Bottom portion of the box(i.e, 0px) and the fourth value is for the Left portion of the box(i.e, auto),
#wrapper{
background-color:#333;
float:inherit;
width:900px;
position:relative;          - To define the position for some browsers
margin:0 auto 0 auto;   - margin-right/left is set to auto meaning the content will always be centered inside the browser. 
}
Step 12 : Next, we set the height of the header area to 100px and width to 875px.The actual width of the header is 900px, but here we have given spacing to the box through padding and adjusted those space in the width. All the content & images will be aligned left with float:left.
header{
float:left;
width:875px;
height:100px;
background-color:#333;                          –  Represents the background color
font-family:Arial, Helvetica, sans-serif;       -  Represents the font type
font-style:normal;
font-size:30px;                                      –  Represents the font size
padding:50px 0 5px 25px;
color:#FC0;                                          –  Represents the text color
}
Step 13 : Now we have to style the rest of the elements similar to “Step 12″ but the structure of the tags is set up differently with some position and arrangement changes. The css code which we have used for our website page is below
nav

float:left;
width:875px;
height:30px;
background-color:#FC0;
font-family:Tahoma, Geneva, sans-serif;
font-weight: bold;
font-size:12px;
color:#333;
padding:17px 0 3px 25px;
}
article{
float:left;
width:650px;
background-color:#333;
font-family:Arial, Helvetica, sans-serif;
font-style:normal;
font-size:12px;
line-height:21px;
color:#CCC;
padding:25px 25px 5px 25px;
}
aside{
float:left;
width:170px;
background-color:#666;
font-family:Arial, Helvetica, sans-serif;
font-style:normal;
font-size:12px;
color:#CCC;
padding:25px 15px 10px 15px;
line-height:16px;  -  To increase readability of the content, you can increase the overall line-height of text to 16px.
}
#footer
{
clear:both;
width:875px;
height:30px;
background-color:#FC0;
font-family:Arial, Helvetica, sans-serif;
font-weight:normal;
font-size:12px;
color:#333;
padding:20px 0 0 25px;
}
The “clear:both” tag make sure that the footer actually is displayed below the main article; it explictly tells the browser that no floating elements are allowed on both sides of the footer.
Step 14 : The hgroup tag is specified with the font type “Arial” and line height of 21px. To increase readability, you can increase the overall line-height of text to 21px.
h1,h2,h3{
font-family:Arial, Helvetica, sans-serif;
line-height:21px;
}
Step 15 : The ‘link tag’ or the ‘hyperlink tag’ on rollover it should change the color or font size, etc. Here I am going to change the color of the navigation/hyperlink text in rollover and define the text-decoration with underline. The code can be seen below
nav a{
color:#000;
text-decoration:none; 
}
nav a:hover{
color:#919191;
text-decoration:underline;
}
a{
color:#FC0;
text-decoration:none;
}
a:hover{
text-decoration:underline;
}
Step 16 : We can add class and ID attributes to the tags. So, if you wanted to style a section separately, then simply add a class or ID to the tag and you can apply the style for that. I have defined a class for the images(i.e, <div class=”t_images”>) which is to represent the images in 3 rows and 2 columns. I have coded the css as below
.t_images
{
float: left;
width: 155px;
border: 1px solid #999;  -  Add a thin border with the color #999 to the div.
margin: 0 15px 25px 15px;
padding: 5px;              -  The border of the image is added with 5px padding and to move it away from the images.
}
Step 17 : That’s it! so here’s what we have created the html5 page looks like now.
HTML5 Tutorial
Step 18 : Check out the demo and download here!

Thứ Tư, 22 tháng 8, 2012

Coding an Attractive Portfolio Web Design using HTML5 and CSS3


Live Preview
Free Photoshop Template
Live Preview

Head Area Code

Notice the code carefully in this tutorial because we are using a little jQuery. Rest of the stuff is pretty obvious.
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Portfolio | Designzzz</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="style.css" type="text/css" />
<script language="javascript" type="text/javascript" src="js/jquery.js"></script> <script language="javascript" type="text/javascript" src="js/jquery.easing.js"></script> <script language="javascript" type="text/javascript" src="js/script.js"></script> <script type="text/javascript">    $(document).ready( function(){     var buttons = { previous:$('#jslidernews2 .button-previous') ,    next:$('#jslidernews2 .button-next') };     $('#jslidernews2').lofJSidernews( { interval:5000,    easing:'easeInOutQuad',    duration:1200,    auto:true,    mainWidth:684,    mainHeight:300,    navigatorHeight  : 100,    navigatorWidth  : 310,    maxItemDisplay:3,    buttons:buttons } );     }); </script>  </head>

Body and Main Container

We are covering “Main Container” in the next steps.
<html>
 <body>
       <div id="main-container"> <!--all the codes carrying body content -->
       </div>
 </body>
</html>

CSS of this Area

@charset "utf-8";
 /* CSS Document */
*{
   margin:0;
   padding:0;
   }
body
   {
   background:#efeeee;
   font-family:Arial, Helvetica, sans-serif;
   }

   article, aside, figure, footer, header, hgroup, menu, nav, section { display:block; }

   #main-container
   {
   width:1000px;
   margin:0 auto;
   }

<Header> Area HTML

Check the CSS code carefully in this step.
Free Design of Photoshop Template
<header>
<div id="logo">
<p>LOGO</p>
<p class="sub-logo">PORTFOLIO LAYOUT</p>
</div>
<div id="icons">
<div class="sub-icons">
<img src="images/rss.png" alt="" />
</div>
<div class="sub-icons">
<img src="images/twitter.png" alt="" />
</div>
<div class="sub-icons">
<img src="images/fb.png" alt="" />
</div>
</div>
<nav>
<ul>
<li><a href="#">HOME</a></li>
<li><a href="#">ABOUT</a></li>
<li><a href="#">PORTFOLIO</a></li>
<li><a href="#">GALLERY</a></li>
<li><a href="#">CONTACT</a></li>
</ul>
</nav>
</header>

CSS of this Area

header
 {
 width:960px;
 height:175px;
 margin:0 auto;
 }
 #logo
 {
 width:222px;
 float:left;
 overflow:hidden;
 font-size:60px;
 color:#797777;
 margin:7px 2px;
 float:left;
 }
 .sub-logo
 {
 font-size:20px;
 color:#797777;
 }
 #icons
 {
 height:70px;
 width:195px;
 float:right;
 }
 .sub-icons
 {
 width:60px;
 overflow:hidden;
 float:left;
 }
 nav
 {
 background:url(images/feature-bg.png) repeat-x;
 height:55px;
 width:952px;
 float:left; 

 }
 nav ul
 {
 margin:0;
 padding:0;
 }
 nav ul li
 {

 width:122px;
 height:24px;
 color:#ffffff;
 list-style:none;
 float:left;
 margin:0px 18px;
 padding:14px 15px;
 font-size:21px;
 }
 nav ul li a
 {
 color:#fff;
 text-decoration:none;

 }
 a
 {
 color:#fff;
 }
 nav ul li a:hover
 {
 background:#fff;
 color:#000;
 }

<Feature> Area HTML

Now comes the jQuery part. If you are a newbie, you are destined to fumble here… don’t care about it, keep trying and you will overcome the obstacle.
Easy Tutorial of Web Layout
<div id="feature">
<div id="jslidernews2" class="lof-slidecontent" style="width:945px; height:300px;">
<div class="preload"><div></div></div>
<!-- MAIN CONTENT -->
<div class="main-slider-content" style="width:684px; height:313px; background:#000;">
<ul class="sliders-wrap-inner">
<li>
<img src="images/feature-1.jpg" alt="" >
<div class="slider-description">
<h4>Some Dummy Text</h4>
<p>Some text</p>
</p>
</div>
</li>
<li>
<img src="images/feature-2.jpg" alt="" >
<div class="slider-description">
<h4>Some Dummy Text</h4>
<p>Some text</p>
</div>
</li>
<li>
<img src="images/feature-3.jpg" alt="" >
<div class="slider-description">
<h4>Some Dummy Text</h4>
<p>Some text</p>
</div>
</li>
<li>
<img src="images/feature-4.jpg" alt="" >
<div class="slider-description">
<h4>Some Dummy Text</h4>
<p>Some text</p>
</div>
</li>
</ul>
</div>
<!-- END MAIN CONTENT -->
<!-- NAVIGATOR -->
<div class="navigator-content">
<div>
<ul class="navigator-wrap-inner">
<li>
<div>
<h3> Some Text Here</h3>
<span>Some text Here</span>
</div>
</li>
<li>
<div>
<h3> Some Text Here</h3>
<span>Some text Here</span>
</div>
</li>
<li>
<div>
<h3> Some Text Here</h3>
<span>Some text Here</span>
</div>
</li>
<li>
<div>
<h3> Some Text Here</h3>
<span>Some text Here</span>
</div>
</li>
</ul>
</div>
</div>          <!----------------- END OF NAVIGATOR --------------------->
</div>
</div>

CSS of this Area

#feature
 {
 width:945px;
 height:320px;
 margin:0 auto;
 }
.lof-slidecontent
   {
   position:relative;
   overflow:hidden;
   border:#F4F4F4 solid 1px;
   }
   .lof-slidecontent .preload
   {
   height:100%;
   width:100%;
   position:absolute;
   top:0;
   left:0;
   z-index:100000;
   text-align:center;
   background:#FFF
   }
   .lof-slidecontent  .sliders-wrapper
   {
   position:relative;
   height:100%;
   width:900px;
   z-index:3px;
   overflow:hidden;
   }
   .lof-slidecontent  ul.sliders-wrap-inner
   {
   overflow:hidden;
   background:transparent;
   padding:0px;
   margin:0;
   position:absolute;
   overflow:hidden;
   }
   .lof-slidecontent  ul.sliders-wrap-inner li
   {
   overflow:hidden;
   padding:0px;
   margin:0px;
   float:left;
   position:relative;
   }
   .lof-slidecontent  .lof-opacity  li
   {
   position:absolute;
   top:0;
   left:0;
   float:inherit;
   }

.lof-slidecontent  .navigator-content
   {
   position:absolute;
   right:0;
   top:00px;
   z-index:9;
   height:300px;
   width:310px;
   overflow:hidden;
   color:#FFF
   }
   .lof-slidecontent  .navigator-wrapper
   {
   position:relative;
   z-index:10;
   height:180px;
   width:310px;
   overflow:hidden;
   color:#FFF;
   float:left
   }
   .lof-slidecontent  ul.navigator-wrap-inner
   {
   top:0;
   padding:0;
   margin:0;
   position:absolute;
   width:100%;
   }
   .lof-slidecontent  ul.navigator-wrap-inner li
   {
   cursor:hand;
   cursor:pointer;
   list-style:none;
   padding:0;
   margin-left:0px;
   overflow:hidden;
   float:left;
   display:block;
   text-align:center;
   }
.lof-slidecontent .slider-description
   {
   z-index:100px;
   position:absolute;
   bottom:18px;
   left:0px;
   width:630px;
   background:url(images/slider.png);
   height:43px;
   padding:10px;
   color:#FFF;
   }
   .lof-slidecontent .slider-description h4
   {
   font-size: 14px;
   margin: 2px 0;
   padding: 0;
   }

/* item navigator */
   .lof-slidecontent ul.navigator-wrap-inner  li.active
   {
   background:url(images/feature-bg.png);
   color:#FFF
   }
   .lof-slidecontent ul.navigator-wrap-inner  li >  div
   {
   background:url(images/feature-bg.png);
   color:#FFF;
   height:100%;
   position:relative;
   margin-left:3px;
   Padding:10px 15px;
   text-align:left
   }
.dummy1
   {
   color: #FFFFFF;
   font-size: 18px;
   height: 23px;
   line-height: 32px;
   padding: 12px 0;
   text-align: center;
   width: 200px;
   }
   .dummy
   {
   color: #FFFFFF;
   font-size: 13px;
   height: 13px;
   line-height: 10px;
   text-align: center;
   width: 167px;
   margin-bottom:5px;
   }

“Hire Me” Area HTML

This is just a banner. You can place an offer or some latest news or anything.
HTML5-CSS3
<div id="hire">
<div class="data">
<input id="search" type="text" name="s" value="GOT SOMETHING? HIRE ME!" />
</div>
<div class="text">
<p>Hire me Dummy Text! Hire me Dummy Text! Hire me Dummy Hire me Dummy Text! Hire me
 Dummy Text! Hire me DummyHire me Dummy Text! Hire me Dummy Text! Hire me Dummy </p>
</div>
</div>

CSS of this Area

#hire
 {
 background:url(images/hire-bg.png) repeat-x;
 width:928px;
 height:74px;
 margin:0 auto 22px;
 border-radius:10px;
 padding-left:13px;
 }
 .data
 {
 width:225px;
 height:74px;
 float:left;
 }
 #search
 {
 background: none repeat scroll 0 0 #FFFFFF;
 border-radius: 5px 5px 5px 5px;
 color: #000000;
 font-family: Arial,Helvetica,sans-serif;
 height: 44px;
 margin-top: 15px;
 padding-left: 5px;
 width: 202px;
 border:none;
 text-shadow: 0 1px 2px #000000;
 font-size:15px;
 float:left;
 }
 .text
 {
 width:690px;
 height:44px;
 padding:15px 6px;
 float:left;
 }
 .text p
 {
 font-size:16px;
 color:#c4c4c4;
 }

Gallery Area HTML

We could have placed a jQuery here as well, but I decided to keep simple.
Free Tutorial of Porfolio Layout
<div id="gallery">
<div class="project">
<p> TOP PROJECTS </p>
</div>
<div class="images">
<div class="thumb">
<div class="pic">
<img src="images/img-1.png" alt="" />
</div>
<div class="pic">
<img src="images/img-2.png" alt="" />
</div>
<div class="pic">
<img src="images/img-3.png" alt="" />
</div>
<div class="pic">
<img src="images/img-4.png" alt="" />
</div>
</div>
<div class="thumb">
<div class="pic">
<img src="images/img-4.png" alt="" />
</div>
<div class="pic">
<img src="images/img-3.png" alt="" />
</div>
<div class="pic">
<img src="images/img-2.png" alt="" />
</div>
<div class="pic">
<img src="images/img-1.png" alt="" />
</div>
</div>
</div>
<div class="testimonial">
<p> TESTIMONIALS </p>
<div class="comma">
</div>
<div class="tes-text">
<p>Hire me Dummy Text! Hire me Dummy Text! Hire me Dummy Hire me Dummy Text! Hire me
 Dummy Text! Hire me DummyHire me Dummy Text! Hire me Dummy Text! Hire me Dummy </p>
</div>
<div class="name">
<p>By: Dummy Name</p>
</div>
<div class="comma1">
</div>
</div>
</div>

CSS of this Area

#gallery
 {
 background:#FFF;
 width:945px;
 height:685px;
 border:2px solid #c4c4c4;
 border-radius:13px;
 margin:0 auto;
 margin-bottom:20px;
 }
 .project
 {
 width:945px;
 height:70px;
 }
 .project p
 {
 font-size:27px;
 color:#000;
 margin:25px 45px;
 }
 .images
 {

 height: 400px;
 padding: 20px 24px;
 width: 897px;
 }
 .thumb
 {
 height: 200px;
 margin-left: 6px;
 padding: 4px 15px;
 width: 880px;
 }
 .pic
 {
 float: left;
 height: 160px;
 margin: 0 22px;
 width: 168px;
 }
 .testimonial
 {
 width:945px;
 height:100px;
 }
 .testimonial p
 {
 color: #000000;
 font-size: 23px;
 height: 25px;
 margin: 4px 45px;
 width: 173px;
 }

 .comma
 {
 background:url(images/comma-1.png) no-repeat;
 height: 25px;
 margin-left: 120px;
 width: 25px;
 }
 .comma1
 {
 background:url(images/comma-2.png) no-repeat;
 float: right;
 height: 25px;
 margin-right: 80px;
 margin-top: 11px;
 width: 25px;
 }
 .tes-text
 {
 float:left;
 margin-left: 105px;
 height:47px;
 width: 740px;
 }
 .tes-text p
 {
 color: #a2a1a1;
 font-size: 17px;
 height: 52px;
 width: 742px;
 }
 .name
 {
 float: left;
 height: 30px;
 width: 840px;
 }
 .name p
 {
 color: #666666;
 float: right;
 font-size: 19px;
 height: 21px;
 margin-right: 5px;
 width: 156px;
 }

<Footer> Area HTML

Nothing too fancy here.
Portfolio-layout
<footer>
<div id="cprt">
<p> Copyright © 2011 - Designzzz.com </p>
</div>
<div id="nav">
<ul>
<li><a href="#">Home </a>-</li>
<li><a href="#">About</a>-</li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</footer>

CSS of this Area

footer
 {
 background:url(images/hire-bg.png) repeat-x;
 width:960px;
 margin:0 auto;
 height:70px;
 border-radius:8px 8px 0px 0px;
 }
 #cprt
 {
 height: 25px;
 padding: 22px 10px;
 width: 400px;
 float:left;
 }
 #cprt p
 {
 color:#666;
 font-size:17px;
 }
 #nav
 {
 float: right;
 height: 25px;
 padding: 22px 10px;
 width: 212px;
 }
 #nav ul
 {
 margin:0px;
 }
 #nav ul li
 {
 color: #666666;
 float: left;
 font-size: 18px;
 list-style: none outside none;
 padding: 0 6px;
 }
 #nav ul li a
 {
 color: #666666;
 text-decoration:none;
 }
 #nav ul li a:hover
 {
 color:#fff;
 }

DONE

Free Photoshop Template
Live Preview