CSS @Supports (::Pseudo-Element)

What is the most practical way to check for @supports support using only CSS?

@supports currently only tests property/value combinations, and nothing else. Your other options don't work because none of them are valid (including the last one with just the at-keyword followed by the opening brace!). The property/value pair requirement is dictated by the grammar for @supports, which you can find in the spec.

Simply test for a property/value pair that you know is guaranteed to work across all user agents whether or not @supports is implemented. This (sort of) eliminates the possibility that you'll run into a user agent that implements @supports but not that property/value combination, focusing on its support for @supports instead.

Your given example of display: block will suffice. Your use of the cascade to check if a browser does not implement @supports by overriding declarations within a @supports rule for browsers that do support it is also acceptable (being the only obvious way to do it anyway).

How to detect if browser support specified css pseudo-class?

You can simply check if your style with pseudo-class was applied.

Something like this: http://jsfiddle.net/qPmT2/1/

Change the dot after a listing to clip

You can do that with :before and a counter like so:

ol{
list-style-type: none;
counter-reset: listStyle;
}
li{
counter-increment: listStyle;
}
li:before{
content: counter(listStyle, lower-alpha) ") ";
}
<ol>
<li>Foo</li>
<li>Bar</li>
<li>Foo</li>
<li>Bar</li>
</ol>

Site configuration in django-admin

This is what I did. Might not be the most optimal solution but works for me.

  1. Create a Configuration model and do all the usual stuff as in your point 2. Create a function (say in configuration.view) which will pull out and return the configuration values in a dict.

  2. Now in your settings.py, import your function and set the returned dict to a settings.py variable:
    CONFIG = configuration.view.get_config()

  3. Create a template context processor which will set this CONFIG dict in the template context.

    def init_site_settings(request):
    return settings.CONFIG
  4. Add this context processor to your TEMPLATE_CONTEXT_PROCESSORS

  5. Now you are free to use your configuration parameters in templates as {{my_config_key}}

Hope this helps.



Related Topics



Leave a reply



Submit