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

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!

主站蜘蛛池模板: 沧源| 南岸区| 隆回县| 乌拉特中旗| 汉阴县| 五家渠市| 囊谦县| 秦皇岛市| 大安市| 忻州市| 常熟市| 新昌县| 梁山县| 石屏县| 六盘水市| 龙州县| 兰溪市| 隆尧县| 巴青县| 东明县| 东宁县| 伽师县| 乐业县| 广昌县| 汶川县| 邵武市| 宝兴县| 荔波县| 宁都县| 翼城县| 天等县| 莱西市| 禄劝| 平利县| 盐边县| 阜城县| 娄底市| 车险| 武宁县| 荣昌县| 桃源县|