This question already has answers here:
How to change the style of the title attribute inside an anchor tag?
(10 answers)
Closed 6 years ago.
I'm trying to change the pop-up of an element using CSS, yet it doesn't work.
name {
background-color: #00BBFF;
color: white;
}
<button title="name">Test</button>
Looks like you want to use the attribute selector https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors
button[title="name"] {
background-color: #00BBFF;
color: white;
}
<button title="name">Test</button>
Unfortunately, the tooltip style cannot be changed in any browser.
I'd suggest you implementing your own with CSS (add a hidden span or some other element with the tooltip and show it on button:hover) or JS (nicer as you could set a delay before is shown).
Related
This question already has answers here:
Which CSS properties are inherited?
(4 answers)
Closed 7 months ago.
<nav>
HOME
SPEAKERS
SCHEDULE
VENUE
REGISTER
</nav>
when i target the 'nav' element in CSS, I am able to change properties such as the font-size/font-weight/letter-spacing of the content of the 'a' element. However, I cannot change the text color. In order to do so, I have to target 'nav a'.
Why am I able to target some typographical properties when specifying just 'nav' but not others?
Because has a default font color, it does not inherit the parent element's font color.
href's or hyperlinks have custom browser styles including text color. Hence, is why you have to specify a specific color to override the default.
nav a {
text-decoration: none;
color: inherit;
}
<nav>
HOME
SPEAKERS
SCHEDULE
VENUE
REGISTER
</nav>
The child tag does not inherit the style of a parent, when it has its own style.
a tag has a default style:
a: -webkit-any-link {
color: -webkit-link;
cursor: pointer;
text-decoration: underline;
}
Therefore, you should use more specific the selector
This question already has answers here:
What does a space mean in a CSS selector? i.e. What is the difference between .classA.classB and .classA .classB? [duplicate]
(3 answers)
Closed 2 years ago.
I came across the :active element in CSS. This is the Mozilla documentation page of :active element.
https://developer.mozilla.org/en-US/docs/Web/CSS/:active
They have used this example
form :active {
color: red;
}
form button {
background: white;
}
<form>
<label for="my-button">My button: </label>
<button id="my-button" type="button">Try Clicking Me or My Label!</button>
</form>
I cannot clearly understand why :active element applies to all of the form elements by giving a delimiter(space) between form and :active as in form :active. How does CSS apply this principle?
Because when you divide css selector with space, you go deeper into element hierarchy.
form :active {
color: red;
}
That record applies this style to every particular active element in form, including descendants.
This question already has answers here:
How to change the style of the title attribute inside an anchor tag?
(10 answers)
Closed 6 years ago.
I am trying to apply style for title attribute of a span tab. The span is already using a style class i want to use the same class to apply my style is it possible ?
<span class="span_class" title="100"> hello </span>
.span_class {
}
I want to change the background colour of the title.
the question is answered here: How to change the style of Title attribute inside the anchor tag?
alternatively, you should use a javascript library (there are several of them) like https://jqueryui.com/tooltip/
I think you should also add the aria-label attribute to ensure accessibility.
Can you use scss to have the same style? Something like that?
#mixin myclassforspan{
background:blue;
color:white;
padding:10px 2px;
}
.span_class[title] {
#include myclassforspan;
&:hover{
position: relative;
&:after{
#include myclassforspan;
content: attr(title);
position: absolute;
left: 0;
top: 100%;
z-index: 20;
}
}
}
This question already has answers here:
How to remove underline from a link in HTML?
(8 answers)
Closed 6 years ago.
I was wondering how you would disable to underline on the "a" attribute, for href's. I find it annoying, and I was wondering if there was a bit of code I could add to my .css to change it. Thank you.
A simple google search provides this very easy....
a {
text-decoration: none;
}
simply set a {text-decoration:none}
see in action:
a {
text-decoration: none
}
No Underline
EDIT (I am editing this to whoever downvote it, because that could be the only reason for)
In case you have multiple a's and some of them don't have the attribute href then you can target the href like this:
/*demo */
div {
border: dotted lightblue;
margin: 10px;
font-size:30px
}
a {
display: block;
}
/*in action*/
div:last-of-type a[href] {
text-decoration: none
}
<div>
<a>Without href doesn't make it a link</a>
Link with Underline
</div>
<div>
<a>Without href doesn't make it a link</a>
Link Without Underline
</div>
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to write a:hover in inline CSS?
Is it possible to do this:
link
a{ color: red; }
a:hover{ color: blue; }
As inline?
link
No. style="" allows to define only list of style properties. No CSS selectors are allowed there.