Excluding a particular style of element [duplicate] - css

This question already has answers here:
Is it possible to exclude all css styling for one specific div container?
(2 answers)
Closed 8 years ago.
I have defined a style for input elements in HTML,
e.g.
input { font-family: Cambria; font-size: 13pt; }
So it by default applies to all the input elements I write in the page.
Now I want one specific input element with no style; can I do that?

The element selector has a lower priority than the class selector, so you can just add a class:
.special-input { font-family: sans-serif; font-size: 10pt; }

Related

what is the 'a' that is added to CSS classes [duplicate]

This question already has answers here:
What does the ">" (greater-than sign) CSS selector mean?
(8 answers)
Closed 1 year ago.
so I have this CSS file and it has this
.post > a {
position: absolute;
color: #fff;
font-size: 22px;
cursor: pointer;
}
and I'm not sure what does the a means exactly?
Selects all <a> elements where the parent is an element with a class post.
https://developer.mozilla.org/en-US/docs/Web/CSS/Child_combinator

CSS apply style with an Id selector [duplicate]

This question already has answers here:
How can I apply styles to multiple classes at once?
(9 answers)
Closed 4 years ago.
Is theres a way with css only to apply a specific style to an element when using an id selector inside a css ??
html:
<div Id="MyClassId"> blablabla </div>
css:
.MyOwnFancyDiv{
font-size: 12pt;
color: #333333;
/* ... */
}
/**
Select a particular element and need to apply the MyOwnFancyDiv style
**/
#MyClassId{
/* want to apply the MyOwnFancyDiv style to this particular element */
}
Thanks
You asked:
I want to apply the MyOwnFancyDiv style to this particular element [the id element]
This can be done as specified -- only via CSS -- like so:
.MyOwnFancyDiv,
#MyClassId {
font-size: 12pt;
color: #333333;
/* ... */
}
This will apply all style rules to each element specified (so the class MyOwnFancyDiv and the id element MyClassId.
This should solve your question. If not, please can you edit and clarify the criteria and scope of your question. Thanks.

hide element but not nested child with css only [duplicate]

This question already has answers here:
Hide text in html which does not have any html tags [duplicate]
(3 answers)
Closed 4 years ago.
I have something like that in an AMP-Page (I cant change the structure as its given and !important is not possible for AMP):
<p class="test">hide me <a>show me</a></p>
How can I achieve hiding the html of the parent bot not the nested a-tag?
I tried this without success:
.test{display:none;}
.test a{display:block;}
and also:
.test:not(a){display:none;}
You can use font-size?
.test {
font-size: 0;
}
.test a {
font-size: 16px;
}
<p class="test">hide me <a>show me</a></p>
Using hidden and visible properties it is possible.
.test {visibility: hidden;}
a {visibility: visible;}

Canceling changes to an individual element in CSS [duplicate]

This question already has answers here:
Apply CSS Style on all elements except with a SPECIFIC ID
(3 answers)
Closed 6 years ago.
How do I cancel the changes to one individual element in CSS?
Example:
a {
text-decoration: line-through;
color: green;
}
Now I would like at the end, a.test to ignore all rules and be displayed in the default way.
The normal colors and decorations of a link would show up on a page without any CSS influence.
All I found was to change every property that changes the element to initial. Is there a universal command that would exempt a.test from all changes?
You can exclude with the :not() CSS pseudo selector
a:not(.test) {
text-decoration: line-through;
color: green;
}
Demo: https://jsfiddle.net/azizn/d17vdf35/

Call a Css class in a nother css class [duplicate]

This question already has answers here:
Can a CSS class inherit one or more other classes?
(29 answers)
Closed 7 years ago.
Hey is it posible to call a css class in an other css class.
e.g.
.test { font-family: verdana;}
.test2 { test ?}
I have a lot of keyframes. and i Need this in only one css class. is it possible?
I think you may want to look at how to nest CSS classes.
You can't do it in normal CSS buy you can by using Sass.
With Sass you can do this:
.test{
font-family: verdana;
.test2 {
/*CSS related only to .test2*/
}
}

Resources