Приглашаем посетить
Романтизм (19v-euro-lit.niv.ru)

Q&A

Previous Page
Table of Contents
Next Page

Q&A

Q1:

I've seen style sheets that define style rules that begin with #. What are those, and can I use them in my style sheets?

A1:

Style rules that begin with # are called ID classes, and they allow you to create a style rule that is applied to elements via the id attribute. Although you can certainly create and use ID classes if you want, they are discouraged because they tempt you to set the id attribute of multiple elements to the same value, which isn't allowed in XHTML. XHTML requires every id attribute in a page to be unique, which means you can never use an ID class with more than one element. Knowing this, it's a better idea to use a normal style class and then have the option of using it with multiple elements via the class attribute if you so choose.

Q2:

Sometimes when I set the a:hover pseudoclass, I notice that the page flickers and shakes in the browser as I drag the mouse over a link. What's going on?

A2:

It is possible, in fact easy, to set an a:hover pseudoclass that requires the browser to constantly redraw the page in response to a mouse hover. This typically happens if the link changes font size, although it can sometimes happen even if you're just changing the text from normal to bold. This is because the link's overall size changes in response to a hover event, which means that the browser must recalculate the location of everything on the page below the link, and then redraw the results. The solution is to try to not change a link in response to a hover event such that its size changes.


Previous Page
Table of Contents
Next Page