CSS Moves into the Future

CSS Moves into the Future

Getting to Know CSS3

CSS3 is the name for the next wave of changes and additions to the CSS “core.” The core is most of the features described in this book, which are available in Internet Explorer 6 and many of the minor browsers as well.

CSS3 has been in committee for several years. The first few working drafts came out in early 2001. Those involved announced that instead of attempting a sweeping new version, they would roll out “modules” from time to time. Some of the recommendations have begun to be supported in browsers already, and other recommendations are likely to take years to even be formally proposed.

Working with Mozilla-supported CSS3 features

Of the minor browsers, Mozilla’s Firefox seems to be the most interested in adopting CSS3 features. It permits the use of the new attribute substring selectors (*, $, and ^) to allow matches to parts of words in attributes. For example, say that you want to indicate to viewers that a particular link is to an Active Server Page (Active Server Page filenames end in. asp). Use the $ to indicate that the substring .asp is at the end of your target. This rule makes all links to any page ending in .asp become red.

Discovering False Pseudo-Classes

I call them false pseudo because the double-negative applies. These are true classes. They’re not fake. They often do a useful job. So, what are these “pseudo” classes?

To understand the idea of pseudo-classes, first review what a CSS class is: It’s a way to modify a selector, as an image selector. The class name acts as an adjective. Imagine that you want some of the images on your site to be framed in blue. (If you wanted all the images thus framed, you could just define a style for the image selector, without having to create a class. That way, all images would get the blue frame.) But you want only some images framed. So you create a class. It’s as if you make up a new category of the image that you decide to identify as the framed image.

Hyperlink formatting with pseudo-classes

Here’s an example of a useful CSS pseudo-element. Displaying different kinds of hyperlinks in different colors frequently helps the viewer to navigate your page. So, the good, busy people involved with CSS committees decided to create some built-in (pseudo) classes to handle this very common need.

Hovering with pseudo-classes

You should feel free to experiment by using these pseudo-classes with elements other than it was originally designed for. In general, CSS wisely tries to allow you to use most of its features with most HTML elements. Why restrict designers with artificial limitations? Why not let them fool around with the various features and discover new ways to exploit CSS?

Hovering is a particularly interesting feature because in its own cheap way it mimics scripting. (I describe it as cheap because you don’t have to do any programming to get a Web page to react to the user’s mouse.) The user hovers the mouse pointer above something with a hover pseudo-class, and whammy, something happens to the style. At least, that’s the theory.

Employing Fake Pseudo-Elements

Guess what? The CSS folks have come up with another category of pseudo called the pseudo-element. But who cares? I can see no distinction between pseudo-classes and pseudo-elements, although I’ve read and researched and pondered. W3.org “explains” the distinction here.

Nope. Just know that these various pseudo-whatever’s exist in case you ever want to use one of them. It’s sort of like a car: You can drive just fine without knowing the genus of all the bugs hitting your window.

Last Word

I suggest you forget about this button and check box pseudo-classes unless you have some strange requirements for your user input. Just let the controls do their thing automatically: visually cueing the user with dots or checks when the control is clicked. Anything that you add by using a style is probably overkilled and violates the visual conventions of Windows. Violating conventions often simply confuses and annoys people who, over the years, have gotten used to the way things work in Windows. Nonetheless, some of the worker bees at Microsoft sometimes decide that they know best and come up with bizarre modifications that confound the rest of us. Try, for example, to find the menus in Windows Media Player version 10. The usual File, Options.

About admin

Check Also

Useful Apps For Effective Work With Windows 10

Windows 10, one of the most successful Microsoft products, has a lot to offer to …

Leave a Reply

Your email address will not be published.