Entries Tagged as 'CSS'

31 CSS Code scraps to make you a Better Coder

Posted by Pradeep on June 09, 2011
  0 comments

It is almost unfeasible to collect in an article all the CSS code snippets that could help you in the future but here are some of the ones that you would need more frequently than others. Don’t get afraid by the length of some of these CSS hack’s code because they’re all easy to apply and where is the case, they’re well documented. Besides the ones that resolve common and annoying problems there are also some that solve new issues brought by the new technologies.

Full record of Browser-Specific CSS Hacks

Cross browser coding can be sometimes tricky but these browser specific css hacks can help you with your problems. With them cross browser compatibility comes to you served on a plate.




Use CSS2 Property like: after, :before, :first-letter, and :first-line

Posted by Pradeep on August 23, 2010
  0 comments

The :before pseudo-element is used to insert content immediately before an element. This is done via the content property. The content assigned by the content property can be characters, a string, text, or an image. Further, you can apply style to the content, such as setting font and color. This is a convenient way to prefix the same text to large number of related text elements which have the same class value.

The similar :after pseudo-element is used to insert content immediately after an element.

CSS2 has four pseudo-elements: :after, :before, :first-letter, and :first-line. Pseudo-elements allow you to create element-like structures which permit you to apply style to parts of a document that normally cannot be accessed using HTML. Specifically, you can add styled content before and after an element, or effect the style of the first letter or first line of an element.

style code

body{font:normal 12px arial;}
p.orange:before {content: "ABOUT iSUMMATION"; color: orange;font:bold 12px arial;}
p.orange:after {content: "India"; color: blue;font:bold 12px arial;}

Click Here To Run demo




Hide page content when printing a page

Posted by Bharat Patel on January 11, 2010
  0 comments

Hello Friends,

Sometimes, we are disabled editing option in a page like [select, copy and paste] also right click disabled because of no one can copied our data. We have to also take care about printing option even disabled print option or hide page content when printing page. There is simple solution for how to hide page content when printing a page.

<style media="print" type="text/css">
   body {display:none;visibility:hidden;}
</style>

Disabled selection

<script>
    document.onselectstart = new Function('return false');
    function dataSelect(evt){return false;}
    document.onmousedown = dataSelect;
</script>