Archive for the 'CSS' Category

z-index in IE7


Again bad behave of IE. I was working on a client website. Site was done by someone else & I am basically fine tuning it & fixing UI bugs. In this scenario there is a multilevel CSS based navigation (that means no Javascripts at all) which coming under the side bar.

Navigation going under the Side Bar
Navigation going under the Side Bar

In Firefox it was easy to fix by giving the maximum value to the z-index for that particular navigation.


#navigation li a {
	 position:relative;
	 z-index:9999;
}

Keep in mind that if you are using z-index, use position:relative or position:absolute.

But IE didn’t response at all.

After few minutes of workarounds I just gave a minus z-index value to the Side Bar.


#side_bar {
	position:relative;
	z-index:-1;
}

Thank god!!! It worked.

Navigation works fine now
Navigation works fine now

Happy CSS Naked Day!


CSS Naked Day 2008
CSS Naked Day 2008

So I am celebrating it for the second time!

Where did my Design go?

The idea behind this event is to promote Web Standards. Plain and simple. This includes proper use of (x)html, semantic markup, a good hierarchy structure, and of course, a good ‘ol play on words. It’s time to show off your .

To know more about why styles are disabled on this website visit the Annual CSS Naked Day website for more information.

Conditional Comments


Conditional Comments are basically a new set of comment-like tags that IE 5+ supports. These tags look very much like the good old comment tag and in fact are treated as such by all browsers except IE, in which they operate a little more intelligently. Using Conditional Comments, you can selectively “comment out” any portion of your page in a way that only IE interprets the containing content, or the other way around.

This is a good and valid alternative to invalid browser specific CSS hacks we used ealier.

<!--[if IE]>
You are using Internet Explorer.
<![endif]–>

<!--[if IE 5]>
You are using Internet Explorer 5.
<![endif]–>

<!--[if IE 5.0]>
You are using Internet Explorer 5.0.
<![endif]–>

<!--[if IE 5.5]>
You are using Internet Explorer 5.5.
<![endif]–>

<!--[if IE 6]>
You are using Internet Explorer 6.
<![endif]–>

<!--[if IE 7]>
You are using Internet Explorer 7.
<![endif]–>

<!--[if gte IE 5]>
You are using Internet Explorer 5 and up.
<![endif]–>

<!--[if lt IE 6]>
You are using Internet Explorer lower than 6.
<![endif]–>

<!--[if lte IE 5.5]>
You are using Internet Explorer lower or equal to 5.5.
<![endif]–>

<!--[if gt IE 6]>
You are using Internet Explorer greater than 6.
<![endif]–>

<!--[if !IE]>
You are NOT using IE.
<![endif]–>

Operators supported by Conditional Comments
Operator syntax Description
! The “not” operator.
lt The “less than” operator.
lte The “less than or equal to” operator.
gt The “greater than” operator.
gte The “greater than or equal to” operator.

CSS and Facebook


If u use facebook, and you love CSS

A CSS facebook group, where you can post your discussion, your website, your blog, your beautiful css/(x)html markup or anything you want!

Join CSS facebook group »

Speed up your web pages with YSlow


Yahoo Developer Network launches YSlow, a web page analyzer which tells you why they’re slow based on the rules for high performance web sites. YSlow is a Firefox add-on integrated with the popular Firebug web development tool. So before installing YSlow you have to install Firebug.

YSlow featured with:

  • Performance report card
  • HTTP/HTML summary
  • List of components in the page
  • Tools including JSLint

Get YSlow »

Writing Valid (X)HTML


Introduction

The implementation of valid/standard methods, guidelines and best practices will help to produce high quality websites that are accessible to as many as possible. By building valid websites you can save time and money for the development and provides a better experience for the visitor.

Validation is also an important part of web development. Many errors that are hard to find can discover during validation. This is like spell checking and proofreading for grammar and syntax in a document. but is much more precise and reliable than any of those processes because it is dealing with precisely-specified machine languages, not with nebulously-defined human natural language. You can validate your (X)HTML page as well as your CSS.

Here I’m not going brief you about Web Standards, but I’m going to tell how we can use those best practices in Web standards to produce a valid (X)HTML page.

Benefits of having a valid code

  • Future compatibility: Your website will compatible with future web browsers.
  • Simpler development and maintenance: Creating Valid (X)HTML Documents Means Cleaner Code and Easier Maintenance.
  • Faster download and rendering of web pages: Less (X)HTML results in smaller file sizes and quicker downloads. Modern web browsers render pages faster when they are in their standards mode than when they are in their backwards compatible mode.
  • Better accessibility: Semantic (X)HTML, where structure is separated from presentation, makes it easier for screen readers and alternative browsing devices to interpret the content.
  • Better search engine rankings: The separation of content and presentation makes the content represent a larger part of the total file size. Combined with semantic markup this will improve search engine rankings.
  • Simpler adaptation to any media or screen devices: A semantically marked up document can be easily adapted to print and alternative browsing devices, like handheld computers and cellular phones, just by linking to a different CSS file. You can also make site-wide changes to presentation by editing a single file.

Best Practices…

  • Include the correct DOCTYPE declaration at the beginning of the file. A DOCTYPE (short for “document type declaration”) informs the validator which version of (X)HTML you’re using, and must appear at the very top of every web page. DOCTYPEs are a key component of compliant web pages: your markup and CSS won’t validate without them.
  • The DOCTYPE is case-sensitive so use the correct case:
    <!DOCTYPE html PUBLIC "- //W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
  • Add the attribute xmlns="http://www.w3.org/1999/xhtml" to the <html> element.
  • Close all elements: Omitting </p> is not valid anymore.
  • Change all elements to lowercase: <P> becomes <p>.
  • Correctly specify empty elements: <hr> becomes <hr />.
  • Quote all attribute values: <p align="right">.
  • Always add attribute values: <hr noshade="noshade" />.
  • Always use &amp; in place of &. : <a href="foo.php?chapter=1&amp;section=2 />
  • <form> element should have to have a action attribute always: <form action=”#”></li>
  • If you are using name & id attributes in input element, both should be in same name: <input name="field_name" id="field_name" />
  • Use alt attribute always for <img> element: <img src="image.gif" alt="" />
  • Use width & height attributes as in this order in <img> element: <img src="image.gif" width="100" height="100" alt="" />
  • Use a separate JavaScript file always & make sure you have put type attribute correctly: <script type="text/javascript" src=”javascript.js"></script>
  • Try to use a external CSS file for styles.
  • Always try to use tables only for TABULAR data.
  • Make sure you are using <th> for table headers & <td> for table data.
  • Elements in (X)HTML must be closed in the reverse order that they were opened in: <strong><em>…</em></strong>

(X)HTML Validation services

CSS Validation services

Accessibility Validation services

Useful Firefox Add-ons for validation services and web development

Feeds In My Google Reader


Here another list from me :) this time it’s all about feeds which I have added to my Google Reader to read whenever I am free. Actually now I am addicted to Google Reader and these feeds. This list is bit long and it’s containing around 78 valid feeds.

Here I have sorted out the list in alphabetical order. This will contain feeds about Web Standards, Accessibility, Usability, User Experience, Web 2.0, Personal Blogs, Technical and Technology, Design Resources and some great online journals regarding web and it’s new trends. This is very helpful for me to keep my self updated on time.

If anyone know any good feed that I have missed here, feel free to add it via a comment.

Web Standards Round Up


Here I’m going to list down very useful articles regarding web standards. From introduction to implementation, from web browsers to web accessibility. These articles were very helpful for me, so I hope for all you people who have heard about Web Standards and want to learn more about it, people who haven’t even heard about Web Standards and also Web Standards geeks who have miss some articles can find here.

If anyone think I have miss something here, please let me know then I can add it too.

Let’s make a better web for you and for me :)

Speedup your site by optimizing CSS


What is CSS?

Styles sheets define HOW HTML elements are to be displayed. Styles are normally saved in external .css files. External style sheets enable you to change the appearance and layout of all the pages in your Web, just by editing one single CSS document!

CSS is a breakthrough in Web design because it allows developers to control the style and layout of multiple Web pages all at once. As a Web developer you can define a style for each HTML element and apply it to as many Web pages as you want. To make a global change, simply change the style, and all elements in the Web are updated automatically.

[Introduction to CSS]

Why Optimize?

Well for two reasons mainly. It helps you get smaller CSS file sizes and better written code. The way the optimizer works actually lets you decide how much compression you want. From super compressed (virtually unreadable and editable by a human being) to visually pleasing. I prefer the standard setting because it gives you a little of both.

Another cool feature is that it helps you with shorthand coding. I am by no means an expert at CSS. I do not have all the shorthand methods memorized (yet!). For those of you using Dreamweaver, like myself, you’ll find that it likes to use longhand code. By this I mean putting each separate rule on its own line. This can get tedious copying and pasting it make a small change. A lot of that stuff can get consolidated into one line, like backgrounds and borders.

So your main reasons for wanting to optimize are to make sure your CSS files are clean. There is a certain art form in clean and concise code. And I’m not even a programmer and I can see that. I’m an artist, so this tool really helps speed things up.

[Why Optimize?]

CSS Optimization Tips

CSS Shorthand
Shorthand properties can be used to set several properties at once, in a single declaration, instead of using a separate declaration for each individual property. As you’ll see, this can save a lot of space in your CSS file.

CSS Optimizing/Formatting/Compressing Online Tools

FullCodePress | International site in a day competition


FullCodePress is a series of web competitions - the brainchild of the people at Webstock and WIPA. In essence it’s a geek Olympics!

The concept is simple. Web teams take each other on, at the same location, to build a complete website in 24 hours. No excuse, no extensions, no budget overruns.

The first event will be held in Australia on Saturday 18 and Sunday 19 August 2007 between Australia and New Zealand. In 2008 there will be a worldwide challenge for any interested countries – to be held in Wellington New Zealand. We’ll also be facilitating and encouraging competitions within individual countries.

Check out the FullCodePress website »