1. CSS cascading style sheets complement HTML
Achieve a thorough separation of web content and page effects
1. Inline style sheet (sets the style of the element within the tag)
<p style= "background:red; Font-size:xx-large "> Sunny day, good scenery everywhere </p>
More flexible, who want to set the data to whom to set the data
But if you want to make all the P tags in the current page this way, it's too cumbersome to write all of them again.
2. Embed style sheet (need to write in head tag <style type= "Text/css" ></style>)
<style type= "Text/css" >
p{
Font-size:xx-small;
}
Global change, but not to inline style sheets, with higher precedence for inline style sheets
3. external style sheet link
Download a style that someone else has written
tt{
Font-size:xx-large;
}
<link href= "Test.css" rel= "stylesheet" type= "Text/css"/>
Priority is lower than the previous two types
2. Style Rule selector (what is the way to get the elements on the page to set the style)
1), HTML Selector
tt{
}
2), class Selector (class selector, you need to assign a value to the class property of the element to which you want to set the style)
tt.tt1{
}
tt.tt2{
Font-size:xx-large;
}
<tt class= "TT1" >
<tt class= "TT2" >
Class selector is used when certain elements of the page are to display the same style
3), ID selector (need to assign a value to the class attribute of the element to which the style is to be set)
. p1{
}
#p2 {
}
#p3 {
}
#p4 {
}
To make sure that each ID is unique, try not to assign the same ID to the tag with a single ID
<p class= "P1" >
<p class= "P1" >
<p id= "P2" >
<p id= "P3" >
<p id= "P4" >
4), correlation selector
Tags can be nested to each other according to nested tags to assign values
P em{
}
<p><em> Fine Weather Today </em></p>
<em> haha </em>
<em> ha ha </em>
<p> Fine Weather Today </p>
<p> Fine Weather Today </p>
<p> Fine Weather Today </p>
5), combination selector
h1,h2,h3,h4,h5,h6,td{
}
<table border= "1" cellspacing= "0px" cellpadding= "0px" >
<tr>
<td> Painting Skills </td>
<td> Painting Skills </td>
<td> Painting Skills </td>
<td> Painting Skills </td>
</tr>
<tr>
<td> Painting Skills </td>
<td> Painting Skills </td>
<td> Painting Skills </td>
<td> Painting Skills </td>
</tr>
<tr>
<td> Painting Skills </td>
<td> Painting Skills </td>
<td> Painting Skills </td>
<td> Painting Skills </td>
</tr>
6), pseudo-element selector
A pseudo-element selector refers to the various states of the same HTML element and what it includes. A way of defining part of the content. For example, for a hyperlink label (<a></a>) 's normal state (before any action), visited state, checked state, and cursor moved to the status on the hyperlink text, the first and first lines of the paragraph can be defined using the pseudo element selector.
Common Pseudo-elements
A:active status when a hyperlink is selected
A:hover the cursor moves to the state on the hyperlink
A:link Normal status of hyperlinks
P:first-link the first line of text in a paragraph
P:first-letter the first letter in a paragraph
a:active{
Text-decoration:none;
}
a:hover{
Font-size:xx-large;
}
p::first-letter{
Font-size:xx-small;
}
p::first-line{
Font-size:xx-large
}
<p> Little Plum is a two-goods <br/>
Little Plum is a two-goods <br/>
Little Plum is a two-goods <br/>
Little Plum is a two-goods <br/>
Little Plum is a two-goods </p>
<a href= "#" > Hyperlinks </a>
<a href= "#" > Hyperlinks </a>
<a href= "#" > Hyperlinks </a>
<a href= "#" > Hyperlinks </a>
<a href= "#" > Hyperlinks </a>
3. Introduction to CSS Font properties
1), Font
Font-family: This property is used to set the font family.
Font-size: This property defines the size of the text, you can use the units of measure to set the size of the font, or you can use a relative font size. You can also use an absolute size tag. The absolute size is set to either Xx-small, X-small, small, medium, large, x-large, or Xx-large. The Xx-small is the smallest and the Xx-large is the largest.
Font-style: This property is used to define a font style of normal, italic, or oblique (italic)
Text-decoration: This property is used for underline, underline, and flicker effects in text.
Font-weight: This property has a point value that sets the bold character, which has the following values: Normal, bold, bolder, lighter, 100~900
4. Document Flow
Position:absolute; absolute positioning, where is it?
position:fixed; Fixed
Z-index:3; The higher the number, the more it appears outside.
div{
height:300px;
width:300px;
}
div.div1{
top:100px;
left:100px;
Position:absolute;
Z-index:3;
}
div.div2{
top:130px;
left:130px;
Position:absolute;
Z-index:2;
}
div.div3{
top:160px;
left:160px;
Position:absolute;
Z-index:1;
}
<div class= "Div1" ></div>
<div class= "Div2" ></div>
<div class= "Div3" ></div>
5. Text Properties
Text attributes include: text spacing, alignment, superscript, subscript, arrangement, first line indent.
Word-spacing: Sets the spacing between words.
Letter-spacing: Sets the spacing between characters.
Text-align: Sets the horizontal alignment of the text, with the value can be left, right, center, Justfy
Text-indent: Sets the indent value of the first line of text
Line-height: Sets the line height of the line where the text is located.
6. Box model
A box is a div.
The spacing between div boxes and Web pages or other div boxes is indicated by margin
The spacing of content within div boxes and div boxes is represented by padding
The bounding rectangle of the div box is represented by border
Indicates that all the outer border spacing is 0.
*
{
margin:0px;
}
Auto indicates automatic (centered)
Put the page format, the bureau first cloth, and then fill in the content
First, each div to get a background color, and so the board is finished, and then remove the content only left
Put the frame of the Web page in this form before writing it.
Float:left (floating on the left) floats to the same div.
Floating up in the div is not occupied in the place.
7. Simple factory and abstract class review
1), annotation characters
Single line comment//Comment Line code
Multiline comment/* What to annotate */
Documentation comments///annotation classes and methods
HTML <!--What to annotate--
CSS/* What to annotate */
2), naming specification
Camel Camel naming specification: requires the first letter lowercase, the remaining words capitalized, variables, fields
int age String Name char gender string HighSchool
int _chinese Field underlines
Pascal: Class or method Getmax Getavg getsum
The name must have meaning, don't mess up
The first part: Object-oriented
Process process Operations
StartInfo is the thing that you want to open the file, it needs the ProcessStartInfo type, the address to open this file to this object and assign this object to the StartInfo to open, finally call its Start method, open it
To open a specified file using a process
ProcessStartInfo psi = new ProcessStartInfo (@ "C:\Users\SJD\Desktop\AE.txt");
Process P = new process ();
P.startinfo = PSI;
P.start ();
3), Object-oriented review
1. Encapsulation, inheritance, polymorphism
Fields: Store data, access modifiers should be set to priveate private
Properties: Securing fields, qualifying the values and assignments of fields
New keyword: 1, open space in the heap 2, create object 3 in the open space, call the constructor of the object
This keyword: 1. Object representing the current Class 2. Call your own constructor
The constructor is a special method
constructor does not have void must be public
Sole mode, you can create only one object, such as QQ
Constructor: Initializes the object and invokes the constructor when the object is created.
The process of assigning values to each property of an object is called initialization of the object
How to protect a field:
1.get ()
2.set ()
3. Constructors
Return
1. End this method immediately
2. Return the value you want to return in the method
public person (int age, String Name,char gender,int chinese,int english,int math)
{
This. Age = age;
This. name = name;
This. Gender = Gender;
This. Chinese = Chinese;
This. 中文版 = 中文版;
This. math = math;
}
Public person (Int. age,string Name,char Gender): this (age,name,gender,0,0,0)
{
}
4), Succession review
It solves the redundancy of the code, realizes polymorphism, enhances the extensibility of the code and is easy to maintain.
1. Single-Root sex
2. transitivity
The subclass does not inherit the constructor of the parent class, but instead calls the parent class's parameterless constructor by default.
If a subclass inherits a parent class, this subclass can also use members that inherit from the parent class, in addition to its own members. However, the parent class can always use only its own members, not the members of the child classes.
Sub-classes cannot use each other's members.
5), Richter conversion
1, subclasses can be assigned to the parent class
2. If the parent class is loaded with a subclass object, you can convert the parent class to a child class object
3, as
Person person = new Student ();
Teacher t = person as Teacher;
The conversion succeeded in returning the corresponding object
Conversion failure returns a null
4, is
Person person = new Student ();
{
Console.WriteLine ("OK, can be converted");
}
Else
{
Console.WriteLine ("No, cannot be converted");
}
Conversion succeeded return True
Conversion Failure returns false
6), polymorphic
1. Virtual method
2. Abstract class Abstraction
C # Basic notes (19th day)