CodyBugstein
CodyBugstein

Reputation: 23322

Why can't I add styling to the content tag?

I'm trying add some styling to the overall content on my page, but styling I add to the <content> tag in the CSS doesn't show up anywhere.

JSFiddle:

http://jsfiddle.net/a8VhR/

Upvotes: 1

Views: 186

Answers (5)

Andrea Ligios
Andrea Ligios

Reputation: 50203

<content> is not a valid tag, as suggested in @BenM answer. Then just use a valid tag instead.

For the records, the hack to show it would be giving it a block level display attribute:

content {
    width: 300px;
    height: 300px;
    background-color: green;
    display: block;
}

Fiddle

Upvotes: 2

Narendra
Narendra

Reputation: 3117

I checked the fiddle.

The html written there is wrong as of my knowledge. Because I don't think there is any tag in HTMK known as <content>.

Also head should be in <html> tag and before <body> tag.

Below is a fiddle which works even with wrong tags

http://jsfiddle.net/a8VhR/5/

<head>
</head>
<body>
        <div>
            Goodbye Cruel World!
        </div>
    <footer>
    </footer>
</body>

Upvotes: -1

Ahmedskaya
Ahmedskaya

Reputation: 389

i don't think this is universal defined html tag, and it's not all the time working with creating your own custom tags, i believe easier to use it as a div+class then

Upvotes: 0

BenM
BenM

Reputation: 53198

You can't style it because the browser doesn't understand <content>. It was rejected from the HTML5 specification.

You'll need to replace it with another element (such as <article>).

jsFiddle Demo

Upvotes: 8

Felix
Felix

Reputation: 38102

You need to target div inside your content instead:

content div {
    width: 300px;
    height: 300px;
    background-color: green;
}

Upvotes: 1

Related Questions