My H2 Element Is Not Obeying in CSS

Several potential reasons exist that cause a secondary heading, or H2 element, not to behave according to the parameters you set for it in a cascading style sheet (CSS) document. Troubleshoot the element to make it behave according to the parameters, regardless of the reason for its initial failure to do so.

  1. Element Missing

    • If you find the H2 element isn't displaying the way it should, open the "style.css" document within your site's "File Manager," and inspect it to make sure you've specified behavior rules for the element. H2 is a commonly used element, so if you haven't listed it in the CSS document, it will behave according to the defaults for your blog or site. If no element labeled ".h2" or "#h2" appears, you haven't specified parameters for it, and you must do so.

    Element Name Discrepancy

    • If an H2 element exists in your style sheet but isn't behaving as expected on your page, make sure it is typed out correctly in your style sheet. Elements listed as ".h.2" or "#h-2," for example, aren't the same as ".h2" or "#h2." It isn't important whether you use a period or number sign before the element to set it off, but it is important for the "h" and "2" to be contiguous and unbroken.

    Syntax Error in CSS Document

    • A syntax error in the element within the CSS document will cause it not to display properly. For example, if you want the text style to be "bold," but misspell the word "bold," the document can't interpret it properly. Similarly, if you specify two styles -- "bold" and "italic," for example -- but don't put a semicolon between them, you have a style called "bold italic" or "bolditalic," which CSS documents can't interpret.

    Syntax Error in HTML Document

    • A syntax error within the HTML document may also cause the problem. Most basically, you may forget to close out the H2 tag. To do this, make sure your element begins with <h2> and ends with </h2>, not another <h2>. Additionally, ensure the "h" and "2" within the HTML document are contiguous and don't bear either of the offset marks -- "." or "#" -- that you use within the CSS document. CSS documents, are able to interpret these marks, but HTML documents can't.

Related Searches:

References

Comments

Related Ads

Featured