html - CSS - How to color special shape on hover? -


i've created "tag" shape using css (the rectangular base + triangle). since have more 1 tag shape wanted add hover property class defines shape , way automatically attach hover tags. however, appears not working , way apply hover id. why that? there surely must easier way apply hover several elements @ once.

second question, since tag shape built using 2 shapes, how should hover color transition should made?

jsfiddle

#q{     position:relative;     margin:0 5px 0 10px;     display:inline-block;     height:66px;     padding: 0 35px 0 20px;       font-size: 25px;     line-height:65px;      cursor: pointer;     font-weight: 100;     margin: 20px 25px;      background:#f3f3f3;     transition: background 0.3s;   }  #q:after{     position:absolute;     content:"";     right:-19px;     width: 1px;     height:0px;     border-left:18px solid #f3f3f3;     border-top:  33px solid transparent;     border-bottom: 33px solid transparent;     transition: background 0.3s; }  #q:hover{     background: green;     border-left:18px solid lightblue;  } 

html:

<span class="pricetag-right" id="q">tag here!</span> 

demo page

#q{     position:relative;     margin:0 5px 0 10px;     display:inline-block;     height:66px;     padding: 0 35px 0 20px;       font-size: 25px;     line-height:65px;      cursor: pointer;     font-weight: 100;     margin: 20px 25px;      background:#f3f3f3;     transition: background 0.3s;   }  #q:after{     position:absolute;     content:"";     right:-19px;     width: 1px;     height:0px;     border-left:18px solid #f3f3f3;     border-top:  33px solid transparent;     border-bottom: 33px solid transparent;     transition: border 0.3s; }  #q:hover{     background: green; }  #q:hover:after{     border-left-color:green; } 

you needed set transition of :after border , not background, since it's border property being transitioned.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -