Home Web Front-end HTML Tutorial CSS DIV Day 1_html/css_WEB-ITnose

CSS DIV Day 1_html/css_WEB-ITnose

Jun 24, 2016 pm 12:33 PM

CSS基础

 引用方法:

   基本语句结构:选择符{属性1:属性值1;属性2:属性值2}


   选择符:可以是HTML中任何的标识符,比如TR、TD、P、DIV、IMG甚至BODY都可以作为选


         择符。 选择符中的内容将会以大括号内属性值定义的格式来显示。


  除了选择符外,css还提供了几种选择器来让html调用css:


   群选择器:当几个元素样式属性一样时,可以共同调用一个声明,元素之间用逗号分隔,:


          p, td, li { font-size : 12px ; }


   id选择器:用CSS布局主要用层"div"来实现,而div的样式通过"id选择器"来定义。


           例如我们首先定义一个层


          


menubar is the style we want to use, and it is defined like this in the style sheet.


                                                                                                       Just add a # in front!


Category selector: If you want to use class="" to reference the style, then you need a category selector, which is


The method is to add a "." before the selector in the definition


For example: .14px {color: #f60;font-size:14px; }


At this point it can be called via .


---------------------------------- ----------------------------------


Basic The css calls have been reviewed. As long as you learn to write css and use these calling methods, you can play with web pages.

CSS has countless attributes. However, like any language, as long as you master 1/3 of the common attributes, you can achieve 90% of the functions.

So let’s learn the commonly used ones first.



Common CSS attributes:



Font attributes:


This is the most basic attribute, which mainly includes the following attributes:




Because the font attribute is often used, Tuotuo is familiar with it, so I will skip it for now.



Color and background properties




The usage is like this


Attribute: background Attribute value: |||||| 🎜> Not much to say here, once you know how to use it, just pick it up when you need it.




Text attribute:



This is different from the font attributes above. It involves typesetting: line spacing, character spacing, text decoration, etc., I have to Admit it, this is important.




Decorated hyperlink:


This is a relatively common CSS application. Yes, there are always so many hyperlinks on the page. The modification of hyperlinks is always very important.

Although I have never looked at it carefully before today This piece, but it looks quite simple now.



Four pseudo-classes are used in CSS to define the style of the link, respectively. Are: a:link, a:visited, a:hover and a : active, for example:



a:link{font-weight : bold ;text-decoration : none ;color : #c00 ;}

a:visited {font-weight : bold ;text-decoration : none ;color : #c30 ;}

a:hover {font-weight : bold ;text-decoration : underline ;color : #f60 ;}
a:active {font-weight : bold ;text-decoration : none ;color : #F90 ;}


The above statements are respectively Defines the styles for "links, visited links, when the mouse is over, and when the mouse is clicked".

Note that you must write in the above order, otherwise the display may be different from what you expected. Remember they are in order "LVHA".



The code below is very interesting, you can click here to see its effect

 
 link css
 
 Class element (スa:), the foreground color attribute and text decoration attribute are defined in curly brackets,
 The 'font-size' attribute is added to hover to change the font when the mouse activates the link*//
 a:link {color: green; text-decoration: none}
//*The state when not visited, the color is green (green), the text decoration attribute (text-decoration) value
is none (none)*//
 a:visited{color:red;text-decoration:none}
  //*The visited state, the color is red (red), and the text decoration attribute value is none*//
  a:hover {color: blue; text-decoration: overline; font-size: 20pt}
//* When the mouse is activated, the color is blue (blue), and the text decoration attribute value is overline,
The font size is 20pt*//
  -->
 
 
 
 


  Unvisited link


  / /*Add a link, display three different states, and define the font and size of the link text*//
 

Visited Link


 

Mouse activated link 
 



This example was copied from Hongen Online, Tutuo did it before After this kind of bang-dong, I copied a large section of js code.

This is a special effect, and its principle is so easy. It’s not like Tutuo didn’t know how to use link css before, but I just didn’t think of it.

So creativity and imagination are very important in many cases.

容器属性:虾米是容器?驼驼到现在还没找到一个定律一样的解释。8过,凭经验,<body></body><div></div>、<tr></tr>......类似的标签都是容器。这些标签就像容器,
Copy after login
罐装了我们的网页内容。使他们能在正确的位置来体现。CSS的容器属性包括边距、填充距、边框和宽度、高度、浮动、清除等属性
Copy after login
 <pre class="sycode" name="code">边距属性
Copy after login
例:body{margin:1em 2em 3em 4em}  //*定义文本的上、右、下、左的边距分别为1、2、3、4em*// 
Copy after login
填充距属性
Copy after login
Copy after login
Copy after login
Copy after login
例:padding:1em 2em 3em 4em
Copy after login
边框属性
Copy after login
Copy after login
Copy after login
Copy after login
看上去很多,实际用起来很方便。
Copy after login
例:P{border:5px double purple}//*定义了四条边框为一样的值*//
Copy after login
图文混排
Copy after login
 
Copy after login
img{margin-right:2em;float:left}//*定义图片的右边距为2em,图片浮动在文字的左边*//
Copy after login
鼠标属性 
Copy after login
 在CSS当中,这种样式是通过“cursor”属性来实现的。Cursor属性有很多的属性值,
Copy after login
  我们来看一下它的详细列表
Copy after login
Copy after login
Copy after login
Copy after login
例子:<span style=“cursor:hand”>手的形状</span>
Copy after login
Statement of this Website
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

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1269
29
C# Tutorial
1248
24
Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

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

HTML: The Structure, CSS: The Style, JavaScript: The Behavior HTML: The Structure, CSS: The Style, JavaScript: The Behavior Apr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML, CSS, and JavaScript: Web Development Trends The Future of HTML, CSS, and JavaScript: Web Development Trends Apr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The Future of HTML: Evolution and Trends in Web Design The Future of HTML: Evolution and Trends in Web Design Apr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative Overview HTML vs. CSS vs. JavaScript: A Comparative Overview Apr 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: Building the Structure of Web Pages HTML: Building the Structure of Web Pages Apr 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.

The Role of HTML: Structuring Web Content The Role of HTML: Structuring Web Content Apr 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: 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.

See all articles