CSS 3 Tips and Tricks
There are tons of new, and amazing things which CSS coders will be able to do, but can't currently do, which CSS level-3 will bring into the focus of modern web development.
For example...
Embedding custom fonts.
@font-face {
font-family: "Fertigo";
src: url('/fonts/Fertigo.otf')
format("opentype");
}
Rotation and scaling of elements
#mybox {
transform: translate(80px, 80px) scale(1.5, 1.5) rotate(45deg);
height: 100px;
width: 100px;
}
Read more... |
Comments (0) | Nov 07, 2008
Input focus onload
Some web sites, such as big search engines, (Google, or Yahoo! for example) and other types of commercial sites often will feature a very prominent main search field. Possibly a search field on every page.
When this is the case, its a very good practice to make SURE the user always has their mouse cursor inside (or in focus) the main input field right from the get-go. No one wants to have to click inside a field every time they visit when its the main point of the site in the first place.
Here's an easy way to achieve this.
<input type="text" onload="this.focus();" />
The problem with using the above code is that you'd have to put it into each and every single <input> element, for every page that you wish for it to have attain focus by default. And you probably already know where I'm going with this... it's unacceptable.
Read more... |
Comments (0) | Sep 26, 2008
Reciprocal JavaScript
Have you ever needed to load a JavaScript based upon some JavaScript condition that was set to true, or some function that was run, or object that was called? (You get the idea)
Well, in some cases, you may just need to do just that. The primary focal point in doing this lies within JavaScript's createElement method. We can use this method to create a new script element to call another file from within the page.
First, lets create a variable named efile then we can assign this the value of that new script element.
var efile = document.createElement("script");
efile.src = "/path/to/myscript.js";
efile.type = "text/javascript";
The above JavaScript code is equivalent to this in HTML:
<script src="/path/to/myscript.js" type="text/javascript"></script>
Read more... |
Comments (0) | Apr 05, 2008
