I have elements (for example a div or a paragraph) which I don't want to inherit styles from their parent elements.
for example
<style>
div{
padding:3px;
}
/* and so many other basic tags styled like p, table, td, span, etc*/
</style>
<nonsensetag id="textToGrab">
<div>Hello World</div>
<p>Hi world</p>
</nonsensetag>
so basically I can't use div
or p
to wrap the HelloWorld and Hiworld because it will be formatted by css rules but the real reason why I want to just wrap them in a tag so I can grab them using javascript while not affecting its current style.
alert($('#textToGrab').text());
now what is the html tag that doesn't really do nothing? or do I need to wrap it with valid html tag and reset all the styles forcefully because css cascades? or its is safe to create my own html tag? if there's a possibility that I can add something in the standard html schema?
I read this question already but it doesn't quite fit on my situation