Post your trick

Css Hack

I spent about 35 minutes on this one and still havent found a logic to it .

But this hack should be remembered .

consider the markup : <div id = a ><input/><div id = “a_child” ></div>    </div>

if you need to give a bottom border to the div with id = a and expect it to come below the div with id = “a_child”  , then the following css needs to be in place :

#a{  height:auto;overflow:hidden;}

Thanks to vineet and jimit  to get out of this one ..


word wrap for an editable div

To make a div or a paragraph editable set the attribute -  contenteditable = true

give a fixed width to the div : -   width:100px ;

after 100px the word should wrap down , for this add the css property :

word-wrap:break-word;

Happy Hacking :)


Background Opacity to be set in CSS

Ever wondered how you could change the opacity of the background or adjust the alpha quantity for it here is a trick to do so :
e.g.If you want to set a background for body then
in the CSS this is what should follow

body
{background rgba(82,82,82,0.7)}

here ‘rgb’ is for the red,green,blue values respectively and ‘a’ is the alpha/opacity for the background


Make your css dynamic

To implement constants in css , let your php script output as css by passing the following headers :

header(’content-type:text/css’);
header(”Expires: “.gmdate(”D, d M Y H:i:s”, (time()+900)) . ” GMT”);


Post A Trick !

How does "Kodetricks" work?

We at kodeplay like to share knowledge. With Kodetricks, even you can join us. All you need to do is post a programming related trick if you have one or rate a trick if you like someone else's.



Find us on

Technology

Contact Us