【发布时间】:2022-11-06 01:28:07
【问题描述】:
我是编程新手,需要在标题下方添加一个滑块,您可能会想“好吧,一个滑块和一个滑块,为什么不能添加它?”但这不是一个简单的滑块。 1 我从未使用过滑块 2 正如您通常知道的那样,如果滑块上有文字,那么当您翻转图片时它会更改或移动但是在此滑块中,文本是静态的,当您翻转图片时,它不仅不会改变,而且不会移动同样适用到它下面的按钮
body {
margin: 0;
font-family: Helvetica, sans-serif;
background-color: #f4f4f4;
}
a {
color: #000;
}
/* header */
.header {
background-color: #fff;
box-shadow: 1px 1px 4px 0 rgba(0,0,0,.1);
position: fixed;
width: 100%;
z-index: 3;
}
.header ul {
margin: 0;
padding: 0;
list-style: none;
overflow: hidden;
background-color: #fff;
}
.header li a {
display: block;
padding: 20px 20px;
border-right: 1px solid #f4f4f4;
text-decoration: none;
}
.header li a:hover,
.header .menu-btn:hover {
color:green;
}
.header .logo {
display: block;
float: left;
font-size: 2em;
padding: 10px 20px;
text-decoration: none;
color:green;
}
.logo::before {
content:url('imgonline-com-ua-Resize-HhpRdaDieHxuk8.png');
display: inline-block;
padding-right: 3px;
vertical-align: middle;
}
/* menu */
.header .menu {
clear: both;
max-height: 0;
transition: max-height .2s ease-out;
}
.icons{
/* display:block; */
display:flex;
gap:20px;
float:right;
padding:16px;
margin-right:50px;
/* clear:both; */
}
ion-icon{
font-size:25px;
}
.search{
border:none;
}
.search::placeholder{
font-size
}
/* menu icon */
.header .menu-icon {
cursor: pointer;
display: inline-block;
float: right;
padding: 28px 20px;
position: relative;
user-select: none;
}
.header .menu-icon .navicon {
background: #333;
display: block;
height: 2px;
position: relative;
transition: background .2s ease-out;
width: 18px;
}
.header .menu-icon .navicon:before,
.header .menu-icon .navicon:after {
background: #333;
content: '';
display: block;
height: 100%;
position: absolute;
transition: all .2s ease-out;
width: 100%;
}
.header .menu-icon .navicon:before {
top: 5px;
}
.header .menu-icon .navicon:after {
top: -5px;
}
/* menu btn */
.header .menu-btn {
display: none;
}
.header .menu-btn:checked ~ .menu {
max-height: 240px;
}
.header .menu-btn:checked ~ .menu-icon .navicon {
background: transparent;
}
.header .menu-btn:checked ~ .menu-icon .navicon:before {
transform: rotate(-45deg);
}
.header .menu-btn:checked ~ .menu-icon .navicon:after {
transform: rotate(45deg);
}
.header .menu-btn:checked ~ .menu-icon:not(.steps) .navicon:before,
.header .menu-btn:checked ~ .menu-icon:not(.steps) .navicon:after {
top: 0;
}
/* 48em = 768px */
@media (min-width: 48em) {
.header li {
float: left;
}
.header li a {
padding: 20px 30px;
}
.header .menu {
clear: none;
float: center;
max-height: none;
}
.header .menu-icon {
display: none;
}
}
logo:before {
content:url(images/quotemarks.png);
}
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Shop</title>
<meta charset="UTF-8">
<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
</head>
<body>
<header class="header">
<a href="" class="logo">Fresh market</a>
<input class="menu-btn" type="checkbox" id="menu-btn" />
<link rel="stylesheet" href="style.css">
<label class="menu-icon" for="menu-btn"><span class="navicon"></span></label>
<ul class="menu">
<li><a href="#work">Home</a></li>
<li><a href="#about">Shop</a></li>
<li><a href="#careers">About</a></li>
<li><a href="#contact">Contact</a></li>
<div class="icons">
<input class="search" placeholder="Search.." type="text">
<ion-icon name="search-outline"></ion-icon>
<ion-icon name="person-circle-outline"></ion-icon>
<ion-icon name="bag-handle-outline"></ion-icon>
</div>
</ul>
</header>
</body>
</html>
html & css的专业人士会认为这是一个愚蠢的问题,但我从来没有做过这样的事情,我在互联网上也没有找到答案(请原谅我可能愚蠢的问题,我是新手)
【问题讨论】:
-
请在运行代码 sn -p 中显示您的问题,现在我们看不到任何问题。
-
@FarshadVaghari 我展示的代码没有问题,我的问题是我不知道如何编写这样的滑块
-
@FarshadVaghari?
标签: html css image button slider