HTML+CSS Easy to get started with basic HTML tags (2)
Hyperlink
##Format: <a href=''></a>
The following example:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> <a href="php.cn">php中文网</a> </body> </html>
Note: href is an indispensable attribute of a tag href="the place to link to", such as Baidu, Taobao, etc.
What is an empty link?To write an empty link, use the # key.The code is as follows:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> <a href="#">php中文网</a> </body> </html>In this way, there will be no response when we click on the link.
How to use css style tags
<style></style>
Note: The style tag is Written in the header file, the code is as follows<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style type="text/css"> /*写入css样式*/ </style> </head> <body> 欢迎来到php中文网 </body> </html>Note: The type attribute is required and defines the content of the style element. The only possible value is "text/css". The same goes for writing script code: As shown in the following code
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script type="text/javascript"> //写入脚本代码 </script> </head> <body> 欢迎来到php中文网 </body> </html>The type attribute specifies the type of script
Image tag
<img> tag The following code is shown:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> 欢迎来到php中文网 <img src="images/1.jpg"> </body> </html>If this picture exists, we will display it
Introducing external styles or scripts
Introducing external styles, for example, I create a style.css file, my current page will use the style in the style.css file as shown in the following code:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> 欢迎来到php中文网 </body> </html>In this way we have introduced the style
Introducing foreign script files
The following code is shown:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script type="text/javascript" src="index.js"></script> </head> <body> 欢迎来到php中文网 </body> </html>