CSS Image Rollovers
Category: CSS Tutorials | 522 views | Add a Comment |
You can turn textual links into graphical links with simple image replacement, and with the hover link state, you can create effective image rollovers that will swap one image for another when the cursor passes over the link.
An obvious solution would be to have two images and do something like this to swap one background image for another:
a {
display: block;
width: 200px;
height: 63px;
background-image: url(images/toucanfade.jpg);
text-indent: -999em;
}
a:hover {
background-image: url(toucan.jpg);
}
The trouble with this is that there will be a delay when the link is hovered over, as the image for the rollover downloads, making the effect far from instantaneous.
The way to get around this is to actually have just one image that comprises the two images you want, one on top of the other. Read more…
- No Related Post
CSS background-size
Category: CSS, CSS Tutorials | 2,366 views | Add a Comment |
background-size Description:
This is a CSS 3 property from the CSS 3 Working Draft. Until the draft has been finalized, there may be additional changes. For most up-to-date information, go to the W3C.
The background-size property allows you to change the size of the background image to better fit your page. It is often thought of as the background stretch property.
background-size in CSS Versions:
background-size Syntax:
background-size: [ [ <length> | <percentage> | auto ]{1,2} || round ]
- length - A specific size
- percentage - A size relative to the container element.
- round - tells the user agent to get it close to that width or height
If you specify one value, the image stretches the same amount for width and height. Two values equal the width then the height to stretch. Read more…
- How to use CSS Background Properties
- CSS ID Selector
- Use shorthand CSS notation
- Organize your CSS-code
- HTML Basics
- CSS Framework
- 150 CSS Examples
- Using Logo with CSS
- Introduction to CSS3
- How to design css sitemap Tree
CSS Units Examples
Category: CSS, CSS Tutorials | 184 views | Add a Comment |
Measurements
| Unit | Description |
|---|---|
| % | percentage |
| in | inch |
| cm | centimeter |
| mm | millimeter |
| em | 1em is equal to the current font size. 2em means 2 times the size of the current font. E.g., if an element is displayed with a font of 12 pt, then ‘2em’ is 24 pt. The ‘em’ is a very useful unit in CSS, since it can adapt automatically to the font that the reader uses |
| ex | one ex is the x-height of a font (x-height is usually about half the font-size) |
| pt | point (1 pt is the same as 1/72 inch) |
| pc | pica (1 pc is the same as 12 points) |
| px | pixels (a dot on the computer screen) |
Colors
| Unit | Description |
|---|---|
| color_name | A color name (e.g. red) |
| rgb(x,x,x) | An RGB value (e.g. rgb(255,0,0)) |
| rgb(x%, x%, x%) | An RGB percentage value (e.g. rgb(100%,0%,0%)) |
| #rrggbb | A HEX number (e.g. #ff0000) |
- No Related Post
What is CSS Sprite?
Category: CSS, CSS Tips, CSS Tutorials | 702 views | 1 Comment |
![]()
CSS Sprites is a technique by which we can combine multiple images in a single big image and position the various parts of this big image with our elements u
sing pure CSS attributes. The primary objective behind using CSS Sprites is to decrease the number of HTTP requests and thus decreasing the request stress on server. The idea behind CSS Sprites is to consolidate multiple images into one sprite and then selectively display portions of this sprite with positioning. It starts by creating a larger CSS Sprite by grouping more than one images (usually icons) together and aligning them in proper grid style to aid the positioning. Then it is aligning used a proper positioning values on the webpages to show their respective images. This way it decreases the number of HTTP requests and thus increases the overall speed of webpages.
Sometimes back, we used the favourite slicing technique to break down a larger image into smaller slices (parts) so as to make pages load faster, but all this technique was only fooling our eyes as the page looked like loading faster, while in reality it was not. Each of those images was fed up as a separate request to the server and would increase the time of loading actually.
According to Yahoo UI blog, the resultant sprite created by joining smaller images is always smaller in size than the combined contributed parts. It is because we have to use a single color table for the sprite instead of individual color tables for the contributed ones. Another advantage of using sprites is that this way we save the overhead required by the images.
How do CSS Sprites work?
As it turns out, the basic tools to do this are built into CSS, given a bit of creative thinking.
Let’s start with the master image itself. Dividing a rectangle into four items, you’ll observe in this master image that our intended “before” link images are on the top row, with “after”:hover states immediately below. There’s no clear division between the four links at the moment, so imagine that each piece of text is a link for now. (For the sake of simplicity, we’ll continue to refer to link images as “before” images and the :hover state as “after” for the rest of this article. It’s possible to extend this method to :active, :focus, and :visitedlinks states as well, but we won’t go into that here.)
Those familiar with Petr Stanicek’s (Pixy) Fast Rollovers may already see where we’re going with this. This article owes a debt of gratitude to Pixy’s example for the basic function we’ll be relying on. But let’s not get ahead of ourselves.
On to the HTML. Every good CSS trick strives to add a layer of visuals on top of a clean block of code, and this technique is no exception:
<ul id="skyline">
<li id="panel1b"><a href="#1"></a></li>
<li id="panel2b"><a href="#2"></a></li>
<li id="panel3b"><a href="#3"></a></li>
<li id="panel4b"><a href="#4"></a></li>
</ul>
This code will serve as a base for our example. Light-weight, simple markup that degrades well in older and CSS-disabled browsers is all the rage, and it’s a trend that’s good for the industry. It’s a great ideal to shoot for. (We’ll ignore any text inside the links for the time being. Apply your favorite image replacement technique later to hide the text you’ll end up adding.) Read more…
Suture CSS Reduce HTTP Requests
Category: CSS, CSS Tutorials, CSS3 Tutorial | 438 views | 1 Comment |
A server-side variation of merging CSS and JavaScript files before uploading to the server is to do this digital suturing at the server. You can “suture” CSS or JavaScript files together before delivery from the server to save HTTP requests. Often developers create separate style sheets and scripts for organizational purposes, and import them into their pages as needed. There are two problems with this approach:
- it requires additional HTTP requests, and
- you can encounter the same-domain connection limit.
Scripts that load in the head of your HTML document actually block the loading and parsing of other objects, until they are downloaded . You can have your organization and eat it too by combining style sheets or JavaScript files on demand to create one master file at the server with PHP or JSP. Done properly, these combined files can also be cached. Read more…
- CSS ID Selector
- Use shorthand CSS notation
- Organize your CSS-code
- HTML Basics
- CSS Framework
- 150 CSS Examples
- CSS background-size
- Using Logo with CSS
- Introduction to CSS3
- How to design css sitemap Tree
How to Minimize HTTP Requests
Category: CSS, CSS Tutorials | 342 views | 1 Comment |
Combining external files and optionally including CSS and JavaScript directly within your XHTML pages, you can minimize the number of HTTP requests required to render your page. Each unique HTTP request requires a round trip to a server, introducing indeterminate delays. Users attune to fast, consistent response times. The more HTTP requests that your pages require, the slower and less consistent their response time will be.
This technique is especially important in the head of your XHTML documents. With few exceptions, browsers must load and parse external CSS and JavaScript files referenced within the head of your XHTML before they parse the body content. By minimizing the HTTP request load you can maximize the initial display speed of your content.
So this:
<link rel="stylesheet" type="text/css" href="/css/fonts.css" />
<link rel="stylesheet" type="text/css" href="/css/nav.css" />
<script src="/js/functions.js" type="text/javascript"></script>
<script src="/js/validation.js" type="text/javascript"></script>
Becomes this:
<link rel="stylesheet" type="text/css" href="/css/combined.css" />
<script src="/js/combined.js" type="text/javascript"></script>
Even better, XSSI these files directly into high traffic pages, like this:
<style type="text/css">
<!--
<!--#include virtual="/css/combined.css" -->
-->
</style>
<script type="text/javascript">
<--
<!--#include virtual="/js/combined.js" -->
// -->
</script>
Note that while JavaScript files are not reliably cached by browsers, CSS files are. The SSI technique included above should only be used on high traffic pages, like home pages. Note also that you can use XSSI or pre-merge these files into high traffic pages, to create conditional style and behavior. You can link to them normally for other pages and still separate presentation and behavior from structure, and benefit from caching. This technique also applies to adjacent graphics, which can also be combined or eliminated.
- No Related Post
How to create a structured CSS
Category: CSS, CSS Tutorials | 372 views | 1 Comment |
What is this CSS…it stands for Cascading Style Sheet.
How does it help to resolve the above mentioned problem…CSS is a style language or tool which is used to add the layout to the website. Now I’ll explain step by step how we can save the time if we have to edit the look of the text on all the pages. There are basically three methods to do the same.
Method 1 : In-line (the attribute style)
This method uses the HTML attribute STYLE and requires you to make the changes in every text you want to modify. Hence this doesn’t resolve the purpose of time saving.
| <DIV style=”font-family: arial, verdana, sans-serif; font-weight: bold;”> This text has been modified using the style attribute of the div tag </DIV> |
Method 2 : Using the style tag in the HEAD section.
This method is better but not the best as each page would required to be opened and changed for the modifications. Read more…
- CSS Tips
- Organizing Your CSS Files
- 100 CSS Examples and Tutorials
- 150 CSS Examples
- Top CSS Tips
- Introduction to CSS3
- Margins and Absolute Positioning
- Top reasons sites break in IE 7
- Write a Clean CSS
- How to design css sitemap Tree
Hex Chart HTML color
Category: CSS, CSS Tutorials | 359 views | Add a Comment |
When adding a color to your webpage with HTML, sometimes you can just type in the name of the color. But more often than not, you’ll need to use what’s called the hex code, which is something that the browser will be able to understand. Choose a color from the list below and look to its left to get the hex code. If you wanted your background to be red, for example, you’d type bgcolor=”#CC3300″.
| Hexadecimal Code | Color |
| #FFFFFF | |
| #FFFFCC | |
| #FFFF99 | |
| #FFFF66 | |
| #FFFF33 | |
| #FFFF00 | |
| #FFCCFF | |
| #FFCCCC | |
| #FFCC99 | |
| #FFCC66 | |
| #FFCC33 | |
| #FFCC00 | |
| #FF99FF | |
| #FF99CC | |
| #FF9999 | |
| #FF9966 | |
| #FF9933 | |
| #FF9900 | |
| #FF66FF | |
| #FF66CC | |
| #FF6699 | |
| #FF6666 | |
| #FF6633 | |
| #FF6600 | |
| #FF33FF | |
| #FF33CC | |
| #FF3399 | |
| #FF3366 | |
| #FF3333 | |
| #FF3300 | |
| #FF00FF | |
| #FF00CC | |
| #FF0099 | |
| #FF0066 | |
| #FF0033 | |
| #FF0000 | |
| #66FFFF | |
| #66FFCC | |
| #66FF99 | |
| #66FF66 | |
| #66FF33 | |
| #66FF00 | |
| #66CCFF | |
| #66CCCC | |
| #66CC99 | |
| #66CC66 | |
| #66CC33 | |
| #66CC00 | |
| #6699FF | |
| #6699CC | |
| #669999 | |
| #669966 | |
| #669933 | |
| #669900 | |
| #6666FF | |
| #6666CC | |
| #666699 | |
| #666666 | |
| #666633 | |
| #666600 | |
| #6633FF | |
| #6633CC | |
| #663399 | |
| #663366 | |
| #663333 | |
| #663300 | |
| #6600FF | |
| #6600CC | |
| #660099 | |
| #660066 | |
| #660033 | |
| #660000 | |
| #CCFFFF | |
| #CCFFCC | |
| #CCFF99 | |
| #CCFF66 | |
| #CCFF33 | |
| #CCFF00 | |
| #CCCCFF | |
| #CCCCCC | |
| #CCCC99 | |
| #CCCC66 | |
| #CCCC33 | |
| #CCCC00 | |
| #CC99FF | |
| #CC99CC | |
| #CC9999 | |
| #CC9966 | |
| #CC9933 | |
| #CC9900 | |
| #CC66FF | |
| #CC66CC | |
| #CC6699 | |
| #CC6666 | |
| #CC6633 | |
| #CC6600 | |
| #CC33FF | |
| #CC33CC | |
| #CC3399 | |
| #CC3366 | |
| #CC3333 | |
| #CC3300 | |
| #CC00FF | |
| #CC00CC | |
| #CC0099 | |
| #CC0066 | |
| #CC0033 | |
| #CC0000 | |
| #33FFFF | |
| #33FFCC | |
| #33FF99 | |
| #33FF66 | |
| #33FF33 | |
| #33FF00 | |
| #33CCFF | |
| #33CCCC | |
| #33CC99 | |
| #33CC66 | |
| #33CC33 | |
| #33CC00 | |
| #3399FF | |
| #3399CC | |
| #339999 | |
| #339966 | |
| #339933 | |
| #339900 | |
| #3366FF | |
| #3366CC | |
| #336699 | |
| #336666 | |
| #336633 | |
| #336600 | |
| #3333FF | |
| #3333CC | |
| #333399 | |
| #333366 | |
| #333333 | |
| #333300 | |
| #3300FF | |
| #3300CC | |
| #330099 | |
| #330066 | |
| #330033 | |
| #330000 | |
| #99FFFF | |
| #99FFCC | |
| #99FF99 | |
| #99FF66 | |
| #99FF33 | |
| #99FF00 | |
| #99CCFF | |
| #99CCCC | |
| #99CC99 | |
| #99CC66 | |
| #99CC33 | |
| #99CC00 | |
| #9999FF | |
| #9999CC | |
| #999999 | |
| #999966 | |
| #999933 | |
| #999900 | |
| #9966FF | |
| #9966CC | |
| #996699 | |
| #996666 | |
| #996633 | |
| #996600 | |
| #9933FF | |
| #9933CC | |
| #993399 | |
| #993366 | |
| #993333 | |
| #993300 | |
| #9900FF | |
| #9900CC | |
| #990099 | |
| #990066 | |
| #990033 | |
| #990000 | |
| #00FFFF | |
| #00FFCC | |
| #00FF99 | |
| #00FF66 | |
| #00FF33 | |
| #00FF00 | |
| #00CCFF | |
| #00CCCC | |
| #00CC99 | |
| #00CC66 | |
| #00CC33 | |
| #00CC00 | |
| #0099FF | |
| #0099CC | |
| #009999 | |
| #009966 | |
| #009933 | |
| #009900 | |
| #0066FF | |
| #0066CC | |
| #006699 | |
| #006666 | |
| #006633 | |
| #006600 | |
| #0033FF | |
| #0033CC | |
| #003399 | |
| #003366 | |
| #003333 | |
| #003300 | |
| #0000FF | |
| #0000CC | |
| #000099 | |
| #000066 | |
| #000033 | |
| #000000 |
![]()
- No Related Post
XHTML vs. HTML
Category: CSS Tutorials | 236 views | Add a Comment |
I know that many people still use HTML 4.01, but with the introduction of XHTML and unending browser updates, it is becoming less popular in favour of this new web standard. This tutorial is just an introduction to XHTML.
Firstly though, what is XHTML?
XHTML is pretty much the same as HTML with several small differences. It stands for Extensible HyperText Markup Language. It is a combination of HTML and XML. As it is a web standard, all new browsers support it and eventually, it will replace HTML. Read more…




