I'm using a css speech bubble generator to generate a speech bubble, but when I hover over the speech bubble, the speech bubble needs to change to be white. The little arrow bit that sticks out however is not changing to be white.
Code:
styling in the php code:
<style>
.bubble
{
position: relative;
width: 250px;
height: 65px;
padding: 0px;
background: #ff8282;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
}
.bubble:after
{
content: '';
position: absolute;
border-style: solid;
border-width: 15px 0 15px 24px;
border-color: transparent #ff8282;
display: block;
width: 0;
z-index: 1;
margin-top: -15px;
right: -24px;
top: 50%;
}
#go-button:hover .bubble:after {
border-color: #ffffff;
background: #ffffff;
}
.bubble:hover {
border-color: #ffffff;
background: #ffffff;
}
.bubble:hover .bubble:after {
border-color: #ffffff;
background: #ffffff;
}
</style>
html:
<div type="submit"
value="GO"
id="go-button"
class="bubble">
</div>
In a seperate stylesheet:
#go-button,
#add-go-button,
#show-shops-button,
#show-comments-button,
#edit-product-button {
font: 200 14px 'Helvetica Neue', Helvetica, Arial, sans-serif;
border-radius: 6px;
height: 64px;
text-decoration: none;
width: 100%;
background-color: #ff8282;
padding: 12px;
border: 0px solid #fff;
color: #fff;
cursor: pointer;
}
#go-button h5,
#add-go-button h5 {
font-size: 16px;
font-weight: 200;
}
#go-button:hover,
#add-go-button:hover,
#try-now-button:hover {
text-decoration: none;
background-color: #fff;
color: #fc4747;
}
image of problem:
How come the arrow bit of the speech bubble is not changing to white when hovering over the #go-button div (the rectangular portion of the speech bubble is turning white when hovering - just not the arrow portion)?
Change this
#go-button:hover .bubble:after {
border-color: transparent #ffffff;
}
to
#go-button.bubble:hover:after {
border-color: transparent #ffffff;
}
Here you go:
jsFiddle
just change:
#go-button:hover .bubble::after {
border-color: #ffffff;
background: #ffffff;
}
to:
#go-button:hover:after {
border-style: solid;
border-width: 15px 0 15px 24px;
border-color: transparent #ffffff;
}
No need to use class from same element that you used ID for hovering after.
Following the below instructions should fix the issue.
Remove
#go-button:hover .bubble:after {
border-color: #ffffff;
background: #ffffff;
}
Replace
.bubble:hover .bubble:after {
border-color: #fff;
background: transparent;
}
With
.bubble:hover::after {
border-color: #fff;
background: transparent;
}
Hope it helps
Related
I'm unable to get the hover background color timing to sync with :before. How can I fix this issue?
When you hover over the button, you will notice the transition of the background color is not in sync.
JSFIDDLE DEMO: https://jsfiddle.net/7c25wmuz/
.btn-primary {
background-color: #2c9ff5;
border-color: #2c9ff5;
text-transform: capitalize;
}
.btn.btn-primary:hover {
background-color: #45aff6;
border-color: #45aff6;
}
.btn-donate {
background-color: #053a86;
color: #fff;
margin-left: 15px;
padding-left: 40px;
padding-right: 30px;
padding-top: 2px;
text-transform: uppercase;
border-radius: 4px 0 0 4px;
height: 30px;
position: relative;
border: none;
}
.btn-donate:before {
content: '';
position: absolute;
top: 0;
left: 0;
border-top: 30px solid white;
border-right: 20px solid #053a86;
width: 0;
}
.btn-donate:hover::before {
border-right: 20px solid #45aff6;
}
Donate
Clip path is the solution you need for something like this.
.btn-primary {
background-color: #2c9ff5;
border-color: #2c9ff5;
text-transform: capitalize;
clip-path: polygon(20% 0, 100% 0, 100% 100%, 0% 100%);
}
.btn.btn-primary:hover {
background-color: #45aff6;
border-color: #45aff6;
}
.btn-donate {
background-color: #053a86;
color: #fff;
margin-left: 15px;
padding-left: 40px;
padding-right: 30px;
padding-top: 2px;
text-transform: uppercase;
border-radius: 4px 0 0 4px;
height: 30px;
position: relative;
border: none;
transition: .5s all ease;
}
Donate
You can just add a background transition to .btn-donate and border transition to .btn-donate:before like so:
(added padding bottom to see things)
body {
margin-top: 15px;
}
.btn-primary {
background-color: #2c9ff5;
border-color: #2c9ff5;
text-transform: capitalize;
}
.btn.btn-primary:hover {
background-color: #45aff6;
border-color: #45aff6;
}
.btn-donate {
background-color: #053a86;
color: #fff;
margin-left: 15px;
padding-left: 40px;
padding-right: 30px;
padding-top: 2px;
padding-bottom: 1rem;
text-transform: uppercase;
border-radius: 4px 0 0 4px;
height: 30px;
position: relative;
border: none;
transition: .3s ease background;
}
.btn-donate:before {
content: '';
position: absolute;
top: 0;
left: 0;
border-top: 30px solid white;
border-right: 20px solid #053a86;
width: 0;
transition: .3s ease border;
}
.btn-donate:hover::before {
border-right: 20px solid #45aff6;
}
Donate
It seems you runned into conflict with browser default styles. You can see default styles in your Developer tools (F12) you just need to enable it. Go to developer tools settings and check "Show browser styles".
This issue can be simply fixed by overriding default styles with your own.
body {
margin-top: 15px;
}
.btn {
transition: unset; /* override, this is all you need */
display: block;
height: 30px;
}
.btn-primary {
background-color: #2c9ff5;
border-color: #2c9ff5;
text-transform: capitalize;
}
.btn.btn-primary:hover {
background-color: #45aff6;
border-color: #45aff6;
}
.btn-donate {
background-color: #053a86;
color: #fff;
margin-left: 15px;
padding-left: 40px;
padding-right: 30px;
padding-top: 2px;
text-transform: uppercase;
border-radius: 4px 0 0 4px;
height: 30px;
position: relative;
border: none;
}
.btn-donate:before {
content: '';
position: absolute;
top: 0;
left: 0;
border-top: 30px solid white;
border-right: 20px solid #053a86;
width: 0;
}
.btn-donate:hover::before {
border-right: 20px solid #45aff6;
}
Donate
So here is poor me,trying to apply custom css to RadTabStrip with following css and html.Although this is telerik control but the problem is just pure css/html.
I am trying to design Menubar as shown in image below.
Please note that i dont want to use RadTemplate,so i can not change DOM here.
Please look at code snippet and images below to get an idea of problem!
<div class="RadTabStrip_Custom">
<div class="rtsLevel rtsLevel1">
<ul class="rtsUL">
<li class="rtsLI FirstChild">
<span class="rtsLink">
<span class="rtsTxt">Delivery Settings</span>
</span>
</li>
<li class="rtsLI rtsSelected selectedLI rtsClicked">
<span class="rtsLink">
<span class="rtsTxt">Pick a Template</span>
</span>
</li>
<li class="rtsLI LastChild rtsClicked">
<span class="rtsLink">
<span class="rtsTxt">Almost Done</span>
</span>
</li>
</ul>
</div>
</div>
I have used ::after and ::before to get arrow effect but the thing is when it is selected it should only display border not whole arrow with background-color.I am lost over here,even tried ::after(2) and ::before(2) but i came to know from from here that it is not supported in major browser.How can i get this effect?
.RadTabStrip_Custom {
color: #000;
font: 12px "Segoe UI",Arial,Helvetica,sans-serif;
line-height: 26px;
background-color: #ffffff;
width: 100%;
}
.RadTabStrip_Custom .rtsUL {
margin: 0;
padding: 0;
list-style: none;
width: 80%;
border: 0px solid red;
}
.RadTabStrip_Custom .rtsLI {
width: 20%;
overflow: visible !important;
position: relative;
left: 4px;
}
.RadTabStrip_Custom .rtsLI .rtsFirst {
overflow: hidden !important;
}
.RadTabStrip_Custom .rtsGhostTab {
border-color: #0f1d48;
border-radius: 5px;
color: #fff;
background-color: #324d92;
}
.RadTabStrip_Custom .rtsLI {
color: #fff;
font-size: 18px;
font-family: "Segoe UI",Arial,Helvetica,sans-serif;
margin-right: 1%;
background-color: #ffffff !important;
background-image: none !important;
color: #b7d6e8 !important;
padding: 9px;
}
.RadTabStrip_Custom .rtsLink, .RadTabStrip_Custom .rtsLink:hover {
background-color: #044666;
background-image: none;
color: #fff;
font-size: 18px;
font-family: "Segoe UI",Arial,Helvetica,sans-serif;
margin-right: 1%;
padding: 9px;
}
.RadTabStrip_Custom .rtsSelected .rtsLink, .RadTabStrip_Custom .rtsSelected .rtsLink:hover {
background-color: #ffffff;
background-image: none;
color: #b8d5e5;
font-size: 18px;
font-family: "Segoe UI",Arial,Helvetica,sans-serif;
margin-right: 1%;
padding: 9px;
border-top: 1px solid #b8d5e5;
border-bottom: 1px solid #b8d5e5;
}
.RadTabStrip_Custom .rtsLink::before {
content: "";
position: absolute;
top: 50%;
margin-top: -22px;
border-width: 22px 0 22px 16px;
border-style: solid;
border-color: #004466 #004466 #004466 transparent;
left: -7px;
}
.RadTabStrip_Custom .rtsLink::after {
content: "";
position: absolute;
top: 50%;
margin-top: -22px;
border-top: 22px solid transparent;
border-bottom: 22px solid transparent;
border-left: 16px solid #004466;
right: -5px;
}
.FirstChild .rtsLink {
border-left: 1px solid #b8d5e5;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
}
.FirstChild .rtsLink::before {
content: "";
border-width: 0;
}
.LastChild .rtsLink {
border-right: 1px solid #b8d5e5;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
.LastChild .rtsLink::after {
content: "" !important;
border-top: 0 solid transparent;
border-bottom: 0 solid transparent;
}
"pick a template" tab is selected in both images,No worries about inverse color scheme.
What i have design till now
What i want to design
To achieve that (if I understand what you want to do), you will have to apply the :hover on the <li> but not on <span>.
Doing so you will be able to use pseudo-elements on both of them doing something like :
li:hover:before {
//do my border-bottom stuff
}
li:hover .rtsLink:before {
//do my arrow stuff
}
li:hover .rtsLink:after {
//do my arrow stuff
}
Let me know if it's what you wanted of if I'm not clear.
I used ::before and ::after for inner span "rtsTxt" and it worked... :)
.RadTabStrip_Custom .rtsSelected .rtsLink .rtsTxt::before
.RadTabStrip_Custom .rtsSelected .rtsLink::before
I have this button/speech bubble:
Code:
<div value="GO" id="go-div" class="bubble">
<input type="submit" value="GO" id="go-button" style=" position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;" data-target="#search-results-page">
</div>
I have this styling, to change the little arrow colour, when hovering on the button:
#go-div.bubble:hover:after {
border-color: transparent #ffffff;
}
Which gives this effect when hovering over the bubble:
However, when I hover over the little arrow it doesn't cause the whole button to change color:
What is the css that selects the little arrow (.bubble:after) hover and effects the whole button (.button) to turn it white?
Here is the jsfiddle
You can apply your :hover style to the parent element and since :after is a child when you hover on the arrow it will trigger hover on parent.
#go-div:hover #go-button{
background: white;
}
.bubble
{
position: relative;
width: 250px;
height: 65px;
padding: 0px;
background: #ff8282;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
}
.bubble:after
{
content: '';
position: absolute;
border-style: solid;
border-width: 15px 0 15px 24px;
border-color: transparent #ff8282;
display: block;
width: 0;
z-index: 1;
margin-top: -15px;
right: -24px;
top: 50%;
}
#go-div.bubble:hover:after {
border-color: transparent #ffffff;
}
#go-button:hover {
text-decoration: none;
background-color:white;
color: brand-red
}
#go-button,
#go-div{
font: 200 14px 'Helvetica Neue', Helvetica, Arial, sans-serif;
border-radius: 6px;
height: 64px;
text-decoration: none;
width: 100%;
background-color: #ff8282;
padding: 12px;
border: 0px solid #fff;
color: #fff;
cursor: pointer;
}
#go-div:hover #go-button{
background: white;
}
<div value="GO" id="go-div" class="bubble">
<input type="submit" value="GO" id="go-button" style=" position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;" data-target="#search-results-page">
</div>
You can't use .bubble:hover:after to select the entire bubble as shown below:
.bubble:hover:after .bubble {
background-color: #ffffff;
}
So, your only choice is to put the :hover on the parent element. This way both elements will be affected and no further action will be needed:
.bubble:hover > #go-button {
background: #ffffff;
}
You can check out an updated, working version of your jsFiddle here.
I have a textarea with border attributes :
#my_textarea{
border-color: #EEEEEE;
border-style: solid;
border-width: 2px;
width: 95%;
min-height: 550px;
padding: 30px;
margin-top: 28px;
/* Text style */
font-family: Times-Italic;
font-size: 19px;
color: #717171;
line-height: 27px;
text-align: left;
resize: none;
}
I want the text inside this textarea to have opacity. But when I set opacity: 0.5; it also affects the border.
How to set opacity only on text inside textarea and not text + border ?
Just use an RGBA text color
color: rgba(113,113,113,0.5);
body {
background: lightgreen;
}
#my_textarea {
border-color: #EEEEEE;
border-style: solid;
border-width: 2px;
width: 95%;
min-height: 100px;
padding: 30px;
margin-top: 28px;
/* Text style */
font-family: Times-Italic;
font-size: 19px;
color: rgba(113, 113, 113, 0.5);
line-height: 27px;
text-align: left;
resize: none;
}
<div id="my_textarea">
<p>Lorem ipsum dolor sit amet.</p>
</div>
Using an RGBA value for your color should fix the problem you have.
Below is an example.
body {
background: red;
}
#my_textarea {
border-color: #EEEEEE;
border-style: solid;
border-width: 2px;
width: 95%;
min-height: 550px;
padding: 30px;
margin-top: 28px;
font-family: Times-Italic;
font-size: 19px;
line-height: 27px;
text-align: left;
resize: none;
color: rgba(113,113,113, 0.5);
background: transparent;
}
<textarea id="my_textarea">Lorum Ipsum</textarea>
Generator
Expanding what #Paulie_D said you should set opacity as rgba color for text:
#my_textarea{
rgba(113, 113, 113, 0.5); //instead of #717171
}
Also there is a nice hex-> rgba color converter
An alternative solution to complement the other answers, for IE8 (if required - as RGBA is not supported by it) would be to have a wrapper element around the textarea and use opacity instead of RGBA color:
body {
background: red;
}
.foo {
border-color: #EEEEEE;
border-style: solid;
border-width: 2px;
}
#my_textarea {
width: 95%;
min-height: 550px;
padding: 30px;
margin-top: 28px;
font-family: Times-Italic;
font-size: 19px;
line-height: 27px;
text-align: left;
resize: none;
background: transparent;
color: #717171;
opacity: 0.5;
}
<div class="foo">
<textarea id="my_textarea">Lorum Ipsum</textarea>
</div>
So, it's pretty easy to set a hover over effect for an element. But what I want is when the user hovers over a button that has text in it, to make the button turn from black to white and the text from white black at the same time. Instead of two separate elements. How should I do this?
Thanks!
#signUpBox {
width: 150px;
height: 47px;
border-style: solid;
border-width: 1px;
margin: auto;
margin-top: 25px;
border-radius: 2px;
}
#signUpBox:hover {
background-color: #ffffff;
}
h3 {
text-align: center;
margin-top: -35px;
letter-spacing: 1px;
font-size: 17px;
}
I'm not sure how you have the code set up but this would work on a div with an onclick function attached as a button:
#signUpBox {
width: 150px;
height: 47px;
border: solid 1px #000;
margin: auto;
margin-top: 25px;
border-radius: 2px;
color:#000;
background:#fff;
}
#signUpBox:hover {
background: #000;
color:#fff;
}
HTML:
<div id="signUpBox">This is a test</div>
DEMO
#signUpBox:hover {
background-color: #ffffff;
color:#000000;
}
you can do
#signUpBox:hover h3 {
color: #000;
}
JSFIDDLE
change text color using color property on hover.
#signUpBox:hover {
background-color: black;
color: white;
}
Here is a demo.
#signUpBox {
width: 150px;
height: 47px;
border-style: solid;
border-width: 1px;
margin: auto;
margin-top: 25px;
border-radius: 2px;
background: #000000;
color: #FFFFFF;
}
#signUpBox:hover {
background: #ffffff;
color: #000000;
cursor: pointer;
}
Fiddle