Home > Web Front-end > Front-end Q&A > Which html attribute can define inline styles

Which html attribute can define inline styles

青灯夜游
Release: 2023-01-11 09:20:42
Original
7843 people have browsed it

html's style attribute can define inline styles. The style attribute of the tag is used to specify the inline style (inline style) of the element. You only need to add the style attribute to the tag and set the attribute value. The syntax "".

Which html attribute can define inline styles

The operating environment of this tutorial: Windows7 system, CSS3&&HTML5 version, Dell G3 computer. The style attribute of

html can define inline styles.

The style attribute specifies the inline style of the element. The style attribute will override any global style settings, such as in the

Syntax:


    style_definition: one or more separated by semicolons CSS properties and values.
  • Example: Apply CSS inline styles to paragraphs,

    tags, tags, tags, and
    tags.
    <!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>
    Copy after login

    Rendering:


    Which html attribute can define inline stylesRelated recommendations: "

    css video tutorial

    "

The above is the detailed content of Which html attribute can define inline styles. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template