官术网_书友最值得收藏!

Inline styling

One way of defining CSS rules for your HTML elements is through the use of inline styles. This method is not recommended because it mixes style with presentation and is difficult to maintain. It is an option though in some cases where you only need to define a very limited set of CSS rules. To use inline styles, simply place the style attribute inside the relevant HTML tag:

<p style="color:sienna;margin-left:20px">This is a paragraph.</p>

Now let's put some emphasis on the cascading of cascading style sheets. As you now know, styles can be defined in external style sheets, internal style sheets, or inline. There is a fourth level that we didn't discuss which is the browser default. You don't have any control over that though. In CSS, an inline style has the highest priority, which means that it will override a style defined in an internal style sheet, an external style sheet, or the browser default. If an inline style is not defined then any style rules defined in an internal style sheet would take precedence over styles defined in an external style sheet. The caveat here is that if a link to an external style sheet is placed after the internal style sheet in HTML <head>, the external style sheet will override the internal sheet!

主站蜘蛛池模板: 宜良县| 乐清市| 正镶白旗| 潜江市| 邵阳市| 长垣县| 屯昌县| 汝南县| 九寨沟县| 沾益县| 贡嘎县| 九寨沟县| 祁连县| 洪江市| 娱乐| 古田县| 江油市| 长治县| 合川市| 家居| 南昌市| 麻城市| 高陵县| 呼伦贝尔市| 河西区| 沧州市| 阿拉善左旗| 民乐县| 精河县| 印江| 都安| 泸定县| 和平县| 内江市| 大田县| 金湖县| 兰坪| 澄迈县| 阳城县| 自贡市| 鲜城|