Inheritance of styles:

Source: Internet
Author: User

<! DOCTYPE html>

<meta charset= "Utf-8"/>
Inheritance of <title> styles </title>
<style>
Body {
font-size:30px;
}
p{
color:red;
}
</style>

<body>
<!--
Inheritance of styles:
Like a son can inherit a father's inheritance, in CSS, the style of the ancestor element can also be inherited by his descendant elements,
With inheritance, you can set some basic styles to ancestor elements, so that all descendant elements will automatically inherit those styles.

However, not all styles will be inherited by the quilt element, such as: background-related styles are not related to the style of the inheritance border related style, etc.
(We'll find out when we look at the reference manual.) But the default color of the background color is: transform transparent, so he is not inherited)
-
<div>
<p style= "Background:yellow;" >
I am a P tag in the text
<span> I am the text in span </span>
</p>
</div>
<span> I'm a span</span> outside the P element.
</body>

Inheritance of styles:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.