ads

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:



    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:





      How to Create Simple Blogger Template Easily?


      To create successful blog, it needs to create blogger template more attractive and looks more professional. Even you can buy professional blogger template on the web, you may want to create blogger template by yourself for your blog. Creating a professional blogger template is more challenging task, but if you have some knowledge on HTML, XML, CSS and JavaScript, it is possible to create professional blogger template easily by yourself. In this series of tutorial, I am going to teach you basic to advanced steps to create blogger template. Today I am telling you "steps for creating a simple blogger template" with describing basic elements and along with its corresponding style sheet codes.


      Step1: Preparing demo blog for creating blogger template



      To test blogger template you have created, at first you need to set up a blogger blog and have to add some posts on the blog. To create a blog, go to blogger home page, log in using your Google user name and password and then click on create a blog link to get started. Write posts for a blog by clicking on create a new post button from the blogger dashboard.


      Step2: Creating basic elements for blogger template


      Open Notepad file write the codes according to the following format and save it as .xml extension.

      # Creating XML Part


      At first, add the following codes for  Document Type Deceleration(DTD) on XML part.

      <?xml version="1.0" encoding="UTF-8" ?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1 -strict.dtd">
      <html expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>

      # Creating Header Part


      After that, add the following header elements like head and title of the blog.

      <head>
      <title>
      <b:if cond='data:blog.pageType == "index"'>
      <data:blog.pageTitle/>
      <b:else/>
      <b:if cond='data:blog.pageType != "error_page"'>
      <data:blog.pageName/> | <data:blog.title/>
      <b:else/>
      Page Not Found | <data:blog.title/>
      </b:if>
      </b:if>
      </title>
      </head>

      # Creating CSS Part


      Add custom css codes for your template in the following format. The css codes must be placed inside <![CDATA[*/ and ]]>
      tag.

      body{
      font:normal normal 14px Verdana,Geneva,sans-serif;
      color:#000;padding:0 40px 40px 40px;
      background:#fff;
      font-size:14px;
      }
      #outer-wrapper{
      CSS for outer-wrapper
      }
      #header-wrapper{
      CSS for header-wrapper
      }
      #titlewrapper{
      CSS for titlewrapper
      }
      #descriptionwrapper{
      CSS for descriptionwrapper
      }
      #menuwrapper{
      CSS for menuwrapper
      }
      #contentwrapper{
      CSS for contentwrapper
      }
      #mainwrapper{
      CSS for mainwrapper
      }

      # Creating a Menu 


      To create menu for a blog, add the code in the following format. Replace URL and name of the tabs. 

      <div id='menuwrapper'>
      <ul class='FirstLevel'>
      <li><a href='http://www.homepage.com/' target='_self'>Home
      </a></li>
      <li><a href='http://www.homepage.com/menu1.html' target='_self'>Menu1
      </a></li>
      <li><a href='http://www.homepage.com/menu2.html' target='_self'>Menu2
      </a></li>
      <li><a href='http://www.homepage.com/menu3.html' target='_self'>Menu3
      </a></li>
      </ul></div>

      # Creating blog content

      To add main blog content part, add these codes to create a widget named Blog1.

      <div id='outer-wrapper'>
      <div id='header-wrapper'>
      <b:section class='header' id='header' maxwidgets='1' showaddelement='no'>
      <b:widget id='HTML1' locked='true' title='Header' type='HTML'>
      </b:widget>
      </b:section>
      </div>
      <div id='content-wrapper'>
      <div id='main-wrapper'>
      <b:section class='main' id='main' showaddelement='no'>
      <b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'>
      </b:widget>
      </b:section>
      </div>
      </div>
      </div>



      Step3: Creating gadgets on sidebar and footer.


      To create sidebar and footer and to add widgets  for them add these code, which allows you to add widgets on sidebar and footer.

      <div id='sidebar-wrapper'>
      <b:section class='sidebar' id='sidebar' showaddelement='yes'>
      </b:section>
      </div>

      <div id='footer-wrapper'>
      <b:section class='footer' id='footer' showaddelement='yes'>
      </b:section>
      </div>


      Step4: Installing blogger template on required blog.


      After creating a code file on Notepad in XML format, test it on demo blog. To install prepared template, click on backup and restore button from template option on blogger dashboard. Click on download full template, the xml file will be downloaded. Then go to the required blog then go to Template  ›  Backup / Restore option and browse and upload that xml file. The template will be applied on your blog.




      Related Posts:





      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: