search
HomeWeb Front-endHTML Tutorial《HTML5与CSS3基础教程》学习笔记 Three Day - 逆光飞翔23

第十一章

1、  box-sizing:border-box(让宽度和高度包含内边距和边框)

2、  clear让后面的元素显示在浮动元素的后面

3、  z-index只对只对绝对、固定、相对定位的元素有效

4、  vertical-aligh只用于行内元素

baseline/middle/sub/super/text-top/text-bottom/top/bottom/百分比/值

第十二章

1、 

and (min-width/max-width/resolution:value)” href=”” />

2、 

第十三章

1、

<span style="color: #800000;"> body</span>{<span style="color: #ff0000;">

font-family</span>:<span style="color: #0000ff;">’ pt_sansregular’</span>;

}<span style="color: #800000;">

@font-face</span>{<span style="color: #ff0000;">

 font-family</span>:<span style="color: #0000ff;"> 'pt_sansregular'</span>;<span style="color: #ff0000;">
src</span>:<span style="color: #0000ff;"> url('PTS55F-webfont.eot')</span>;<span style="color: #ff0000;">
src</span>:<span style="color: #0000ff;"> url('PTS55F-webfont.eot?#iefix') format('embedded-opentype'),
url('PTS55F-webfont.woff') format('woff'),
url('PTS55F-webfont.ttf') format('truetype')</span>;<span style="color: #ff0000;">
font-weight</span>:<span style="color: #0000ff;"> normal</span>;<span style="color: #ff0000;">
font-style</span>:<span style="color: #0000ff;"> normal</span>;

}

 

第十四章

 

1、  渐变背景

1)        默认情况下,线性渐变是从上往下渐变的, 因此在属性值中不需要指定 to bottom

<span style="color: #800000;">background: aqua;//要放在前面

background: linear-gradient(to top right,blue,green);

background: linear-gradient(90deg,blue,green);(起点:中上线)</span>

 

2)        径向渐变

<span style="color: #008000;">/*</span><span style="color: #008000;"> 默认 </span><span style="color: #008000;">*/</span><span style="color: #800000;">
background: red;
background: radial-gradient(yellow, red);

 background: radial-gradient(at top,yellow, red);

 background: radial-gradient(closest-side at 70px 60px, yellow, lime, red);
background: radial-gradient(30px 30px at 65% 70%, yellow, lime, red)</span>

 

 

2、  元素设置不透明度

  • opacity:value

3、  生成内容的效果

<span style="color: #800000;">:before和:after

.more:after </span>{<span style="color: #ff0000;">
content</span>:<span style="color: #0000ff;"> " »"</span>;
}

 

4、  使用 sprite 拼合图像

sprite 就是通过 content:" "; 生成的空格的背景图像。将其设置为display: block;,从而可以设置与图标大小匹配的高度和宽度

<span style="color: #800000;">.icon:before </span>{<span style="color: #ff0000;">
background-image</span>:<span style="color: #0000ff;"> url(sprite.png)</span>;<span style="color: #ff0000;">
content</span>:<span style="color: #0000ff;"> " "</span>;<span style="color: #ff0000;">//-------------------------------------------------
display</span>:<span style="color: #0000ff;"> block</span>;<span style="color: #ff0000;">//
height</span>:<span style="color: #0000ff;"> 16px</span>; <span style="color: #008000;">/*</span><span style="color: #008000;"> 图标高度 </span><span style="color: #008000;">*/</span><span style="color: #ff0000;">
position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;">
width</span>:<span style="color: #0000ff;"> 16px</span>; <span style="color: #008000;">/*</span><span style="color: #008000;"> 图标宽度 </span><span style="color: #008000;">*/</span>
}<span style="color: #800000;">
a[href$=".xls"]:before </span>{<span style="color: #ff0000;">
background-position</span>:<span style="color: #0000ff;"> -17px 0</span>;
}<span style="color: #800000;">
a[href$=".docx"]:before </span>{<span style="color: #ff0000;">
background-position</span>:<span style="color: #0000ff;"> -34px 0</span>;
}

 

第十五章

1、    自定义标记

<span style="color: #800000;">ul</span>{<span style="color: #ff0000;">

   list-style</span>:<span style="color: #0000ff;"> none</span>;<span style="color: #ff0000;">

   margin-left</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;">

padding-left</span>:<span style="color: #0000ff;"> 0</span>;

}<span style="color: #800000;">

li</span>{<span style="color: #ff0000;">

   background</span>:<span style="color: #0000ff;"> url(../img/done_square.png) no-repeat 0 .1em</span>;<span style="color: #ff0000;">

   padding-left</span>:<span style="color: #0000ff;"> 15px</span>;<span style="color: #ff0000;">

   line-height</span>:<span style="color: #0000ff;"> 24px</span>;

}

 

2、    选择列表的起始编号

1)         整个列表编码初始值ol里面增加start=”n”

2)         修改有序列表某个列表编码,影响接下来的列表,在li里面增加value=”n”

3、    控制标记的位置

list-style-position=”inside/outside(默认)”

4、    下拉式导航

HTML:

<span style="color: #0000ff;"><span style="color: #800000;">nav </span><span style="color: #ff0000;">role</span><span style="color: #0000ff;">="navigation"</span><span style="color: #0000ff;">></span>

         <span style="color: #0000ff;"><span style="color: #800000;">ul </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="nav"</span><span style="color: #0000ff;">></span>

            <span style="color: #0000ff;"><span style="color: #800000;">li</span><span style="color: #0000ff;">><span style="color: #800000;">a </span><span style="color: #ff0000;">href</span><span style="color: #0000ff;">="/"</span><span style="color: #0000ff;">></span>Home<span style="color: #0000ff;"></span><span style="color: #800000;">a</span><span style="color: #0000ff;">></span><span style="color: #800000;">li</span><span style="color: #0000ff;">></span>

            <span style="color: #0000ff;"><span style="color: #800000;">li</span><span style="color: #0000ff;">><span style="color: #800000;">a </span><span style="color: #ff0000;">href</span><span style="color: #0000ff;">="#"</span><span style="color: #0000ff;">></span>Products<span style="color: #0000ff;"></span><span style="color: #800000;">a</span><span style="color: #0000ff;">></span>

                <span style="color: #0000ff;"><span style="color: #800000;">ul </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="subnav"</span><span style="color: #0000ff;">></span>

                   <span style="color: #0000ff;"><span style="color: #800000;">li</span><span style="color: #0000ff;">><span style="color: #800000;">a </span><span style="color: #ff0000;">href</span><span style="color: #0000ff;">="#"</span><span style="color: #0000ff;">></span>Phones<span style="color: #0000ff;"></span><span style="color: #800000;">a</span><span style="color: #0000ff;">></span><span style="color: #800000;">li</span><span style="color: #0000ff;">></span>

                   <span style="color: #0000ff;"><span style="color: #800000;">li</span><span style="color: #0000ff;">><span style="color: #800000;">a </span><span style="color: #ff0000;">href</span><span style="color: #0000ff;">="#"</span><span style="color: #0000ff;">></span>Accessories<span style="color: #0000ff;"></span><span style="color: #800000;">a</span><span style="color: #0000ff;">></span><span style="color: #800000;">li</span><span style="color: #0000ff;">></span>

                <span style="color: #0000ff;"></span><span style="color: #800000;">ul</span><span style="color: #0000ff;">></span>

            <span style="color: #0000ff;"></span><span style="color: #800000;">li</span><span style="color: #0000ff;">></span>

            <span style="color: #0000ff;"><span style="color: #800000;">li</span><span style="color: #0000ff;">><span style="color: #800000;">a </span><span style="color: #ff0000;">href</span><span style="color: #0000ff;">="#"</span><span style="color: #0000ff;">></span>Support<span style="color: #0000ff;"></span><span style="color: #800000;">a</span><span style="color: #0000ff;">></span>

                <span style="color: #0000ff;"><span style="color: #800000;">ul </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="subnav"</span><span style="color: #0000ff;">></span>

                   <span style="color: #0000ff;"><span style="color: #800000;">li</span><span style="color: #0000ff;">><span style="color: #800000;">a </span><span style="color: #ff0000;">href</span><span style="color: #0000ff;">="#"</span><span style="color: #0000ff;">></span>Community Forum<span style="color: #0000ff;"></span><span style="color: #800000;">a</span><span style="color: #0000ff;">></span><span style="color: #800000;">li</span><span style="color: #0000ff;">></span>

                   <span style="color: #0000ff;"><span style="color: #800000;">li</span><span style="color: #0000ff;">><span style="color: #800000;">a </span><span style="color: #ff0000;">href</span><span style="color: #0000ff;">="#"</span><span style="color: #0000ff;">></span>Contact Us<span style="color: #0000ff;"></span><span style="color: #800000;">a</span><span style="color: #0000ff;">></span><span style="color: #800000;">li</span><span style="color: #0000ff;">></span>

                   <span style="color: #0000ff;"><span style="color: #800000;">li</span><span style="color: #0000ff;">><span style="color: #800000;">a </span><span style="color: #ff0000;">href</span><span style="color: #0000ff;">="#"</span><span style="color: #0000ff;">></span>How-to Guides<span style="color: #0000ff;"></span><span style="color: #800000;">a</span><span style="color: #0000ff;">></span><span style="color: #800000;">li</span><span style="color: #0000ff;">></span>

                <span style="color: #0000ff;"></span><span style="color: #800000;">ul</span><span style="color: #0000ff;">></span>

            <span style="color: #0000ff;"></span><span style="color: #800000;">li</span><span style="color: #0000ff;">></span>

            <span style="color: #0000ff;"><span style="color: #800000;">li</span><span style="color: #0000ff;">><span style="color: #800000;">a </span><span style="color: #ff0000;">href</span><span style="color: #0000ff;">="#"</span><span style="color: #0000ff;">></span>About Us<span style="color: #0000ff;"></span><span style="color: #800000;">a</span><span style="color: #0000ff;">></span><span style="color: #800000;">li</span><span style="color: #0000ff;">></span>

         <span style="color: #0000ff;"></span><span style="color: #800000;">ul</span><span style="color: #0000ff;">></span>

         <span style="color: #008000;"><!--</span><span style="color: #008000;"> end .nav </span><span style="color: #008000;">--></span>

      <span style="color: #0000ff;"></span><span style="color: #800000;">nav</span><span style="color: #0000ff;">></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>

 

CSS:

<span style="color: #008000;">/*</span><span style="color: #008000;"> 子菜单的默认状态 </span><span style="color: #008000;">*/</span><span style="color: #800000;">

.nav .subnav </span>{<span style="color: #ff0000;">left</span>:<span style="color: #0000ff;"> -999em</span>;<span style="color: #008000;">/*</span><span style="color: #008000;"> 将子菜单移出屏幕 </span><span style="color: #008000;">*/</span><span style="color: #ff0000;">position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;">z-index</span>:<span style="color: #0000ff;"> 1000</span>;}<span style="color: #800000;">

a,a:hover </span>{<span style="color: #ff0000;">text-decoration</span>:<span style="color: #0000ff;"> none</span>;}<span style="color: #800000;">

ul </span>{<span style="color: #ff0000;">list-style</span>:<span style="color: #0000ff;"> none</span>;<span style="color: #ff0000;">margin-left</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;">padding-left</span>:<span style="color: #0000ff;"> 0</span>;}<span style="color: #800000;">

.nav </span>{<span style="color: #ff0000;">background</span>:<span style="color: #0000ff;"> #fff</span>;}<span style="color: #800000;">

.nav>li </span>{<span style="color: #ff0000;">float</span>:<span style="color: #0000ff;"> left</span>;<span style="color: #ff0000;">padding-right</span>:<span style="color: #0000ff;"> 10px</span>;}<span style="color: #800000;">

.nav ul </span>{<span style="color: #ff0000;">background</span>:<span style="color: #0000ff;"> #fff</span>;<span style="color: #ff0000;">z-index</span>:<span style="color: #0000ff;"> 1000</span>;<span style="color: #ff0000;">border-bottom</span>:<span style="color: #0000ff;"> 1px solid #fff</span>;}<span style="color: #800000;">

.nav ul li </span>{<span style="color: #ff0000;">border-bottom</span>:<span style="color: #0000ff;"> 1px solid gray</span>;<span style="color: #ff0000;">line-height</span>:<span style="color: #0000ff;"> 24px</span>;<span style="color: #ff0000;">padding</span>:<span style="color: #0000ff;"> 2px 5px</span>;}

<span style="color: #008000;">/*</span><span style="color: #008000;"> 当鼠标停留在父元素li上时子菜单的状态 </span><span style="color: #008000;">*/</span><span style="color: #800000;">

.nav li:hover .subnav </span>{<span style="color: #ff0000;">left</span>:<span style="color: #0000ff;"> auto</span>;<span style="color: #008000;">/*</span><span style="color: #008000;"> 让子菜单回到自然状态 </span><span style="color: #008000;">*/</span>}

 

Statement
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
HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The Role of HTML: Structuring Web ContentThe Role of HTML: Structuring Web ContentApr 11, 2025 am 12:12 AM

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTML and Code: A Closer Look at the TerminologyHTML and Code: A Closer Look at the TerminologyApr 10, 2025 am 09:28 AM

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS, and JavaScript: Essential Tools for Web DevelopersHTML, CSS, and JavaScript: Essential Tools for Web DevelopersApr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor