I am new to CSS and I’m following a book example:
Iv’e copied the following from the book and saved it as HTML.
all the css properties seem to work except the “content” property which does not display.Thanks in advance.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title> The content property </title>
<style type='text/css' media='all'>
div {
content: "Hello, world!";
}
</style>
</head>
<body>
<div></div>
</body>
</html>
contentis used with:beforeor:afterlike so:Regardless, I’ve only used
contentfor special cases (to clear floated elements, for example). I’ve never actually used this to insert content. You generally want to separate content and presentation anyway, so I think this is a bad idea. Which book are you reading? 🙂