您的位置:首页 > 汽车 > 时评 > 上海网站seo牛巨微_自己做公司网站简单吗_日本搜索引擎naver入口_seo优化有百度系和什么

上海网站seo牛巨微_自己做公司网站简单吗_日本搜索引擎naver入口_seo优化有百度系和什么

2024/9/20 22:25:25 来源:https://blog.csdn.net/weixin_44329069/article/details/142177082  浏览:    关键词:上海网站seo牛巨微_自己做公司网站简单吗_日本搜索引擎naver入口_seo优化有百度系和什么
上海网站seo牛巨微_自己做公司网站简单吗_日本搜索引擎naver入口_seo优化有百度系和什么

我们将使用HTML和CSS来创建一个简洁、现代的登录界面。

1. HTML结构

首先,我们需要一个基本的HTML结构来容纳登录表单。保存为 index.html 文件:

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>登录页面</title><link rel="stylesheet" href="styles.css">
</head>
<body><div class="container"><div class="login-box"><h2>登录</h2><form><div class="textbox"><input type="text" placeholder="用户名" required></div><div class="textbox"><input type="password" placeholder="密码" required></div><input type="submit" class="btn" value="登录"></form></div></div>
</body>
</html>

2. CSS样式

接下来,我们将编写CSS样式来美化登录界面。保存为 styles.css 文件:

/* Reset some default styles */
/* Reset some default styles */
body, html {margin: 0;padding: 0;font-family: Arial, sans-serif;height: 100%;
}.container {display: flex;justify-content: center;align-items: center;height: 100vh;background: url('https://cdn.pixabay.com/photo/2024/08/02/09/01/barracuda-8939250_1280.jpg') no-repeat center center fixed;background-size: cover;
}.login-box {width: 360px;padding: 40px;position: relative;background: rgba(255, 255, 255, 0.9); /* Slightly transparent background for better readability */border-radius: 10px;box-shadow: 0 15px 25px rgba(0, 0, 0, 0.2);
}.login-box h2 {margin: 0 0 20px;color: #333;text-align: center;
}.textbox {margin-bottom: 20px;
}.textbox input {width: 100%;padding: 10px;background: #f9f9f9;border: 1px solid #ddd;border-radius: 5px;font-size: 16px;
}.btn {width: 100%;background: #4facfe;border: none;padding: 15px;cursor: pointer;border-radius: 5px;color: #fff;font-size: 18px;transition: background 0.3s ease;
}.btn:hover {background: #00f2fe;
}
  • 背景图片: 使用 background 属性设置背景图片,no-repeat 确保图片不会重复,center center 将图片居中显示,fixed 确保背景图片在滚动时固定不动。
  • 背景大小: background-size: cover; 确保背景图片覆盖整个容器,同时保持图片的纵横比。
  • 登录框背景: 使用 rgba(255, 255, 255, 0.9) 为登录框设置一个略微透明的白色背景,以便在有背景图片的情况下保持文本的可读性。
  • login-box: 设置登录框的宽度、内边距、背景颜色、圆角和阴影,提升视觉效果。
  • textbox: 提供输入框的样式,包括内边距、背景色、边框和圆角。
  • btn: 设置按钮的样式,包括背景颜色、边框、内边距和过渡效果。

4. 运行和测试

  1. index.htmlstyles.css 文件保存在同一目录下。
  2. 打开 index.html 文件,应该能看到一个美观的登录界面。
    好的,我们可以将背景图片应用到登录界面中。你只需更新CSS样式以包含该背景图片。下面是更新后的CSS代码示例:

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com