Currently common front-end pages are composed of HTML+css+JavaScript.
1. HTML:
Role: define the content of the page rendering
HTML is a language used to describe web pages.
- HTML stands for Hypertext Markup Language ( H yper T ext Markup Language )
- HTML is not a programming language but a markup language
- A markup language is a set of markup tags
- HTML uses markup tags to describe web pages
Language feature editor:
Hypertext Markup Language document production is not very complicated, but it has powerful functions and supports the embedding of files in different data formats. This is one of the reasons why the World Wide Web (WWW) is popular. Its main features are as follows:
- Simplicity: The hypertext markup language version upgrade adopts a superset method, which makes it more flexible and convenient.
- Extensibility: The wide application of hypertext markup language brings requirements such as enhanced functions and additional identifiers. Hypertext markup language adopts the method of subclass elements to guarantee system expansion.
- Platform independence: Although personal computers are popular, there are many people who use other machines such as MAC. Hypertext Markup Language can be used on a wide range of platforms, which is another reason for the prevalence of the World Wide Web (WWW).
- Versatility: In addition, HTML is the universal language of the Internet, a simple and universal all-purpose markup language. It allows web producers to create complex pages that combine text and pictures, and these pages can be browsed by anyone else on the Internet, no matter what type of computer or browser is used.
The essence of web pages is hypertext markup language, and powerful web pages can be created by using other web technologies (such as: scripting language, common gateway interface, components, etc.) in combination. Therefore, Hypertext Markup Language is the basis of World Wide Web (Web) programming, that is to say, the World Wide Web is built on the basis of hypertext. Hypertext Markup Language is called Hypertext Markup Language because the text contains so-called "hyperlink" points.
HTML tags
HTML markup tags are often referred to as HTML tags (HTML tag).
- HTML tags are keywords surrounded by angle brackets, such as <html>
- HTML tags usually come in pairs, such as <b> and </b>
- The first tag in a tag pair is the opening tag and the second tag is the closing tag
- Opening and closing tags are also known as opening and closing tags
HTML document = web page
- HTML document describing the web page
- HTML documents contain HTML tags and plain text
- HTML documents are also known as web pages
The job of a web browser is to read HTML documents and display them as web pages. Browsers don't display HTML tags, but use tags to explain the content of the page:
<html>
<body>
<h1>我的第一个标题</h1>
<p>我的第一个段落。</p>
</body>
</html>
1. Introduction to css
CSS is the abbreviation of Cascading Style Sheets, which is called cascading style sheets in Chinese, which is used to control the performance of web page data, and can separate the performance of web pages from the data content
2. Four import methods of css
2.1. Inline style
The inline style is to set the CSS style in the style attribute of the markup. This method does not reflect the advantages of CSS and is not recommended.
01 02 |
|
2.2. Embedded
Embedded is to write the CSS style centrally in the <style></style> tag pair of the <head></head> tag pair of the web page. The format is as follows:
01 02 03 04 05 06 07 08 09 |
|
2.3. Link type
Introduce a .css file into an HTML file (commonly used)
01 02 |
|
2.4. Imported
Import an independent .css file into the HTML file. The import type uses CSS rules to import external CSS files. The <style> tag is also written in the <head> tag. The syntax used is as follows:
01 02 03 04 05 |
|
Special attention: the import type will load the CSS file after the entire webpage is loaded, so this leads to a problem. If the webpage is relatively large, it will first display the unstyled page, and after a flash, the style of the webpage will appear. This is a flaw inherent in imports. The difference between the link type and the import type is that it will load the CSS file before loading the main body of the web page file, so the displayed web page will have a styled effect from the beginning, and it will not first display the unstyled web page like the import type , and then display a styled web page, which is the advantage of linking.
Three, css selector (selector)
"Selector" indicates the object of the "style" in {}, that is, which elements in the web page the "style" applies to
3.1. Basic selector
1) * Universal element selector, match any element
01 02 03 |
|
2) Label selector, matching all elements using a certain label
01 |
|
3) id selector
01 02 03 04 05 06 |
|
4) class selector
01 02 03 |
|
3.2. Combined selector
01 02 03 04 |
|
Note the nesting rules :
- A block-level element can contain inline elements or some block-level elements, but an inline element cannot contain block-level elements, it can only contain other inline elements.
- There are a few special block-level elements that can only contain inline elements, not block-level elements . Such as h1, h2, h3, h4, h5, h6, p, dt
- li can contain div
- Block-level elements juxtapose block-level elements, and inline elements juxtapose inline elements.
Example one:
01 02 03 04 05 06 07 08 |
|
Reference address:
JavaScript:
3.3, attribute selector
01 02 03 04 05 06 |
|
Example:
01 02 03 04 05 06 07 08 09 10 11 12 13 |
|
3.4. Pseudo-classes
CSS pseudo-classes are used to add some special effects to selectors.
01 02 03 04 05 06 07 08 09 10 11 12 |
|
Example:
before after pseudo-class:
01 02 03 04 05 |
|
Four, css priority and inheritance
4.1, css priority
The so-called CSS priority refers to the order in which CSS styles are parsed in the browser.
01 02 03 04 05 06 07 |
|
Examples of priorities:
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
4.2, css inheritance
Inheritance is a major feature of CSS, which relies on the ancestor-descendant relationship. Inheritance is a mechanism that allows styles to be applied not only to a particular element, but also to its descendants. For example a color value defined by BODY will also be applied to the text of the paragraph.
01 |
|
This text all inherits the color defined by the body {color:red;} style. However, the weight of CSS inheritance is very low, which is 0 lower than the weight of ordinary elements. It is found that only adding a color value can override the style color it inherits. It can be seen from this: any rule declared explicitly can override its inherited style. Furthermore, inheritance is such an important part of CSS that we don't even have to think about why it works like this, but CSS inheritance is also limited. Some attributes cannot be inherited, such as: border, margin, padding, background, etc.
4.3. Additional instructions
1、文内的样式优先级为1000,所以始终高于外部定义。这里文内样式指形如<div style="color:red>blah</div>的样式,而外部定义指经由<link>或<style>卷标定义的规则。
2、有!important声明的规则高于一切。
3、如果!important声明冲突,则比较优先权。
4、如果优先权一样,则按照在源码中出现的顺序决定,后来者居上。
5、由继承而得到的样式没有specificity的计算,它低于一切其它规则(比如全局选择符*定义的规则)。
01 02 03 |
|
五、css常用属性
5.1、颜色属性
01 02 03 04 05 06 07 |
|
5.2、字体属性
01 02 03 04 05 06 07 |
|
5.3、背景属性
01 02 03 04 05 06 07 08 09 |
|
5.4、文本属性
01 02 03 04 05 06 07 08 09 |
|
示例:
5.5、边框属性
01 02 03 04 |
|
示例:
5.6、列表属性
01 02 03 04 05 06 |
|
5.7、 display属性
display属性有:none,block,inline,inline-block
display:inline-block可做列表布局,其中的类似于图片间的间隙小bug可以通过如下设置解决
最后: 为了回馈铁杆粉丝们,我给大家整理了完整的软件测试视频学习教程,朋友们如果需要可以自行免费领取 【保证100%免费】
软件测试面试文档
我们学习必然是为了找到高薪的工作,下面这些面试题是来自阿里、腾讯、字节等一线互联网大厂最新的面试资料,并且有字节大佬给出了权威的解答,刷完这一套面试资料相信大家都能找到满意的工作。