Presentation and Content

Description

Some HTML elements have an impact on presentation. When the browser encounters a element, it will change the way the content is displayed.

The code element is one of them. When the browser encounters the code element, it displays the enclosed content using a fixed-width font.

The use of HTML elements to manage presentation is now strongly discouraged.

You should use HTML elements to define the structure and use Cascading Style Sheets (CSS) to control the presentation.

Example

CSS stands for Cascading Style Sheets. It defines how to display HTML elements.

The following HTML code includes CSS for styling.


<!DOCTYPE HTML> 
<html> 
    <head> 
        <style> 
        a { <!--from w w w .jav  a  2 s .  c om-->
            background-color:grey; 
            color:white 
        } 
        </style> 
    </head> 
    <body> 
        <a href="http://java2s.com">Visit the website</a> 
    </body> 
</html>

Click to view the demo

The code above set the background color and foreground color.

Styles are normally saved in external .css files.





















Home »
  HTML CSS »
    CSS »




CSS Introduction
CSS Background
CSS Border
CSS Box Layout
CSS Text
CSS Font
CSS Form
CSS List
CSS Selectors
CSS Others
CSS Table