Archive for the 'CSS Design' Category
Set the page-breaking behavior for an element
When printing a web page, sometimes an element should not be printed on two pages. For example, we want a set of questions to be in the same page. At this time, we need set the page-breaking behavior.
CSS code for this is actually very easy:
.pagebreak{ page-break-before:always; }
A simple example of CSS font shorthand rule
When styling fonts with CSS, you may do the following:
font-weight: bold; font-style: italic; font-variant: small-caps; font-size: 15px; line-height: 20px; font-family: verdana,"trebuchet MS",sans-serif
CSS for browsers to print background colors & images
Is there any css code for browsers to print out background colors? No, there is no such css code, background images and colors are ignored for browsers. So don’t rely on background colors for printing.
To let browsers print background colors and images, you need to configure your browsers option.
Hide some part on the web page when printing
What do you do if you want to hide some part when you print your web page? I didn’t find a best solution maybe, but it works for now.
The answer is to use a separate css for printing.
Here is a sample code.
<link rel="stylesheet" type"text/css" href="main-print.css" media="print"></link> <link rel="stylesheet" type"text/css" href="main.css" media="screen"></link>
Make IE show transparent image correctly
How to center a div box using CSS?
It is a common problem that the element doesn’t center properly. It’s very easy to fix this. Here is a sample html code.
<body> <div id="pageWrapper"> </div> </body>
To let pageWrapper center align, we can use the following for Firefox:
Learn CSS layout through one example
Even confused by CSS layout? Here is an good example showing that how to make a good css layout. It’s stackoverflow’s css layout, I simiplied it and make a simplest version.
Here you can download the css code. If you like this design, you can make it a WordPress Theme.
Comments(0)
