Java-css BASICS (1), java-css
Basic css knowledge (I)
1. css style:
There are four types of css styles to load:
1) external style
2) Internal Style
3) Intra-row style
4) import styles
<link href="layout.css" rel="stylesheet" type="text/css" />
In this form, css is written to a css file separately, and then linked in the source code as a link. It can be called not only on the current page, but also on other pages. It is the most common form.
<style>h2 { color:#f00;}</style>This form is an internal style table, which ends with <style> and </style> and is written in the head label of the source code. This style sheet is only valid for this page. It cannot act on other pages.
<P style = "font-size: 18px;"> internal style </p>
This style is marked as an in-row style in the label. The in-row style is only valid for the elements in the label. It is not recommended because it is not separated from the content.
@import url("/css/global.css");A link style is an external style table marked by @ import url. It is usually used in another style table. You can link the global style in the form of @ import url ("/css/global.css"), so that the code can be reused.
2. css priority:
1) The id priority is higher than the class
2) The following style overwrites the previous
3) the specified value is higher than the inheritance
4) The intra-row style is higher than the internal or external style
Summary: A single (id) is higher than a shared (class). If a single (id) is specified, it inherits
3. css box model composition:
To learn web standards, you must first understand the box model, which is the core of DIV layout. Traditional table formatting uses different sizes of tables and nested tables to locate typographical web content. After CSS formatting is used, the webpage is organized by nesting boxes and boxes of different sizes defined by CSS. The webpage code in this typographical mode is concise, its performance is separated from the content, which is easy to maintain and compatible with more browsers, such as PDA devices.
Why is it a box? First, let's talk about the attribute names that we often hear in web design: content, padding, border, and margin all have these attributes.
We can think of it as a box opened above the reality, and then look down from the top down, the border is equivalent to the thickness of the box, the content is relative to the space of the objects in the box, and fill it, it is equivalent to a bubble filled in the box for shockproof purposes. The boundary is equivalent to setting up a certain amount of space around the box for easy removal. This makes it easy to understand the box model.
Therefore, the width of the entire box model in the page is composed of the Left Border + Left fill + content + right fill + Right Border + right border, the width defined in the css style is only the width of the content.
The boundary here is also called the outer margin and the outer patch; the padding is also called the inner margin and the inner patch.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.