Write CSS _ about border where you may need to note page 1/2

Source: Internet
Author: User

Today I wrote a piece of CSS, and I suddenly thought of it. I 'd like to share it with you. We may have been used to the differences between padding in different browsers, but you may not have noticed this;

Let's start with a scenario, for example:
A yellow box with a width of PX, a small blue box with a width of PX on the left, and a red box with a width of PX on the right, right? Because 300 + 100 is exactly 400! Okay. Try it first!
I started to write (the header is omitted ): CopyCode The Code is as follows: <style>
# Yellow {width: 400px; Border: 1px solid # ff9900; Background: # ffcc99; float: Left ;}
# Blue {width: 300px; Height: 100px; Border: 1px solid # 0066ff; Background: #00 CCFF; float: Left ;}
# Red {width: 100px; Height: 100px; Border: 1px solid # ff3300; Background: # ff9900; float: Right ;}
</Style>

400px
<Div id = "yellow">
<Div id = "blue"> 300px </div>
<Div id = "red"> 100px </div>
</Div>

Let's take a look at the effect:Xmlns = "http://www.w3.org/1999/xhtml">


400px

300px100px
Related Article

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.