5

введите сюда описание изображения

Как делать подчеркивание такого рода? Есть две идеи, это SVG и просто PNG картинка с абсолютным позиционированием относительно блока с заголовком. Может есть способы с помощью чистого CSS?

2 ответа 2

5

Самое простое решение - это svg

svg {
width:347;
height:188;
background:#3D4248;
}
 #txt {
font-size:70px;
 font-family:sans-serif;
 fill:white;
}
svg path {
fill:none;
stroke:white;
stroke-width:2;
}
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" 
    xmlns:xlink="http://www.w3.org/1999/xlink"
        width="347" height="188" viewBox="0 0 347 188" >  


<text id="txt" x="70" y="120" >Expire</text>
 <path d="m74.9 149.5 97.2 0 5.3 5.7 96.8 0-0.4 0" />
</svg>	 

2

Решение на CSS:

* {
  margin: 0;
  padding: 0;
}

.wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #3D4248;
  margin: 1rem;
  width: 250px;
  height: 200px;
  font-size: 4em;
  font-family: sans-serif;
  color: #fff;
}

.wrapper .line {
  position: absolute;
  bottom: 50px;
  right: 34px;
  width: 98px;
  height: 5px;
  background-color: #3D4248;
  z-index: 2;
}

.wrapper .line::before {
  content: "";
  display: block;
  position: absolute;
  bottom: -0.7px;
  left: -1.8px;
  width: 10px;
  height: 1px;
  background-color: #fff;
  transform: rotate(45deg);
}

.wrapper span {
  position: relative;
}

.wrapper span::before {
  content: "";
  display: block;
  position: absolute;
  bottom: -10px;
  width: 180px;
  height: 1px;
  border-bottom: 1px solid #fff;
}

.wrapper span::after {
  content: "";
  display: block;
  position: absolute;
  bottom: -17px;
  right: 1px;
  width: 91px;
  height: 1px;
  border-bottom: 1px solid #fff;
}
<div class="wrapper">
  <div class="line"></div>
  <span>Expire</span>
</div>

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.