These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:04 pm Advanced search

CSS scoped attribute

Here you can discuss things related to HTML and the Web in general that do not fit in to other categories.

CSS scoped attribute

Postby disenrascanco » Sat Mar 06, 2010 12:04 am

So... what's up with this new "scoped" css attribute?

The W3C describes it as:

If the "scoped" attribute is present, the styles only apply to the style elements parent element and its child elements.


Which to me means:

Code: Select all
<!DOCTYPE html>
<html lang="en">
   <head>
      <meta charset="utf-8" />
      <title></title>
      <style type="text/css" media="screen">
         
         p {
            color:red;
         }
         
      </style>
   </head>
   <body>
   
   <p>red</p>
   <div>
      <style type="text/css" media="screen" scoped="true">
      
         p {
            color: blue ;
         }
      
      </style>
      <p>blue</p>
   </div>
   <p>red</p>
   
   </body>
</html>


should work. But it doesn't.

Is this implemented in any browsers yet? What is the syntax/intended usage. I can't find anything.

Tips?
disenrascanco
<h6>
 
Posts: 1
Joined: Fri Mar 05, 2010 11:53 pm

Postby zcorpan » Mon Mar 08, 2010 12:18 pm

It's not implemented anywhere yet. What you wrote is correct syntax except the attribute should look like one of:

scoped
scoped=""
scoped="scoped"
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest