How to Protect an HTML element from it's respective assigned CSS

Tags: html,css

Problem :

Well I wish to know how one can avoid a specific html element from getting styled by the default assigned CSS to it. Let me explain with an example:

Suppose I have an image element with it's respective default CSS assigned to it (img{}) but if I want a particular image element like logo or social icons from getting the default CSS styling then what should I do?

I know of ID's being used to target specific elements in CSS but I wish to know if their is any other way of doing this using some special markup or CSS or use of the wrapped elements like div to overcome default values. Many Thanks in Advance! :)

Solution :

There is no way to prevent CSS rules with a selector that matches an element from applying to that element.

The best you can do is write more specific rules to override them with different values. You could, in browsers that support it, use the initial keyword.

    CSS Howto..

    Twitter Bootstrap 3 - how to properly replace glypicons with custom made icons?

    How do I know when is the right moment to stop using a specific css vendor-prefix?

    How to load .css file from parent directory with .htaccess rule?

    How to Create a CSS3 Animated Circle that chages colors when clicked?

    How to make content div full height when using padding on wrapper?

    how to set base_url() inside css file using codeigniter, to access background_image_url inside css file?

    How can I create a color with values for green, blue, orange, and gold only?

    how to apply css transition to background image

    How to display a div next to another div with no width defined?

    How to make parent fullscreen div to grow with absolutely positioned child using CSS and jeet?

    How to make transparent arrow? [duplicate]

    How to horizontally center text in bootstrap button?

    How to get Facebook Like Box “Dark Scheme” to work correctly? (Background is transparent.)

    how to repeat a small background image througout the page?

    How to set dynamic value in css? [closed]

    How to make float navbars with JS and CSS?

    Rails - how to build a grid-like list of product page

    how to make the textarea's width fixed but keep the height flexible CSS

    Conditional css showing limit items

    Show/hide (fade in/out) several DIVS inside table row with several A HREF in other row and columns

    How can I have multiply a pixel width value with LESS Css?

    How to make a scrollable div inside of a div with a specific height

    In css how to joining two div classes without space? [closed]

    How to disable and enable css rule

    How to draw error icon with css only,exactly like in the image

    How to give all divs same amount of space on each side

    How to edit HTML with CSS? [closed]

    how to achieve facebook mobile site buttons menu scroll effect?

    How to completely fill screen with smaller elements?

    How to turn on Visual Studio 2008 .css Intellisense on .less file