vscode链接服务器
安装VScode插件
- Chinese (Simplified) (简体中⽂) Language Pack for Visual Studio Code
- Open in Browser
- Remote SSH
在命令行输入
![![[Pasted image 20250218184331.png]]](https://i-blog.csdnimg.cn/direct/24fe5ab8d435412b9784743272948fac.png)
remote-ssh
接着输入
![![[Pasted image 20250218184354.png]]](https://i-blog.csdnimg.cn/direct/c75cdbecd89d43a6a579e27a1dc1f958.png)
打开配置文件,已经配置好主机
![![[Pasted image 20250218184255.png]]](https://i-blog.csdnimg.cn/direct/a5d29ae8eb724e5099b85e2d0e5d580c.png)
点击远程资源管理器可以找到
![![[Pasted image 20250218184426.png]]](https://i-blog.csdnimg.cn/direct/cef03000e5ae4757a17495f01bbbc6e4.png)
右键链接
![![[Pasted image 20250218184522.png]]](https://i-blog.csdnimg.cn/direct/910db8a1334a41299e4519dff0d1085c.png)
输入密码
![![[Pasted image 20250218184727.png]]](https://i-blog.csdnimg.cn/direct/7a2811cff8a34c9fac90e7d156c2c952.png)
左下角显示链接
打开文件夹
![![[Pasted image 20250218184821.png]]](https://i-blog.csdnimg.cn/direct/65ef22c6a1c44068bc66b1ccbab60f58.png)
选择wwwroot,输入密码
![![[Pasted image 20250218185025.png]]](https://i-blog.csdnimg.cn/direct/9a67db78bb664e128dbce9442eae5cbe.png)
成功打开文件
![![[Pasted image 20250218185120.png]]](https://i-blog.csdnimg.cn/direct/c164b14e0ff3421193d8231808f70785.png)
也可以通过终端控制
编写html
html: 是⽹⻚的⻣骼 -- 负责⽹⻚结构
css:⽹⻚的⽪⾁ -- 负责⽹⻚美观的
js(javascript):⽹⻚的灵魂---负责动态效果,和前后端交互教程: https://www.w3school.com.cn/
直接在vscode上编写
![![[Pasted image 20250218190047.png]]](https://i-blog.csdnimg.cn/direct/913af6b9b1dd4cebabb6ebb7a34c3897.png)
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>boost 搜索引擎</title>
</head>
<body><h1>hello, 欢迎来到我的搜索引擎</h1>
</body>
</html>
![![[Pasted image 20250218190035.png]]](https://i-blog.csdnimg.cn/direct/fa2db3e341544b999d276258ce9c53d9.png)
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>boost 搜索引擎</title>
</head>
<body><div class="container"><div class="search"><input type="text" value="输入搜索关键字"><button>搜索一下</button></div></div>
</body>
</html>
![![[Pasted image 20250218191633.png]]](https://i-blog.csdnimg.cn/direct/1a56310a67e14d0a8de3101714042807.png)
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>boost 搜索引擎</title>
</head>
<body><div class="container"><div class="search"><input type="text" value="输入搜索关键字..."><button>搜索一下</button></div><div class="result"><div class="item"><a href="#">这是标题</a><p>这是摘要是摘要这是摘要这是摘要这是摘要这是摘要这是摘要这是摘要这是摘要这是摘要这是摘要</p><i>htps://www.boost.org/doc/libs/1_78_0/doc/html/boost_dll/dependencies.html</i></div><div class="item"><a href="#">这是标题</a><p>这是摘要是摘要这是摘要这是摘要这是摘要这是摘要这是摘要这是摘要这是摘要这是摘要这是摘要</p><i>htps://www.boost.org/doc/libs/1_78_0/doc/html/boost_dll/dependencies.html</i></div><div class="item"><a href="#">这是标题</a><p>这是摘要是摘要这是摘要这是摘要这是摘要这是摘要这是摘要这是摘要这是摘要这是摘要这是摘要</p><i>htps://www.boost.org/doc/libs/1_78_0/doc/html/boost_dll/dependencies.html</i></div><div class="item"><a href="#">这是标题</a><p>这是摘要是摘要这是摘要这是摘要这是摘要这是摘要这是摘要这是摘要这是摘要这是摘要这是摘要</p><i>htps://www.boost.org/doc/libs/1_78_0/doc/html/boost_dll/dependencies.html</i></div></div></div>
</body>
</html>
![![[Pasted image 20250218192320.png]]](https://i-blog.csdnimg.cn/direct/41c57822f3cd458d950998a9841a16a9.png)
编写css
设置样式的本质:找到要设置的标签,设置它的属性
1. 选择特定的标签:类选择器,标签选择器,复合选择器
2. 设置指定标签的属性:⻅代码
将内外边距设为0
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>boost 搜索引擎</title><style>/* 去掉网页中的所有的默认内外边距 */* {/*设置外边距 */margin: 0;/*设置内边距*/padding: 0; }/*将body的内容100%和html的呈现是吻合的*/html,body {height: 100%;}/*类选择器*/.container {/*设置div的宽度*/width: 800px;/* 通过设置外边距达到居中对齐的目的 */margin: 0px auto;/* 设置外边距的上边距,保持元素和网页的上部距离 */margin-top: 15px;}/* 复合选择器,选中container下的search */.container .search {/* 宽度与父标签保持一致 */width: 100%;/* 高度设置为52像素点 */height: 52px;}/* 先选中input标签,直接设置标签的属性,先要选中,input:标签选择器 *//* input在进行高度设置的时候,没有考虑边框的问题 */.container .search input {/* 设置left浮动 */float: left;width: 600px;height: 50px;/* 设置边框属性:边框的宽度,样式,颜色 */border: 1px solid black;/* 去掉input输入框的右边框 */border-right: none;/* 设置内边距,默认文字不要紧贴左侧边框 */padding-left: 10px;/* 设置input内部的字体的颜色和样式 */color: #ccc;font-size: 20px;}.container .search button {/* 设置left浮动 */float: left;width: 150px;height: 52px;/* 设置button的背景颜色100,148,288 */background-color: #4e6ef2;/* 设置button中的字体颜色 */color: #FFF;/* 设置字体的大小 */font-size: 20px;font-family: Georgia, 'Times New Roman', Times, serif;}.container .result {width: 100%;}.container .result .item {margin-top: 15px;}.container .result .item a{/* 设置a为块级元素,单独占一行 */display: block;/* a标签的下划线去掉 */text-decoration: none;/* 设置a标签中的文字的字体大小 */font-size: 22px;/* 设置a标签中文字的颜色 */color: #4e6ef2;}.container .result .item a:hover {text-decoration: underline;}.container .result .item p {margin-top: 5px;font-size: 18px;font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;}.container .result .item i {/* 设置a为块级元素,单独占一行 */display: block;/* 取消斜体风格 */font-style: normal;color: green;}</style>
</head>
![![[Pasted image 20250218214234.png]]](https://i-blog.csdnimg.cn/direct/23c40375b2fe4c4ca761c43bc94ef562.png)
编写JS
如果直接使⽤原⽣的js成本会⽐较⾼(xmlhttprequest),我们推荐使⽤JQuery.
<head><script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
</head><script>function Search(){// 是浏览器的一个弹出框// alert("hello js!");// 1. 提取数据, $可以理解成就是JQuery的别称let query = $(".container .search input").val();conole.log("query = " + query); //console是浏览器的对话框,可以用来进行查看js数据//2. 发起http请求,ajax: 属于一个和后端进行数据交互的函数,JQuery中的$.ajax({type: "GET",url: "/s?word=" + query,success: function(data){console.log(data);BuildHtml(data);}});}function BuildHtml(data){// 获取html中的result标签let result_lable = $(".container .result");// 清空历史搜索结果result_lable.empty();for( let elem of data){// console.log(elem.title);// console.log(elem.url);let a_lable = $("<a>", {text: elem.title,href: elem.url,// 跳转到新的页面target: "_blank"});let p_lable = $("<p>", {text: elem.desc});let i_lable = $("<i>", {text: elem.url});let div_lable = $("<div>", {class: "item"});a_lable.appendTo(div_lable);p_lable.appendTo(div_lable);i_lable.appendTo(div_lable);div_lable.appendTo(result_lable);}}</script>
![![[Pasted image 20250219000002.png]]](https://i-blog.csdnimg.cn/direct/b2f7ab82718e43569d67ad08aa8c51d5.png)
