Archive Pages Design$type=blogging

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 fle...


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:



    تعليقات

    الاسم

    Artificial Intelligence(AI) Backlinking Basic IT Best List Blogging Tips C C# C++ Computer Architecture Computer Fundamental Computer Security Computer/IT Officer Exam CSS Data Mining and Warehousing Data Recovery Tools Data Structure Database Management System E-commerce E-government Internet & Web Designing IT Law IT Tips and Tricks IT Tutorials Java JavaScript Keyword Research Tools MIS Multiple Choice Question (MCQ) Networking Online Earning Online IT Jobs Operating System Oracle Forms and Reports Programming Guide Programming Language SEO Social Networking Sites Software Download Software Engineering System Analysis and Design Top List VB.Net
    false
    rtl
    item
    Max5: How to Create Custom CSS Template for Printing
    How to Create Custom CSS Template for Printing
    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqGPHaLUSQU4MGPgyKlbzfvIz4ryYFyC9UcM39JX0cPTd7lm_GWBxArvleCjKxFMTLeAGDhIPSk8djIW4IVuth-70bjtx7s-u1DLSxKC51SmCHw_WURYC8BCwZ3lspBOsyPWH8qOTnCfjg/s1600/print.png
    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqGPHaLUSQU4MGPgyKlbzfvIz4ryYFyC9UcM39JX0cPTd7lm_GWBxArvleCjKxFMTLeAGDhIPSk8djIW4IVuth-70bjtx7s-u1DLSxKC51SmCHw_WURYC8BCwZ3lspBOsyPWH8qOTnCfjg/s72-c/print.png
    Max5
    https://maxs27.blogspot.com/2014/09/how-to-create-custom-css-template-for.html
    https://maxs27.blogspot.com/
    http://maxs27.blogspot.com/
    http://maxs27.blogspot.com/2014/09/how-to-create-custom-css-template-for.html
    true
    1760660989564394152
    UTF-8
    لم يتم العثور على اى مواضيع شاهد الكل اقرأ المزيد رد احذف الرد حذف بواسطة الرئيسية صفحات مواضيع شاهد الكل نوصى لك التسميات الارشيف بحث لم يتم العثور على ماتبحث عنه عودة للرئيسية الاحد الاثنين الثلاثاء الاربعاء الخميس الجمعة السبت الاحد الاثنين الثلاثاء الاربعاء الخميس الجمعة السبت يناير فبراير مارس ابريل مايو يونيو يوليو اغسطس سبتمبر اكتوبر نوفمبر ديسمبر يناير فبراير مارس ابريل مايو يونيو يوليو اغسطس سبتمبر اكتوبر نوفمبر ديسمبر just now 1 دقيقة مضت $$1$$ دقيقة مضت 1 hour ago $$1$$ ساعة مضت الامس $$1$$ يوم مضى $$1$$ اسبوع مضى اكثر من 5 اسابيع مضت