" tag in the HTML tag to add it. surrounded."/> " tag in the HTML tag to add it. surrounded.">
Home >Web Front-end >Front-end Q&A >Are css inline styles internal styles?
css inline styles are not internal styles. Inline style puts the CSS style directly in the tag within the line of code through the style attribute; while internal style writes the CSS style in the head of the web page source file by using the "
The operating environment of this tutorial: Windows 7 system, CSS3 version, Dell G3 computer.
Inline style
Inline style is to put the CSS style directly in the tag within the line of code, usually in the tag## In the #style attribute, since the inline style is directly inserted into the tag, it is the most direct way, and it is also the most inconvenient style to modify.
<!doctype html> <html> <head> <meta charset="utf-8"> <title>行内样式</title> </head> <body> <p style="background-color: #999900">行内元素,控制段落-1</p> <h2 style="background-color: #FF6633">行内元素,h2 标题元素</h2> <p style="background-color: #999900">行内元素,控制段落-2</p> <strong style="font-size:30px;">行内元素,strong 比 em 效果要强</strong> <div style="background-color:#66CC99; color:#993300; height:30px; line-height:30px;">行内元素,div 块级元素</div> <em style="font-size:2em;">行内元素,em 强调</em> </body> </html>The page demonstration effect is as shown below: In the above example, the inline style is determined by the style attribute of the HTML element, that is, the CSS code is placed in the style ="" is sufficient, and multiple CSS attribute values are separated by semicolons. For example, in the example of writing the
<div style="max-width:90%">行内元素,div 块级元素 </div>, we abandon the past HTML structure and style in The way to write them together is
.
The paragraph tag sets the background color to brown (
background-color: #999900), and the title <h2> tag sets the background color to red (</h2>
background-color : #FF6633).
background-color:#66CC99; color:#993300; height:30px; line-height:30px;), <em> tag sets the font size to relative units (</em>
font-size: 2em;).
tags have different contents, but use the same background color setting, but add two CSS inline attributes to set the background color background-color: #999900.
tag,
Internal styles
Internal styles are written by writing CSS at the head of the web page source file, that is, in and , it is surrounded by thestyle has a special attribute title. You can use title to set a title for different styles, and the viewer can set a title based on the title. Select different styles to achieve the effect of switching in the browser, but IE browser does not support this effect, and Firefox browser supports this effect.
(Learning video sharing: css video tutorial)
The above is the detailed content of Are css inline styles internal styles?. For more information, please follow other related articles on the PHP Chinese website!