Percentage values refer to the width of the parent element.
As you can see, this property accepts any length value or apercentage. That's all. So if you want allH1 elements to have 10 pixels of padding on allsides, it's this easy, as the result shown in Figure 7-56 makes clear:
H1 {padding: 10px; background-color: silver;}
|
CSS Tutorials |
CSS TutorialsWelcome to the CSS Tutorials. In this section we cover Cascading Style Sheets, the powerful supplement to HTML that allows you complete control over the look of your websites. We'll show you how to create Cascading Style Sheets, and some of the cool tricks you can achieve with them. |
For Beginners...Introduction to CSS CSS Units For Intermediate Users...Controlling Background Images and Colours Controlling Fonts with CSS Controlling Text Appearance with CSS Making Lists Look Nicer with CSS For Advanced Users...CSS Positioning |
space is still there because the element is still part of thedocument's layout. We just can't see it.WARNING
Navigator 4 does not apply colors to form elements, but setting thecolors for form elements does work in Internet Explorer 4 and 5, andOpera 3.5 and later.
Note too that it's possible to set the descendant element of ahidden element to be visible.This would cause the element to appear wherever it normally would,despite the fact that the ancestor (and possibly the siblings) isinvisible. In order to do so, you would need to explicitly declarethe descendant element to be visible, sincevisibility is inherited. Thus:should be affected by the property, although not all user agents cando this correctly. Also,background-color is not inherited. Its defaultvalue istransparent,which makes sense; if an element doesn't have a defined color,then its background should be transparent so that the background ofits ancestor elements will be visible. Imagine for a moment that the