Your source for everything web
2 Dec
Style sheet is a progressive breakthrough for the advancement of web. Today, more and more browsers are implementing style sheets, opening authors’ eyes to unique features that allow influence over presentation while preserving platform independence. The advantages of style sheets have become – apparent — and the disadvantage of continually creating more HTML tags — galore — for presentation effects with the gradual development of CSS.
Let’s understand CSS in the right perspective.
Style sheets in retrospect
Style sheets have been around in one form or another since the beginnings of HTML in the early 1990s.
As the HTML language grew, however, it came to encompass a wider variety of stylistic capabilities to meet the demands of web developers . With such capabilities, style sheets became less important, and an external language for the purposes of defining style attributes was not widely accepted until the development of CSS.
Teething problems with implementation of CSS
Many implementations of CSS are fraught with inconsistencies, bugs and other Authors have commonly had to use hacks and workarounds in order to obtain consistent results across web browsers and platforms.
One of the most well-known CSS bugs is the Internet Explorer box model bug; box widths are interpreted incorrectly in several versions of the browser, resulting in blocks which appear as expected in most browsers, but are too narrow when viewed in Internet Explorer. The bug can be avoided, but not without some cost in terms of functionality.
This is just one of hundreds of CSS bugs that have been documented in various versions of Internet Explorer,Netscape Mozilla , and Opera, many of which reduce the legibility of documents. The proliferation of such bugs in CSS implementations has made it difficult for designers to achieve a consistent appearance across platforms.
Currently there is strong competition between Mozilla’s Gecko layout engine, Opera’s Presto layout engine, and the KHTML engine used in both Apple’s Safari and the Linux Konqueror browsers – each of them is leading in different aspects of CSS. Internet Explorer remains the worst at rendering CSS by standards set down by World Wide Web Consortium as of 2005.
Some breakthroughs …
These problems have preisely led the W3C to revise the CSS2 standard into CSS2.1, which may be regarded as something of a working snapshot of current CSS support. CSS2 properties which no browser had successfully implemented were dropped, and in a few cases, defined behaviours were changed to bring the standard into line with the predominant existing implementations..
What makes style sheets significant enough?
Style sheet represents an enormous step forward for the Web. With the separation of content and presentation between HTML and style sheets, the Web no longer needs to drift away from the strong ideal of platform independence that provided the medium with its initial push of popularity. Authors can finally influence the presentation of documents without leaving pages unreadable to users
A style sheet is made up of style rules that tell a browser how to present a document. There are various ways of linking these style rules to your HTML documents, but the simplest method for starting out is to use HTML’s STYLE element. This element is placed in the document HEAD, and it contains the style rules for the page.
Functionality and Usage of CSS
CSS is well-designed to allow the separation of presentation and structure. Prior to CSS, nearly all of the presentational attributes of an HTML document were contained within the HTML code; all font colors, background styles, element alignments, borders and sizes had to be explicitly described, often repeatedly, in the midst of the HTML code.
CSS allows authors to move much of that information to a stylesheet, resulting in considerably simpler HTML code. The HTML documents become much smaller and web browsers will usually cache sites’ CSS stylesheets. This leads to a reduction in network traffic and noticeably quicker page downloads.
For example, the HTML element h2 specifies that the text contained within it is a level two heading. It has a lower level of importance than h1 headings, but a higher level of importance than h3 headings. This aspect of the h2 element is structural .
Customarily, headings are rendered in decreasing order of size, with h1 as the largest, because larger headings are usually interpreted to have greater importance than smaller ones. Headings are also typically rendered in a bold font in order to give them additional emphasis. The h2 element may be rendered in bold face, and in a font larger than h3 but smaller than h1 . This aspect of the h2 element is presentational .
Prior to CSS, document authors who wanted to assign a specific color, font, size, or other characteristic to all h2 headings had to use the HTML font element for each occurrence of that heading type.
Moreover, CSS can be used with XML, to allow such structured documents to be rendered with full stylistic control over layout, typography, color, and so forth in any suitable user agent or web browser.
CSS has its share of inconsistencies as well
CSS may at times be misused, particularly by the author of web documents. Some developers who are accustomed to designing documents strictly in HTML may overlook or ignore the enabling features of CSS. For instance, a document author who is comfortable with HTML markup that mixes presentation with structure may opt to use strictly embedded CSS styles in all documents. While this may be an improvement over using deprecated HTML presentational markup, it suffers from some of the same problems that mixed-markup HTML does; specifically, it entails a similar amount of document maintenance.
Discrepancies compared: CSS vs programming languages
CSS also shares some pitfalls common with programming languages. In particular, the problem of choosing appropriate names for CSS classes and identifiers may afflict CSS authors. In the attempt to choose descriptive names for CSS classes, authors might associate the class name with desired presentational attributes; for example, a CSS class to be applied to emphasized text might be named “bigred,” implying that it is rendered in a large red font.
While such a choice of naming may be intuitive to the document author, it can cause problems if the author later decides that the emphasized text should instead be green; the author is left with a CSS class called “bigred” that describes something that is green. In this instance, a more appropriate class name might have been “emphasized,” to better describe the purpose or intent of the class, rather than the appearance of elements of that class.
In a programming language, such a misuse might be analogous to using a variable name “five” for a variable which contains the value 5; however, if the value of the variable changes to 7, the name is no longer appropriate.
CSS in a nutshell
CSS is used by both the authors and readers of web pages to define colors, fonts, layout, and other aspects of document presentation. It is designed primarily to enable the separation of document structure (written in HTML or a similar markup language) from document presentation (written in CSS).
This separation provides a number of benefits, including improved content accessibility, greater flexibility and control in the specification of presentational characteristics, and reduced complexity of the structural content. CSS is also capable of controlling the document’s style separately in alternative rendering methods, such as on-screen in print, by voice (when read out by a speech-based browser or screen reader) and on braille based, tactile devices.
CSS allows complete and total control over the style of a hypertext document. The only way this can be illustrated in a way that gets people excited is by demonstrating what it can truly be, once the reins are placed in the hands of those able to create beauty from structure.
1 Dec
What is CSS ?
CSS or Cascading Style Sheets is a great tool to add a unique look to your web pages. CSS enhances fonts, colors, and even the spacing of your web pages. It is a useful tool to let you separate your HTML content from your style. For example, you can use your HTML file to create and organize the content, but all of the visual presentation including the background, fonts, colors, link effects, text formatting, and spacing are created with a CSS file.
Benefits of CSS
As discussed, CSS makes it easy for you to separate the style and layout of your HTML files from their informational content. This means you can determine the look of your site in one file, and change the whole site by modifying that single file. It also means you can make your HTML changes by accessing one file.
This structure provided by CSS also means that you can work with your web pages so that they look good on any browser. For example, a page on Mozilla can look very different than a page seen on internet explorer. CSS eliminates that difference.
CSS gives you more control over how your pages look because it is a more detailed mechanism than HTML. HTML wasn’t designed for style, it was designed for document structure. CSS was designed for style. This means it is easier for you as a business owner seeking brand development and recognition to define your “look” and give it a unique and consistent feel.
Users say that CSS also prints better than HTML documents. Important if visitors are accessing your content, which they hopefully are, printing it, and taking it with them or better yet – sharing it with their friends and associates. Additionally, the pages allow visitors to print the entire page as opposed to the partial pages that HTML often prints.
CSS decreases your page size significantly, making it easier for your visitors to load your site and all relevant graphics and copy. It also means that your web pages can be seen quickly and clearly with handheld browsers. This is huge because many people are now surfing the internet on their cell phones, smart phones, and PDAs. If your site doesn’t load quickly, chances are people are going to leave. If your site is quickly and clearly accessible – you may have a new customer! Additionally, it will take up less space on your server if you’re running close to your limit – and save you less money if you’re being charge by bandwidth. This is because CSS requires less code.
CSS enables you to position the code for your content at the top making your page search engine friendly. Properly marked up, HTML pages can easily found and properly categorized by search engines.
It is also fairly easy for anyone to learn because CSS already uses well-known coding elements and principals.
The benefits of CSS include making your web site:
• Faster to create
• Easier to maintain or change
• More adaptable to fit new and emerging technologies
• Compact
• Neater and cleaner in the HTML code
How do I use CSS ?
Cascading Style Sheets can be used in two ways – internally or externally. When used internally the CSS code is placed within the ‘head’ tags of each HTML file. The HTML code basically looks just like this:
<head>
<title></title>
<style type=”text/css”>
Place your CSS CONTENT HERE
</style>
</head>
<body>
Externally, your CSS code that would be placed in the HTML file is now placed in a separate file and linked to the location. The file type for the CSS code can be created with any text or HTML editor such as Notepad. Once created there are two ways you can link to your CSS file:
1. In the head section of every (X)HTML file, appearing as:
<head>
<title></title>
<link rel=”stylesheet” type=”text/css”onClick=”javascript:pageTracker._trackPageview(’/outgoing/article_exit_link’);” href=”style.css” mce_onClick=”javascript:pageTracker._trackPageview(’/outgoing/article_exit_link’);” href=”style.css” />
</head>
<body>
2. Using the @import method, appearing as:
<head>
<title></title>
<style type=”text/css”> @import url(Path to stylesheet.css) </style>
</head>
<body>
So what method do you choose? That depends on what you need. For example, internal is used when a designer needs to style only one page, or different pages with different styles. Web page designers tend to prefer an external cascading style sheet. This is because, as noted earlier in the benefits list, you will only need to edit one CSS file to change the entire website. Webmasters also find external is better because they are easier to maintain, they’re more compact, and generally the appearance is easier to control and stylize.
Potential Concerns
Not all browsers can read CSS. This is a real concern; however, the percentage has decreased to the point where less than 1% of browsers are affected. What sites are affected? Older browser versions, created before CSS was standard, including Netscape 4.0. Because the vast majority of browsers are significantly newer than this, and because the World Wide Web Consortium has recommended the use of CSS, making it a widely acceptable and recognizable mechanism around the world, all concerns about using CSS are negligible.
Bottom Line
CSS is a tool that will make your web pages easier to organize and maintain, your website easier to change, your brand potentially stronger, your website more compact and easier to load, your search engine optimization will improve, oh and your pages will just look better. There really isn’t a reason to not experiment with CSS and integrate it into your web site. Once you begin using and designing with CSS, you’ll likely find building sites is more fun, faster, and they look amazing.
Want to launch, reinvent & grow your online biz dramatically? Discover a breakthrough membership site considered as the #1 source of supply for most hot-selling digital information products on the web. Go to http://www.surefirewealth.com and skyrocket your profits now!
13 May
Being a web designer, with a possible light case of ADD, i noticed that in the past I had used a different organizational method for my css files on almost every website I built. Hell, in some cases there was no organization what-so-ever.
As is often the case when you repeat a task over and over, I got better at organizing my files to make them easier for me to build and edit. I am going to share some of my organizational tips with you here today, and hopefully they will save you some time in the long run. (more…)
14 Apr
How do I center a CSS Div Horizontally? This is a question I hear from my readers in both emails, and comments somewhat frequently. There are already at least 10 (probably more like 100) other websites that tell you how to do this, but the question still comes up.
So being that I am such a nice guy, I figured I would write a blog post about the subject instead of just answering emails, and comments all day.
The code to center a div horizontally is really simple. It should be noted that you MUST have a fixed width div for this to work.
#div-container {
width:800px;
margin: 0 auto;
}
The margin CSS values I used above were written in CSS Shorthand, but you could also write the code without shorthand, in which case the code would look like this:
#div-container {
width:800px;
margin: 0 auto 0 auto;
}
Now just insert a DIV into your html with the ID given a value of div-container like is shown in the example below.
<div id=”div-container”>
Place your newly centered div’s content here
</div>
So that’s the long and short of it. Pretty simple and upfront. Hopefully I won’t get any more emails about this, but as always feel free to email or comment if you have any questions or comments.
14 May
Need some Web 2.0 style buttons? So did I, so I made a few different versions for the redesign of my website ITS Net Services. I only ended up using 1 of them, so I figured I might as well give the rest away.
They all come in 1 Photoshop file and include all the buttons separated in their own folders.
(more…)
11 Feb
I’m back again with more FREE CSS Containers to download. Unlike my previous set of FREE Content Boxes, these boxes were designed to be able to stretch as wide as need be. Simply adjust the size of the container css value to the width you need, or remove it completely to have it auto adjust its width. I have also remade the original boxes in this auto stretch way.
(more…)
29 Jan
I have created a selection of FREE to download CSS Content Boxes. These were designed to be used for side bar areas, but if you know your photoshop decently enough you can easily modify the headers to stretch as wide as you need. These CSS Content Boxes are all 100% XHTML & CSS Validated.
Black Content Box |
Blue Content Box |
|
![]() |
![]() |
|
Green Content Box |
Pink Content Box |
|
![]() |
![]() |
|
Purple Content Box |
Orange Content Box |
|
![]() |
![]() |
|
17 Jan
Over at W3 Schools, they have setup a small CSS Quiz to test your skills. It’s all pretty basic stuff.
I got 19 out of 20 which resulted in a 95%, but I claim shenanigans! One of the questions was worded to be a little tricky and if you don’t pay attention and read carefully, you might just have the same outcome. I could take it again, but I know I would get a 100% since I know what I read wrong.
So go over to the site here:
And test your skills!
Feel free to post your results here..
So it seems more and more people are trying to cheat this test by searching for the answers on Google. I mean, are you serious? Why bother cheating on a test like this? You aren’t being graded by a teacher. This is just a test to see how much you know. If you are failing the test, it’s obvious that you need to learn a little more. The test is just about the easiest test on CSS I have seen. Just today alone I received about 5 new hits from Google with the search term of CSS Quiz Answers.
I hope you people out there are just trying to learn, and not cheat.
On a side note, I will be putting together my own CSS Quiz in the very near future. And it will get harder as the test goes on, to really test your skills.
18 Dec
The web, such a bountiful source of free information. The really is no limit to the amount of information you can stumble upon and consume, and completely free no less!
After years and years of being a web designer, I have gathered quite a collection of links to websites that offer me unlimited amounts of css tips, tricks, and free downloads. I have decided to share my list with the rest of you. I hope you enjoy them, as much as I do.
This page will be updated regularly
An amazing archive of numerous free css based scripts, menus, layouts and much much more. Some of my personal favorites are the ones that are inside the Dynamic category.
Free CSS layouts to download
Of all the LightBox scripts, I think this is so far my favorite. It supports video, flash, external websites, forms, inline content (divs) and of course images. And it also looks amazing as well. Definitely a highly recommended script.
I really like this lightbox script. It might be in contest for my favorite lightbox script with the LightWindow one above. Best thing about this one though, is that its html will validate, which lets face it is increasingly important these day.
This is yet another script that can be used to overlay image on top of the current pag. It is very similar to Lightbox, Thickbox, and Greybox.
Before I get to the bad stuff, I will talk about the good parts about the script. The interface is quite nice looking, with white rounded corners and borders. The animation effect is also quite smooth and nice to look at.
However, I have tested this script on both IE6, and FF2 and I must say that it works better on IE6. On Firefox the animation is a little bit jittery, and gives a very strange effect outside of the borders. It almost looks like a magnifying glass is being put over the outside edge for a quick second, but after the animation is over, it looks great!. I suspect this is a bug that will be worked out in the near future. So defintely don’t hesitate to try this script out for yourself!
Facebox is a jQuery-based, Facebook-style lightbox which can display images, divs, or entire remote pages.It’s simple to use and easy on the eyes. Download the tarball, view the examples, then start enjoying the curves.
Lightbox is a very simple script that can be used to overlay an image on top of the current page to keep users from being linked to other pages. It is an exceptionally clean way to show off your pictures, designs, and more.
Another version of the Lightbox script. This version adds support for more than just images, you can include iFrames, div’s and many other text based pieces of content.
Yet another version of the Lightbox script. This one is probably one of the most well rounded versions I have seen. You can display external pages in the pop ups, and the gallery setup is just plain beautiful.
This is one of the best incarnations of the Lightbox scripts I have seen so far. I am very impressed with this one, and suggest trying it out. Lightbox that supports images, flash, video, mp3s, html.
Highslide JS is an open source JavaScript software, offering a Web 2.0 approach to popup windows. It streamlines the use of thumbnail images and HTML popups on web pages.
DHTML Goodies has a high quality assortment of CSS / DHTML / AJAX scripts all available to download for free.
Think you need images to have gradients in your designs? So did I, at least I used to until a friend of mine told me about this website.