السبت، 13 سبتمبر 2014

How to Create Custom CSS Template for Printing


Along with the development of web technologies and web programming languages, web designing becoming more complex and the websites more flexible and user friendly. With the invention of CSS technology, web designing and programming becoming more easier than ever.

By using cascading style sheet (CSS) and its properties, you can give custom design to your website for different medias like screen, print, tv and for different screen sizes. The CSS @media property allows you to do such task.

Today I am going to describe "How to create custom CSS template for printing".

Designing Custom CSS Template for Printing


If you wanted to allow your website visitors to print the content of your website, you can design custom template for printing using CSS. You can define which part or your website will be printed or not and can add page setting for printing.

Designing Custom CSS Template for Printing

Here is a sample CSS code for website template.


body{
background:#00aaff;
font-color:#00000;
font-size:16px;
}

h1, h2, h3 {

/* CSS codes for h1, h2, h3 */

}

#wrapper{
width:80%;
margin: 0 auto;
background:#fff;
padding:20px;
}

#content{
width:54%;
float:left;
margin-right:3%;
}

#header{
width:100%;
margin-top:2%;
}

#sidebar-left{
width:20%;
float:left:
margin-right:3%;
}

#sidebar-right{
width:20%;
float:left;
}

#footer{
width:100%;
}


While printing you can hide default header, menu and sidebar using CSS codes. Here is a sample CSS code for printing webpage.


body{
background:#00aaff;
font-color:#00000;
font-size:16px;
}

h1, h2, h3 {

/* CSS codes for h1, h2, h3 */

}

#wrapper{
width:80%;
margin: 0 auto;
background:#fff;
padding:20px;
}

#header{
display:none;
}


#content{
width:100%;
clear:both;
margin-right:3%;
}

#sidebar-left{
display:none;
}

#sidebar-right{
display:none;
}

#footer{
display:none;
}


Place the above CSS code inside media queries for printing as below.

@media only print and (orientation:portrait) { 
    
     /* Add CSS code here for printing on portrait mode */
 }

@media only print and (orientation:landscape) { 
    
     /* Add CSS code here for printing on landscape mode */
 }



Adding Printing function and icon



Add the following HTML code where you want to place print icon.

<a href="javascript:window.print()"> Print this page </a>

Using this code the print link looks like as below                                     Print this page


<a href="javascript:window.print()"> <img src="print.jpg"></a>

Print
Using this code the print icon looks like as below


<form><input type="button" value="Print This" onclick="window.print()"></form>

Using this code the print button looks like as below                                                            



Related Posts:



    الجمعة، 12 سبتمبر 2014

    How to Create Responsive Website or Blogger Template


    As the time goes, browsing websites from desktop computers decreasing and using Laptops, Tablets and Mobile devices increasing day by day. So why not to create our website design custom for each types of devices, that fits and looks more attractive for those devices to acquire the visitors entered from those devices.

    Responsive web design is the approach that suggests in which design and development should respond user behavior and environment based on the size of the browser screen, platform and orientation.

    Responsive web design includes the use of flexible layouts, images and intelligent use of media queries. You can make your blogger template responsive by using special tags in CSS. Media queries (@media) are such tags, which helps to make your CSS for every device screen size. You can make many media queries on CSS that matches for each screen size and you can put custom CSS codes for each media queries.

    Here I have explained some steps for creating your blog responsive.



    Step1: Add meta tags for responsiveness



    Add the following meta tags on your blogger template using the following steps.
    1.  Go to blogger dashboard and click on template
    2. Backup your template for the risk while editing template codes.
    3. Paste the following codes between and <head> and </head> tags.
    4. Save your blogger template.
    For website also, paste the following codes between <head> and </head> tags.

    Add the following codes to size the contents of blog equal to the device width.

      <meta name="viewport" content="width=device-width/">

    Add the following codes to size the contents of blog equal to the device width and device height.

      <meta name="viewport" content="width=device-width, height=device-height/">

    Add the following codes to size the contents of blog equal to the device width and initial zoom size.

      <meta name="viewport" content="width=device-width, initial-scale=2"/>

    Add the following codes to size the contents of blog equal to the device width, initial zoom size and maximum zoom size.

      <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1/">

    Instead or writing meta tags, you can do the same with the following codes in CSS.

    @-moz-viewport {
                               width: device-width;
    }

    @-moz-viewport {
                               width: device-width;
                               height:device-height;
    }

    @-moz-viewport {
                               width: device-width;
                               initial-scale:2;
    }

    @-moz-viewport {
                               width: device-width;
                               initial-scale:1;
                               maximum-scale:1;
    }


    This works only for Mozilla browser, for other browsers you can use -o-, -webkit- and -ms- as prefixed properties.


    Step2:Add media queries for each screen size



    Add the following media queries  between <![CDATA[*/ and ]]> tags.


    @media screen and (max-width:320px){
    /*For Small Screen Moblies*/
    }

    @media screen and (max-width:480px){
    /*For Smart Phones and iPhones*/
    }

    @media screen and (max-width:768px){
    /*For Small Tables*/
    }

    @media screen and (max-width:1024px){
    /*For Notebooks*/
    }

    You can add more media queries according to your need for different screen sizes and orientations and can also use min-width: to specify minimum width of screen.

    To specify the screen orientations landscape or portrait use

    @media screen and (max-width:480px) and (orientation:landscape) {  }



    Step3: Write custom CSS code for media queries



    Now, you have to add custom CSS codes for each media queries. The default CSS properties written are replaced by the properties written within these media queries. Here is the sample CSS code written for mobile devices, you can add these codes for media screen with max-width 320 and 480 px.

    #wrapper {
      width:85%;
     }
     

    #content{
     
    width:100%;
    }
     

    #sidebar-left{
     
    width:100%;
    clear:both;
    }
     

    #sidebar-right{
     
    width: 100%;
    clear:both;



    Alternate method for adding CSS code with media queries



    For the alternate method, you can write media queries with custom CSS codes on a single .css file and link it on header part of  your blog or website as below.

    <link rel="stylesheet" media="screen" href="screen.css"/>

    You have to give the full path for "screen.css", where the file is placed.

    You can also link different style sheet files for different screen sizes as below.

    <link rel="stylesheet" media="screen and (max-width:1280px)" href="large.css"/>

    <link rel="stylesheet" media="screen and (max-width:480px)" href="small.css"/>



    Related Posts:





      الاثنين، 1 سبتمبر 2014

      List of Top 10 Video Sites


      Here are the List of top 10 and the best video sites includes top video websites like youtube.com.

      1. Youtube.com:


      YouTube allows billions of people to discover, watch and share originally-created videos. YouTube provides a forum for people to connect, inform, and inspire others across the globe and acts as a distribution platform for original content creators and advertisers large and small.
      • Site's Information:

      1. Google Page Rank: 9
      2. Alexa Rank: 3
      3. Google Indexed: 379,000,000
      4. Google Plus: https://plus.google.com/+youtube
      5. Website: www.youtube.com

      2. Vimeo.com:


      Vimeo is a video-sharing community for original creative work and the people who create it. It gives the best ways to share, discover, and be inspired.
      • Site's Information:

      1. Google Page Rank: 9
      2. Alexa Rank: 100
      3. Google Indexed: 187,000,000
      4. Facebook: http://www.facebook.com/Vimeo 
      5. Twitter: http://twitter.com/Vimeo 
      6. Instagram: http://instagram.com/vimeo
      7. Tumbler: http://vimeo.tumblr.com/ 
      8. Website: http://vimeo.com/

      3. Dailymotion .com:


      Dailymotion is one of the biggest video platforms in the world and the most popular European site. Dailymotion offers the best content from users, independent content creators and official partners in the media and entertainment industries all over the world.
      • Site's Information:

      1. Google Page Rank: 8
      2. Alexa Rank: 88 
      3. Google Indexed: 30,000,000
      4. Facebook : http://www.facebook.com/dailymotion
      5. Twitter : http://twitter.com/Dailymotion 
      6. Tumbler : http://dailymotion.tumblr.com/
      7. Website: http://www.dailymotion.com 

      4. Ustream.tv:


      Ustream’s socially-fueled video platform has powered more than 85 million live streams (more than 2 billion viewer-hours of content!) across the globe. It is mostly used for live broadcasting of tvs or channels and has the plan for pro broadcasting.
      • Site's Information:

      1. Google Page Rank: 8
      2. Alexa Rank: 1157
      3. Google Indexed: 1,170,000
      4. Facebook Page: http://www.facebook.com/ustream 
      5. Twitter Page: http://twitter.com/ustream 
      6. Google Plus: https://plus.google.com/+UstreamTv2007
      7. Website: http://www.ustream.tv

      5. Screen.yahoo.com:


      Yahoo! Screen is the video site provided by yahoo to watch videos online for free. Here you can find here sports, kids and funny videos including the latest news video clips
      • Site's Information:

      1. Google Page Rank: 7
      2. Alexa Rank: 4
      3. Google Indexed: 871,000
      4. Website: https://screen.yahoo.com/

      6. Metacafe.com:


      Metacafe is dedicated to showcasing the best short-form videos from the world of Movies, Video Games, TV, Music and Sports – programmed for today’s young male Entertainment Drivers.
      • Site's Information:

      1. Google Page Rank: 6
      2. Alexa Rank: 2070
      3. Google Indexed: 14,200,000
      4. Facebook Page: http://www.facebook.com/metacafe
      5. Twitter Page: http://www.twitter.com/metacafe
      6. Website: http://www.metacafe.com/

      7. Break.com:


      You can watch funny videos and video clips at Break.com. It finds the best funny videos, clips and pictures for you to watch.
      • Site's Information:

      1. Google Page Rank: 6
      2. Alexa Rank: 1475
      3. Google Indexed: 567,000
      4. Twitter Page: https://twitter.com/Breakcom 
      5. Website: http://www.break.com/

      8. Veoh.com:


      Here you can watch movies online for free.Millions of online videos including free TV shows, movies, and music. You can upload and share your videos on Veoh, the video sharing network.
      • Site's Information:

      1. Google Page Rank: 5
      2. Alexa Rank: 4890
      3. Google Indexed: 1,020,000
      4. Facebook Page: http://www.facebook.com/pages/Veoh/
      5. Twitter Page: http://www.twitter.com/veoh 
      6. Website:http://www.veoh.com/

      9. Videosift .com:


      Videosift is the leading alternative video community on the web for quality videos and conversation .
      • Site's Information:

      1. Google Page Rank: 5
      2. Alexa Rank: 51292
      3. Google Indexed: 909,000
      4. Facebook Page: http://facebook.com/videosift 
      5. Google Plus:https://plus.google.com/116158236960191348615
      6. Website: http://videosift.com/

      10. StupidVideos.com:


      StupidVideos.com, is a viral video website dedicated to humorous, off-the-wall videos, including wild stunts, wacky animals, sports bloopers, funny commercials, song and dance parodies and more.
      • Site's Information:

      1. Google Page Rank: 5
      2. Alexa Rank: 51,773 
      3. Google Indexed: 145,000
      4. Facebook Page: https://www.facebook.com/StupidVideos
      5. Website: http://www.stupidvideos.com/



      Related Posts: