2015-01-04 88 views
-3

我怎樣才能實現這種效果的文字輸入與CSS?做一個輸入從右凹和從左凹凸起

input

+0

什麼都有你已經試過了? – BenM 2015-01-04 14:10:24

+0

這可以完成,但請向我們展示您的努力。 – Harry 2015-01-04 14:10:28

+2

@哈里,是否有可能通過如何做到這一點來展示你的意思?它不知道從哪裏開始,也很想看到這一點。 – razorsyntax 2015-01-04 14:23:59

回答

1

你可以用input和使用pseudo元素,使其curved爲弧形陰影您可以使用insetbox-shadowinput你可以添加padding

* { 
 
    box-sizing: border-box; 
 
} 
 
div { 
 
    display: inline-block; 
 
    position: relative; 
 
    height: 40px; 
 
} 
 
div:after { 
 
    content: ''; 
 
    width: 40px; 
 
    height: 100%; 
 
    left: 92%; 
 
    top: 0; 
 
    border-radius: 50%; 
 
    background: white; 
 
    position: absolute; 
 
    box-shadow: inset 2px 0px 0px 0px rgb(184, 170, 170); 
 
} 
 
div input { 
 
    width: 100%; 
 
    height: 100%; 
 
    border: 0; 
 
    display: inline-block; 
 
    border-radius: 30px 0px 0px 30px; 
 
    background: #343434; 
 
    padding: 10px; 
 
    color: white; 
 
    font-size: 20px; 
 
    box-shadow: 2px 1px 3px 0px rgb(184, 170, 170); 
 
}
<div> 
 
    <input type="text" /> 
 
</div>

+0

爲什麼 - 你能解釋一下嗎? – 2015-01-04 14:38:45