Пишем так сказать скелет из HTML:
Пишем стиль:
Смотрим полученный результат:
HTML:
<div class="container">
<p class="tags"> <span>Tags</span><a class="tag" href="#">CSS</a><a class="tag" href="#">JavaScript</a><a class="tag active" href="#">Trend</a><a class="tag" href="#">API</a><a class="more" href="#">more...</a></p>
<label>
<input class="tag_search" type="search" placeholder="Tag search..."/>
</label>
</div>
<svg class="text-circle" viewBox="0 0 200 200">
<path d="M 100, 100 m -75, 0 a 75,75 0 1,0 150,0 a 75,75 0 1,0 -150,0" id="path"></path>
<text>
<textPath xlink:href="#path">Be cool. Be helpful. The web is a big place. Have fun. High five.</textPath>
</text>
</svg><a class="dribbble" href="https://dribbble.com/shots/5880849-CSS-Tricks-Style-for-tags-bar-search" target="_blank">dribbble shot</a>
SCSS:
$gcolor: #17141d; // global color
$color_: #a1a1af; // text
$border: #28242f;
$blocks: #201c29;
$shadow: #070509;
@mixin font-size($sizeValue: 1.6) {
font-size: $sizeValue + rem;
}
@import url("https://fonts.googleapis.com/css?family=Lato");
*,
::before,
::after {
box-sizing: border-box;
}
body {
margin: 0;
display: flex;
height: 100vh;
align-items: center;
justify-content: center;
overflow: hidden;
font: 600 62.5% "Lato", sans-serif;
background-color: $gcolor;
}
a {
text-decoration: none;
white-space: nowrap;
@include font-size(1);
color: $color_;
&.tag {
display: block;
padding: 0.3em 0.85em;
margin: 0.5em;
text-transform: uppercase;
border: 3px solid $border;
border-radius: 2em;
transition: transform 0.2s;
transition-timing-function: cubic-bezier(0.45, -0.85, 0.55, -0.45);
&:hover {
transform: scale(1.2);
background: linear-gradient(to right, #ff8a00, #da1b60);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
}
}
.container {
margin: 2em 6em;
padding: 3em;
padding-left: 1em;
display: flex;
width: 100%;
justify-content: space-between;
align-items: center;
@include font-size(1);
color: $color_;
border: 1px solid $border;
border-radius: 0.35em;
background-color: $blocks;
background-image: url(https://css-tricks.com/wp-content/themes/CSS-Tricks-17/images/featured-comment.svg);
background-repeat: no-repeat;
background-size: contain;
background-position: 70% 50%;
box-shadow: 0 10px 60px $shadow;
.tags {
margin: 0;
display: flex;
justify-content: center;
align-items: center;
span {
margin-right: 1em;
padding: 1em;
text-transform: uppercase;
transform: rotate(180deg);
writing-mode: vertical-rl;
border-left: 3px solid $border;
background: linear-gradient(to right, #ff8a00, #da1b60);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
a:last-child {
margin-left: 0.5em;
&:hover {
color: white;
}
}
}
// search
label {
position: relative;
white-space: nowrap;
display: flex;
width: 48px;
height: 48px;
align-items: center;
justify-content: flex-end;
border: 3px solid transparent;
border-radius: 2em;
background-color: $gcolor;
background-image: radial-gradient(circle at 50%, #ff8a00, #da1b60);
transition: all 250ms ease-in-out;
&::before {
position: absolute;
right: 0;
bottom: -20px;
z-index: 0;
transform: rotate(-35deg);
width: 4px;
height: 25px;
content: "";
border-radius: 2px;
background-image: linear-gradient(to top, #ff8a00, #da1b60);
transition: all 250ms ease-in-out;
}
.tag_search {
position: relative;
z-index: 1;
display: block;
padding-left: 1.75em;
width: 42px;
height: 42px;
@include font-size(1);
border: 0;
border-radius: inherit;
background-color: $gcolor;
color: white;
transition: width 250ms ease-in-out;
&:focus {
outline: none;
}
}
&:hover {
width: 20%;
&::before {
height: 30px;
transform: rotate(-90deg) translate(28px, 15px);
}
.tag_search {
width: 100%;
padding-right: 1em;
padding-left: 1em;
}
}
}
}
@media (max-width: 991px) {
.container {
background-image: none;
label {
pointer-events: none;
visibility: hidden;
opacity: 0;
}
}
}
.text-circle {
position: absolute;
top: 75%;
left: 50%;
transform: translate(-50%, -50%) rotate(10deg);
z-index: -1;
width: 400px;
path {
opacity: 0;
}
text {
fill: $color_;
opacity: 0.1;
}
}
.dribbble {
position: absolute;
top: 1em;
left: 1em;
}