Forums

Give help. Get help.

  • # November 20, 2012 at 1:43 am

    Hi guys,
    could anyone know about use of “~” in css. How does it works. Does it support all browsers including ie8?

    # November 20, 2012 at 1:49 am

    @matthewb : It’s used in specifying a certain word within the attribute,

    [title~=about] {
    background:#333;
    }

    That will target all elements with the word 'about' in the attribute of title.

    http://jsfiddle.net/john_motyl/JjrF4/

    What TheDoc said works best for what you want to know!

    # November 20, 2012 at 1:49 am

    It’s a sibling selector. All the info can be found here: http://css-tricks.com/child-and-sibling-selectors/

    # November 20, 2012 at 1:56 am

    @thedoc – Does it works as .nextAll() in jquery?

    # November 20, 2012 at 2:57 am

    Yeah, it’s pretty much the same thing.

    .my-element ~ p

    This selector targets every p element after .my-element as long as they share the same direct parent.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag