How to Stop CSS Inheritance

To stop CSS inheritance you must override the style in the HTML element's properties. For instance, if you have a font style set for blue and you want to set a section of text to a different color, you specify the new color in the text properties. You can override any element's inherited properties in the HTML tag code.

Instructions

    • 1

      Right-click the HTML file you want to edit. Click "Open With" then click the editor you want to use for your code changes.

    • 2

      Locate the HTML tag you want to edit. The tag inherits its container property. For instance, if you have a <div> tag within another div tag, the <div> inherits its container property. If the <div> tag is set with blue text, then all embedded div tags also have blue text.

    • 3

      Change the property of the HTML tag you want to override. Any style you set in the HTML tag overrides the existing inheritance. For instance, if you want to change the font color add the following style to the tag:

      style="color:#000000;"

      The style above changes the text color to black.

    • 4

      Change each of the styles you want to override and save the changes. Open the file in a Web browser to verify and review the edits.

Related Searches:

References

Comments

Related Ads

Featured