Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS: body { } Selector not Working

Tags:

html

css

This is the whole document:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Title</title>

    <style type="text/css">
        body‌ {
            font-family: Tahoma;
            font-size: 8px;
            background: #f00;
        }
    </style>
</head>

<body>
    Sample Text
    <p>Another Text</p>
</body>
</html>

And in jsfiddle: http://jsfiddle.net/HDBqZ/

Why it's not working? Am I missing something?

like image 652
Vahid Avatar asked Mar 08 '13 08:03

Vahid


People also ask

How do I select a body in CSS?

Type Selectors correspond with HTML elements. ID Selectors are used by adding # in front of an elements ID. Class Selectors are used by adding a period in front of an elements class.

Why is my external CSS not working?

If you put the <link> tag inside another valid header tag like <title> or <script> tag, then the CSS won't work. The external style CAN be put inside the <body> tag, although it's recommended to put it in the <head> tag to load the style before the page content.

What is a div type selector?

A Type Selector (sometimes referred to as an Element Type Selector) matches elements with the corresponding element node name, such as <p>, <span> , and <div> tags. Type selectors are generally used to make “broad stroke” changes to the style of a site.

What is Section element selector in CSS?

The element selector is a way to select all the elements with a given tag name in a document, and apply the same styles to each element with the tag name. Note that you should only write the tag name, and not write brackets around the tag name — h1 , not <h1> . 2.


1 Answers

There seems to be some junk after the y in your body { selector:

>>> u'body‌'
u'body\u200c'

Delete your body line and re-write it by hand. Your text editor should have some tool to get rid of these things automatically as well.

like image 123
Blender Avatar answered Sep 18 '22 05:09

Blender