How do I override inline CSS with Class CSS? [duplicate]
Tags: javascript,jquery,css
Problem :
This question already has an answer here:
I am using jQuery to append an element such as:
var mytop=100;
$(this).appendTo('.container')
.last()
.wrap('<div class="action" style="top:' + mytop + 'px;"></div>');
Only mytop
is a calculated number. Since the new element has the class action
, it should later change the top by adding a class moveup
, such as:
$('document').on('click', function(e){
if($(e.target).hasClass('action')){
$(this).addClass('moveup');
}
});
with the CSS as:
.moveup{
top:5px;
}
The problem is, the inline CSS of the appended <div>
overrides the class's CSS. When this newly created item is clicked, it should have its top set at 5px.
How do I override the inline CSS with the Class's CSS?
Solution :
Taken from https://css-tricks.com/snippets/css/style-override-technique/
The !important rule at the end of a value will override any other style declarations of that attribute, including inline styles.
p {
font-size: 24px !important;
}
CSS Howto..
The masonry effect is what you are trying to get to in a way like pinterest layout the best way to go would using column-count: and column-gap: property .masonry {...
Both text & images are being appended to 'fadein', the text should go to 'fadeinSpan' .appendTo('.fadeinSpan'); Example To have the text transition smooth (i.e. not appearing next to each other)...
Or is it any other better way? Are you really asking how to set a background (color) with CSS? You should have a look at the w3 tutorial about...
You have two options (choose one or the other but not both). set float: left; on both #fact and #sortbar set display: inline-block; on both #fact and #sortbar The second...
After days trying to find the answer, I finally found display: table; There was surprisingly very little information available online about how to actually getting it to work, even here,...
Realized I didn't have the good amount of frames... If this is happening to you to; check your number of frames/steps!
http://doc.jsfiddle.net/basic/introduction.html?highlight=normalized#choose-framework Next is the Normalized CSS checkbox, selected by default. If selected, the fiddle will be rendered with normalize.css which is removing most of the browser styling of many HTML...
The simple answer seems to be inline style extends css classes, and doesn't work with ID type css styles. Using class instead of id seems to have done the trick....
The -ms-hyphens property only works in IE10+. It's not possible in IE9 or below. See the browser compatibility chart at the bottom of the reference link you provided. It doesn't...
Ok, i did it on my own. If someone wants to use materializecss form tags in struts2 do the following: 1. Add this line into the struts.xml <constant name="struts.ui.theme" value="simple"...
You can use the nth-child(n+x) selector such as: p:nth-child(n+6) { display:none; } Here's a fiddle demonstrating with the color red for 6+ n+6 is an abbreviation for the formula equation...
Since you want to style the button in an Email, you should use inline styling. It's not usually the way you want to do styles, but because of limitations of...
You can use a normal <table> element for this. Since your data is actually a table, there is no shame in using it here. Alternatively a dl could be valid...
You should separate with a comma, like this: .my_div:hover, .my_td:hover { border: 1px solid red; } ...
li:hover a { color: #F0F; } ...
z-index won't work in this case; z-index is meant for those elements which are stacked one over another i.e. they have overlapping top and left, which is not in your...
You may want to change the following in ui-grid.css .cellheight .ui-grid-row { display: table-row; height: auto !important; } .cellheight .ui-grid-cell { display: table-cell; height: auto !important; vertical-align: middle; float: none;...
Like this demo css body { background-color : #484848; margin: 0; padding: 0; } h1 { color : #000000; text-align : center; font-family: "SIMPSON"; } form { width: 300px; margin:...
First about Order: it's from left to right. so in code... -webkit-transform: skew(30deg) rotate(30deg); it will get skewed first and then rotated. what i was having trouble is that child...
The top: 50% trick won't be precise, since it will be a little lower, there are couple of tricks: Span position is absolute, top is 50% AND margin-top -> -50%...
This is a weird bug indeed. My first try involved specifying a transparent background color: .crispy { position: relative; font-size:.9em; background: rgba(255,255,255,0); } However, this doesn't work. In fact, if...
See the spec: The font size corresponds to the em square, a concept used in typography. Note that certain glyphs may bleed outside their em squares. ...
You cannot edit the file itself. However, you can override styles a number of ways. Create a new style element with the required rules and append to the document. (Example)...
change this to increase size <img src="./images/img04.jpg" width="28" height="28" alt=""/>Submit</button> to change size change width=" " and for height=" " button { color: #900; border: 1px solid #900; font-weight: bold;...
I think you want to float the icon: .icon-small i { float: left; margin-right: 10px; /* ... */ } And for good measure: .icon-small + p { clear: left; /*...
To be honest, I don't necessarily know all the calculations that went into it. I did some fiddling, and here's a modified version that you can plug any number into...
Never faced this problem before (not worked much on email, I avoid it like the plague) but you could try declaring the bullet with the unicode code point (different notation...
What about this? HTML structure: <ul> <li class="task"> <div class="line"> <span class="task-date">Date Created</span> <span class="task-title">Task Title</span> </div> <div class="line"> <span class="task-due-date overdue">Date Overdue</span> <span...
Perhaps the CSS property user-select ? cross-browser : -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -o-user-select: none; user-select: none; Doc : http://www.w3.org/TR/2000/WD-css3-userint-20000216.html#user-select Perhaps you could add the following listeners to the...
This should be enough: Sys.WebForms.PageRequestManager.getInstance().add_endRequest(onEndRequest); function onEndRequest(sender, args) { if (sender._postBackSettings.panelsToUpdate != null) { $("select:not(.chosen-single, .no-chosen)").chosen({ search_contains: true, width: "200px", no_results_text: "Sorry, no match!" }); }...