Есть ли шанс создать изображение с помощью трюков CSS / HTML, таких как CD Trey с CD Rings - PullRequest
0 голосов
/ 11 января 2019
  • Я использую CSS и HTML для создания изображений, таких как (CD трее с компакт-дисками, пожалуйста, не то же самое, просто представьте).
  • Я пытался, но мне нужно изображение, как Task-Image
  • здесь я попробовал с моим кодом

Для подставки HTML

<div class="baseStand">
    <span class="stand"></span>
</div>

CSS

.stand {
  content: "\007c";
  height: 400px;
  width: 40px;
  background-color: grey;
  left: 88px !important;
  position: fixed !important;
  top: 12% !important;
  border-radius: 15px;
}

Здесь для колец HTML

<div class="main_div">    
    <div class="div-list-1">      
      <ul class="tabrow">
        <li style="background-color: red">
          <a style="cursor: pointer;" data-toggle="modal" data-target="#modal">Tabd-1</a>
        </li>

        <li style="background-color: green">
          <a style="cursor: pointer;" data-toggle="modal" data-target="#modal">Tabd-2</a>
        </li>

        <li style="background-color: yellow" class="selected">
          <a style="cursor: pointer;" data-toggle="modal" data-target="#modal">Tabd-3</a>
        </li>
        <li style="background-color: blue">
          <a style="cursor: pointer;" data-toggle="modal" data-target="#modal">Tabd-4</a>
        </li>
      </ul>
      <span class="span-name">
        <a class="span-name-1" style="cursor: pointer;">Name Here</a>
      </span>
    </div>
  </div>

Здесь код Css

.div-list-1 {
    border-radius: 25px;
    background: #73AD21;
    height: 40px;          
    margin-top: 0px; 
}
  .span-name {
    color: white;
    text-align: center;
    /* padding-left: 20%;
    padding-bottom: 10%; */
    margin: 0 auto;
    display: block;
}

Здесь код css

.tabrow {
    text-align: center;
    list-style: none;
    /* margin: 200px 0 20px; */
    padding: 0px;
    line-height: 20px;
    height: 20px;
    overflow: hidden;
    font-size: 15px;
    font-family: verdana;
    position: relative;
    margin-bottom: 0% !important;        
}
.tabrow li:first-child{    
    border: 1px solid #AAA;
    background: #D1D1D1;
    background: -o-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    background: -ms-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    background: -moz-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    background: -webkit-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    background: linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    display: inline-block;
    position: relative;
    z-index: 0;
    border-top-left-radius: 15px;
    /* box-shadow: 0 3px 3px rgba(0, 0, 0, 0.4), inset 0 1px 0 #FFF;
    text-shadow: 0 1px #FFF; */
    margin: 0 -5px;
    padding: 0 18px;
    color: white;
    font-weight: bold;
}    
.tabrow li {
    border: 1px solid #AAA;
    background: #D1D1D1;
    background: -o-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    background: -ms-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    background: -moz-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    background: -webkit-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    background: linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    display: inline-block;
    position: relative;
    z-index: 0;
    margin: 0 -5px;
    padding: 0 18px;
    color: white;
    font-weight: bold;
}    
.tabrow li:last-child {    
    border: 1px solid #AAA;
    background: #D1D1D1;
    background: -o-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    background: -ms-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    background: -moz-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    background: -webkit-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    background: linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    display: inline-block;
    position: relative;
    z-index: 0;
    border-top-right-radius: 15px;        
    margin: 0 -5px;
    padding: 0 18px;
    color: white;
    font-weight: bold;
}    
.tabrow a {
      color: #FFF;
      text-decoration: none;
      font-size: medium;
      font-family: Verdana, Geneva, Tahoma, sans-serif;
}
  • с кодом выше, получаю вот так Изображение Tried-Code

  • контрольный код Здесь Код редактора

  • справка по этому тексту с помощью li / span
  • спасибо заранее .. все же я не получил никакого решения.

Ответы [ 2 ]

0 голосов
/ 11 января 2019

Вы можете создать векторизованное изображение в Illustrator, а затем преобразовать его в код SVG для HTML.

Примеры с SVG: https://www.w3schools.com/graphics/svg_examples.asp

Практическое руководство здесь: https://svgontheweb.com/

Вдохновение: https://www.awwwards.com/websites/svg/

0 голосов
/ 11 января 2019

Вот пример, объединяющий преобразование и некоторый градиент:

.CD {
  width: 200px;
  height: 200px;
  margin: auto;
  background: 
   linear-gradient(to bottom, #000 0, 
    #000 calc(50% - 20px), transparent calc(50% - 20px), 
    transparent calc(50% + 20px), #000 calc(50% + 20px)) 
   center/3px 100%, 
   linear-gradient(to right, #000 0, 
    #000 calc(50% - 20px), transparent calc(50% - 20px), 
    transparent calc(50% + 20px), #000 calc(50% + 20px)) 
   center/100% 3px, 
   radial-gradient(circle at center, transparent 20px, #000 21px, #000 23px, grey 24px);
  background-repeat: no-repeat;
  border: 2px solid;
  border-radius: 100%;
  position: relative;
  transform: perspective(350px) rotateX(65deg);
}
.CD::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: inherit;
  background-size: 3px 100%, 100% 3px, 0 0;
  border-radius: inherit;
  transform: rotate(45deg);
}
.bar {
  width: 20px;
  height: 74px;
  margin: 25px auto -112px;
  z-index: 1;
  position: relative;
  border-radius: 4px 4px 8px 8px;
  background: #000;
}
.middle {
  height: 110px;
  width: 212px;
  background: 
   linear-gradient(#000,#000) calc(100% - 18px) 10px/3px 50%,
   linear-gradient(#000,#000) 18px 10px/3px 50%,
   linear-gradient(#000,#000) center/4px 50%,
   linear-gradient(#000,#000) top right/3px 50%,
   linear-gradient(#000,#000) top left/3px 50%,
   radial-gradient(85% 100% at top center, 
    red 75%,#000 76%,
    #000 calc(76% + 3px) ,transparent calc(76% + 4px));
  background-repeat:no-repeat;
  margin: -90px auto 0;
}
.bottom {
  height: 110px;
  width: 212px;
  background: 
   linear-gradient(#000,#000) top right/3px 50%,
   linear-gradient(#000,#000) top left/3px 50%,
   radial-gradient(85% 100% at top center, 
    green 75%,#000 76%,
    #000 calc(76% + 3px) ,transparent calc(76% + 4px));
  background-repeat:no-repeat;
  margin: -70px auto;
  position: relative;
  z-index: -1;
}
<div class="bar"></div>
<div class="CD"></div>
<div class="middle"></div>
<div class="bottom"></div>

А вот с вкладками:

.CD {
  width: 200px;
  height: 200px;
  margin: auto;
  background: 
   linear-gradient(to bottom, #000 0, 
    #000 calc(50% - 20px), transparent calc(50% - 20px), 
    transparent calc(50% + 20px), #000 calc(50% + 20px)) 
   center/3px 100%, 
   linear-gradient(to right, #000 0, 
    #000 calc(50% - 20px), transparent calc(50% - 20px), 
    transparent calc(50% + 20px), #000 calc(50% + 20px)) 
   center/100% 3px, 
   radial-gradient(circle at center, transparent 20px, #000 21px, #000 23px, grey 24px);
  background-repeat: no-repeat;
  border: 2px solid;
  border-radius: 100%;
  position: relative;
  transform: perspective(350px) rotateX(65deg);
  z-index:1;
}
.CD::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: inherit;
  background-size: 3px 100%, 100% 3px, 0 0;
  border-radius: inherit;
  transform: rotate(45deg);
}
.bar {
  width: 20px;
  height: 74px;
  margin: 25px auto -112px;
  z-index: 2;
  position: relative;
  border-radius: 4px 4px 8px 8px;
  background: #000;
}
.middle {
  height: 110px;
  width: 212px;
  background: 
   linear-gradient(#000,#000) calc(100% - 18px) 10px/3px 50%,
   linear-gradient(#000,#000) 18px 10px/3px 50%,
   linear-gradient(#000,#000) center/4px 50%,
   linear-gradient(#000,#000) top right/3px 50%,
   linear-gradient(#000,#000) top left/3px 50%,
   radial-gradient(85% 100% at top center, 
    red 75%,#000 76%,
    #000 calc(76% + 3px) ,transparent calc(76% + 4px));
  background-repeat:no-repeat;
  margin: -90px auto 0;
  display:flex;
}
.bottom {
  height: 110px;
  width: 212px;
  background: 
   linear-gradient(#000,#000) top right/3px 50%,
   linear-gradient(#000,#000) top left/3px 50%,
   radial-gradient(85% 100% at top center, 
    green 75%,#000 76%,
    #000 calc(76% + 3px) ,transparent calc(76% + 4px));
  background-repeat:no-repeat;
  margin: -70px auto;
  position: relative;
  z-index: -1;
}

.middle > span:first-child,
.middle > span:last-child{
  height: 63px;
  width: 15px;
  margin:0 3px;
}
.middle > span:nth-child(2),
.middle > span:nth-child(3){
  flex-grow:1;
  height:83px;
}
.middle > span:first-child {
  border-radius: 0 0 0 24px;
  background: pink;
}
.middle > span:last-child {
  border-radius: 0 0 24px 0;
  background: orange;
}
.middle > span:nth-child(2) {
  margin-right: 2px;
  border-radius: 0 0 0 86px/0 0 0 24px;
  background:blue;
}
.middle > span:nth-child(3) {
  margin-left: 2px;
  border-radius: 0 0 86px 0/0 0 24px 0;
  background:purple;
}
.middle > span {
  cursor:pointer;
}
.middle > span:hover {
  filter:brightness(50%);
}
<div class="bar"></div>
<div class="CD"></div>
<div class="middle">
  <span></span>
  <span></span>
  <span></span>
  <span></span>
</div>
<div class="bottom"></div>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...