如何创建一个通用函数,该函数应将任意数量的通用类型数组作为参数并将它们组合成一个。
function concat<T>(arg: T[]): T{
}
concat();
// []
concat(['qwerty'], ['asd']);
// ['qwerty', 'asd']
concat([1, 2, 3], [4, 5], [6, 7, 8]);
// [1, 2, 3, 4, 5, 6, 7, 8]
如何创建一个通用函数,该函数应将任意数量的通用类型数组作为参数并将它们组合成一个。
function concat<T>(arg: T[]): T{
}
concat();
// []
concat(['qwerty'], ['asd']);
// ['qwerty', 'asd']
concat([1, 2, 3], [4, 5], [6, 7, 8]);
// [1, 2, 3, 4, 5, 6, 7, 8]
button {
margin: 0;
padding: 0;
border: none;
background-color: transparent;
}
.header {
display: flex;
justify-content: center;
gap: 20px;
}
.button {
font-family: sans-serif;
text-transform: uppercase;
}
.button:hover {
border: 1px solid #000;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="css/fonts.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header class="header">
<button class="button">привет</button>
<button class="button">привет</button>
<button class="button">привет</button>
</header>
</body>
</html>
.baner-img{
display: flex;
margin: 0 auto;
width: 50%;
height: 50%;
}
.gradient {
position: relative;
}
.gradient-color {
width: 100%;
height: 551px;
background: linear-gradient(180deg, rgba(0, 0, 0, 0.00) 0%, #0E0E0E 66.15%);
position: absolute;
/* При position: absolute градиент исчезает */
}
<section class="baner">
<img class="baner-img" src="https://cdn-edge.kwork.ru/pics/t3/23/27100204-64636693aaf80.jpg" alt="">
<div class="gradient">
<div class="gradient-color"></div>
</div>
</section>
我无法制作自适应移动菜单。问题是,在导航中,中心有一个徽标,我需要将其与导航文本分开。
这样标志就保留在中间,文字就在汉堡菜单中。
/* Container */
.container {
max-width: 1150px;
margin: 0 auto;
width: 100%;
padding: 0 15px;
}
/* Header */
.header {
background-color: #F6F2EE;
width: 100%;
}
.header__burger-btn {}
/* Navigation */
.menu {
padding-top: 33px;
padding-bottom: 168px;
position: relative;
}
.menu__list {
display: flex;
justify-content: space-between;
align-items: center;
}
.menu__list-link {
color: #000;
}
.search {
background-color: #c8c5c5;
border: none;
outline: none;
padding: 5px;
}
.search-form.active {
display: flex;
align-items: center;
}
.search-form {
display: none;
background-color: #fff;
border-radius: 10%;
padding: 10px;
border: none;
gap: 10px;
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%);
-webkit-transform: translateX(-50%);
}
@media (max-width: 992px) {
.menu {
position: absolute;
top: 0;
right: 0;
}
.menu__list {
display: block;
}
}
<header class="header">
<div class="container">
<button class="header__burger-btn">
<span class="burger__span"></span>
<span class="burger__span"></span>
<span class="burger__span"></span>
</button>
<nav class="menu">
<ul class="menu__list">
<li class="menu__list-item">
<a class="menu__list-link" href="">Home</a>
</li>
<li class="menu__list-item">
<a class="menu__list-link" href=""> About </a>
</li>
<li class="menu__list-item">
<a class="menu__list-link" href=""> Manu</a>
</li>
<li class="menu__list-item">
<a class="menu__list-link" href="">Reservation</a>
</li>
<img class="logo" src="image/logo.png" alt="Картинка">
<li class="menu__list-item">
<a class="menu__list-link" href="">Pages</a>
</li>
<li class="menu__list-item">
<a class="menu__list-link" href="">Shop</a>
</li>
<li class="menu__list-item">
<a class="menu__list-link" href=""> Contact</a>
</li>
<li class="">
<img src="image/search.png" alt="search" id="search-btn">
</li>
<form action="" class="search-form">
<input class="search" type="search" name="" placeholder="Search..." id="search-box">
<label for="search-box"><img class="search-img" src="image/search.png" alt="search"></label>
</form>
</ul>
</nav>
</div>
</header>
.container {
max-width: 1120px;
margin: 0 auto;
}
.reserv {
background-color: #f8e7d7;
}
.reserv__inner {
display: flex;
}
.reserv__content {
margin: 0 auto;
}
<div class="reserv">
<div class="container">
<div class="reserv__inner">
<img class="map" src="image/map__bg.jpg" alt="Картинка">
<div class="reserv__content">
<h4 class="form__suptitle">
RESERVATION
</h4>
<h2 class="form__title">
BOOKING A TABLE
</h2>
</div>
<div class="form">
<div class="input__form">
<input type="text" placeholder="Имя">
</div>
<div class="input__form">
<input type="text" placeholder="Имя">
</div>
<div class="input__form">
<input type="text" placeholder="Имя">
</div>
</div>
</div>
</div>
</div>
.section__product-items {
column-count: 2;
width: 900px;
}
<div class="section__product-items">
<div class="section__product-item">
<img src="" alt="">
<h4 class="product__name">Vicaragua Coffee Beans</h4>
<span class="product__cost"></span>
</div>
<div class="section__product-item">
<img src="" alt="">
<h4 class="product__name">Espresso Ristretto</h4>
<span class="product__cost"></span>
</div>
<div class="section__product-item">
<img src="" alt="">
<h4 class="product__name">Ethiopia Coffee</h4>
<span class="product__cost"></span>
</div>
<div class="section__product-item">
<img src="" alt="">
<h4 class="product__name">Vicaragua Coffee Beans</h4>
<span class="product__cost"></span>
</div>
<div class="section__product-item">
<img src="" alt="">
<h4 class="product__name">Espresso Ristretto</h4>
<span class="product__cost"></span>
</div>
<div class="section__product-item">
<img src="" alt="">
<h4 class="product__name">Ethiopia Coffee</h4>
<span class="product__cost"></span>
</div>
</div>
.preview__items{
display: flex;
}
.preview__item + .preview__item{
margin-left: 30px;
}
.color__block{
width: 350px;
height: 256px;
background-color: #D48A5C;
top: -14px;
}
<div class="preview__items">
<div class="preview__item">
<img class="photo__list" src="img/Group 128.jpg" alt="">
<span class="number">01</span>
<h4 class="list__name">Best Coffee Flavor</h4>
<p class="list__text">Curabitur semper erat a lacusey sedny <br>
consequat,sit ametey.</p>
</div>
<div class="preview__item">
<img class="photo__list" src="img/Group 129.jpg" alt="">
<span class="number">02</span>
<h4 class="list__name">Proper Roasting</h4>
<p class="list__text">Curabitur semper erat a lacusey sedny <br>
consequat,sit ametey.</p>
</div>
<div class="preview__item">
<img class="photo__list" src="img/Group 130.jpg" alt="">
<span class="number">03</span>
<h4 class="list__name">Place to Get Lost</h4>
<p class="list__text">Curabitur semper erat a lacusey sedny <br>
consequat,sit ametey.</p>
</div>
</div>
] 2
<form action="" method="get">
<p>
<label for="name">Имя:</label>
<input type="text" name="name" id="name" required>
</p>
<p>
<label for="phone">Телефон:</label>
<input type="text" name="phone" id="phone" required>
</p>
<p>
<label for="text">Оставьте сообщение, и мы свяжемся с Вами в ближайшее время:</label>
<input type="text" name="text" id="text" required>
</p>
<button type="submit">Отправить</button>
</form>
const swiper = new Swiper('.swiper-container', {
// Цикличность
loop: true,
// Пагинация
pagination: {
el: '.swiper-pagination',
clickable: true
},
a11y: {
paginationBulletMessage: 'Тут название слайда {{index}}',
}
});
.swiper__box{
position: relative;
height: 600px;
overflow: hidden;
}
.swiper-container{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: aqua;
}
.swiper-slide{
height: 100%;
}
.slide-img{
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
.swiper-pagination{
padding-bottom: 70px;
color: #fff;
}
.swiper-pagination-bullet{
opacity: 1;
}
<link href="https://fonts.googleapis.com/css2?family=Raleway:wght@600;700&family=Roboto+Condensed:ital,wght@0,300;0,400;0,700;1,300&display=swap" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/10.3.0/swiper-bundle.min.js" integrity="sha512-QokzG/B/9i5X3BYbmuyNn2ah9EiApK5KY4saOYZRCQINuB+X52ED0L3RCc/1x7YUA85qaFZ9uoB4x5SmkLGCJQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/10.3.0/swiper-bundle.min.css" integrity="sha512-ryx4QW6sYyQthh6MIGW1cDEfNuIwTsvWtORXg5t3sqmh3TSNmqMr+VBN5N0T+z0GqqsiDJ5O8YhP4diuBGmcrw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
<body>
<div class="swiper__box">
<div class="swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
<div class="swiper-slide">
<img class="slide-img" src="image/slider__bg.jpg" alt="">
</div>
<div class="swiper-slide">
<img class="slide-img" src="image/slider__bg.jpg" alt="">
</div>
<div class="swiper-slide">
<img class="slide-img" src="image/slider__bg.jpg" alt="">
</div>
<div class="swiper-slide">
<img class="slide-img" src="image/slider__bg.jpg" alt="">
</div>
<div class="swiper-slide">
<img class="slide-img" src="image/slider__bg.jpg" alt="">
</div>
<div class="swiper-slide">
<img class="slide-img" src="image/slider__bg.jpg" alt="">
</div>
<div class="swiper-slide">
<img class="slide-img" src="image/slider__bg.jpg" alt="">
</div>
<div class="swiper-slide">
<img class="slide-img" src="image/slider__bg.jpg" alt="">
</div>
<div class="swiper-slide">
<img class="slide-img" src="image/slider__bg.jpg" alt="">
</div>
<div class="swiper-slide">
<img class="slide-img" src="image/slider__bg.jpg" alt="">
</div>
</div>
<!-- If we need pagination -->
<div class="swiper-pagination"></div>
</div>
</body>
</html>
const swiper = new Swiper('.swiper-container', {
// Optional parameters
direction: 'vertical',
loop: true,
// If we need pagination
pagination: {
el: '.swiper-pagination',
},
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// And if we need scrollbar
scrollbar: {
el: '.swiper-scrollbar',
},
});
.slider__container{
height: 500px;
}
<div class="slider__container">
<div class="slider__box">
<!-- Slider main container -->
<div class="swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
<div class="swiper-slide">Slide 1</div>
<div class="swiper-slide">Slide 2</div>
<div class="swiper-slide">Slide 3</div>
<div class="swiper-slide">Slide 4</div>
<div class="swiper-slide">Slide 5</div>
<div class="swiper-slide">Slide 6</div>
<div class="swiper-slide">Slide 7</div>
<div class="swiper-slide">Slide 8</div>
<div class="swiper-slide">Slide 9</div>
<div class="swiper-slide">Slide 10</div>
</div>
<!-- If we need pagination -->
<div class="swiper-pagination"></div>
</div>
</div>
</div>
[![
.slider{
width: 1366px;
height: 569px;
overflow: hidden;
}
.middle{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.navigation{
display: flex;
position: absolute;
left: 50%;
bottom: 10px;
transform: translateX(-50%);
}
.bar{
border-radius: 50%;
width:15px;
height: 15px;
background-color: #000;
}
<div class="slider midlle">
<div class="slides">
<input type="radio" name="s" id="r1" checked>
<input type="radio" name="s" id="r2">
<input type="radio" name="s" id="r3">
<input type="radio" name="s" id="r4">
<input type="radio" name="s" id="r5">
<input type="radio" name="s" id="r6">
<input type="radio" name="s" id="r7">
<input type="radio" name="s" id="r8">
<input type="radio" name="s" id="r9">
<input type="radio" name="s" id="r10">
<div class="sllide"><img src="image/slider__bg.jpg" alt=""></div>
<div class="sllide"><img src="image/slider__bg.jpg" alt=""></div>
<div class="sllide"><img src="image/slider__bg.jpg" alt=""></div>
<div class="sllide"><img src="image/slider__bg.jpg" alt=""></div>
<div class="sllide"><img src="image/slider__bg.jpg" alt=""></div>
<div class="sllide"><img src="image/slider__bg.jpg" alt=""></div>
<div class="sllide"><img src="image/slider__bg.jpg" alt=""></div>
<div class="sllide"><img src="image/slider__bg.jpg" alt=""></div>
<div class="sllide"><img src="image/slider__bg.jpg" alt=""></div>
<div class="sllide"><img src="image/slider__bg.jpg" alt=""></div>
</div>
<div class="navigation">
<lable for="r1" class="bar"></lable>
<lable for="r2" class="bar"></lable>
<lable for="r3" class="bar"></lable>
<lable for="r4" class="bar"></lable>
<lable for="r5" class="bar"></lable>
<lable for="r6" class="bar"></lable>
<lable for="r7" class="bar"></lable>
<lable for="r8" class="bar"></lable>
<lable for="r9" class="bar"></lable>
<lable for="r10" class="bar"></lable>
</div>
</div>
.section__video{
position: relative;
z-index: 1;
}
.link__video{
position: absolute;
top: 50%;
left: 50%;
z-index: 2;
}
.link__video:hover{
color: #00B2A0;
}
<div class="section__video">
<div class="container">
<img class="video" src="image/video__bg.jpg" alt="">
<a href=""><img class="link__video" src="image/link__bg.png" alt=""></a>
</div>
</div>