Two Favorite CSS4 selectors – :not() and :matches()

matches-and-not-css4-selectors

In the CSS4 Specification it says :not() can be used for both selectors and pseudo classes. It will not work with:after or :before, but everything else works great. So lets say you want to apply to everything except links.

*|*:not(:link) {
/* Some CSS */
}

in the code snippet above, *|* is a general “apply to everything” rule. Basically it’ll apply the CSS to all the elements. But here css would be applied to all except the links.

So, the negation pseudo-class, :not(X), is a functional notation taking a selector list as an argument. It represents an element that is not represented by its argument.

NOTE: Negations may not be nested within itself or within :matches(). That means :not(:not(…)) and :matches(:not(…)) are invalid.

Pseudo-elements cannot be represented by the negation pseudo-class; they are not valid within :not().

Now coming over to :matches.

In this example, we condense three rules with identical declarations into one. Thus,

h1 { font-family: sans-serif }
h2 { font-family: sans-serif }
h3 { font-family: sans-serif }

is equivalent to:

h1, h2, h3 { font-family: sans-serif }

The matches-any pseudo-class, :matches(X), is a functional notation taking a selector list as its argument. It represents an element that is represented by its argument.
In CSS4, only compound selectors are allowed within :matches(): combinators are not allowed. Additionally, :matches() may not be nested within itself or within :not(). :matches(:matches(…)) and :not(:matches(…)) are invalid.
Pseudo-elements cannot be represented by the matches-any pseudo-class; they are not valid within :matches().
Default namespace declarations do not affect the subject of any selector within a matches-any pseudo-class unless the argument is an explicit universal selector or a type selector.

For example, following selector matches any element that is being hovered or focused, regardless of its namespace. In particular, it is not limited to only matching elements in the default namespace that are being hovered or focused.

*|*:matches(:hover, :focus)

The following selector, however, represents only hovered or focused elements that are in the default namespace, because it uses an explicit universal selector within the :matches() notation:

*|*:matches(*:hover, *:focus)

CSS4

css4

 

First of all I would like to start with that there has never been anything like CSS4.
It’s the development of independent modules published after CSS 2.1.

To be more precise and accurate, we might like to explore the content from the following post.
A Word About CSS4

But still in order to explore the latest so called CSS4, we can discuss about the latest selectors that have been developed so as to ease the pain of using javascript / jQuery extensively.

First nice feature I would be discussing would be giving styles to the parent element based on its child element. Consider the following line:

ul > li:hover {color:#ff0000;}

Here li is a child element and ul is a parent element. So, here the color of li will change when list item is hovered.
Introducing the “$” in the syntax. This allows for styling of a parent element (‘ul’ here) based on its child element (‘li’ here). See the example below:

$ul li:hover {color:green;}

Here, if one hovers over a list element, the whole list will turn green. This is a great and dearly needed feature.

Kindly refer to further posts coming in near future to know more features.

Kindness is my philosophy

The philosophy is kindness.

 

This is my simple religion. There is no need for temples; no need for complicated philosophy. Our own brain, our own heart is our temple; the philosophy is kindness.

 

Everybody around the world follow one religion or the other. But many of them are turning atheist with the progress of science an technology. This quote by his holiness Dalai Lama, denotes that Kindness, compassion is the gateway to happiness and inner peace.

This quote has been taken from a speech by the great Dalai Lama.

Happiness is the sole goal of life

I believe that the very purpose of our life is to seek happiness

 

I believe that the very purpose of our life is to seek happiness. That is clear. Whether one believes in religion or not, whether one believes in this religion or that religion, we all are seeking something better in life. So, I think, the very motion of our life is towards happiness…

 

“I believe that the very purpose of life is to be happy. From the very core of our being, we desire contentment. In my own limited experience I have found that the more we care for the happiness of others, the greater is our own sense of well-being. Cultivating a close, warmhearted feeling for others automatically puts the mind at ease. It helps remove whatever fears or insecurities we may have and gives us the strength to cope with any obstacles we encounter. It is the principal source of success in life. Since we are not solely material creatures, it is a mistake to place all our hopes for happiness on external development alone. The key is to develop inner peace.”

This quote has been taken from a speech by the great Dalai Lama.

Dream Big

If your dreams do not scare you, they are not big enough.

 

If your dreams do not scare you, they are not big enough.

 

The size of your dreams must always exceed your current capacity to achieve them. If your dreams do not scare you, they are not big enough. If you start off with a small dream, you may not have much left when it is fulfilled because along the way, life will task your dreams and make demands on you.

An Ideal relationship.. Does it exist..??

Anthony Robbins

The quality of your life totally depends on the quality of your relationships.

An ideal relationship

Ha! It can’t be that easy can it? Well, it’s not. Sometimes, what we think we want is not what we actually want. If you could take a look at your current relationship, if you are in one, and your two past previous relationships, what would you see?

Take a pen and paper out and list the similarities between your present relationship and the past two. If you are currently single, do the same with your past relationships (at least two, preferably three). Can you see any patterns that are similar between them?

Have you been creating the same type of partner, over and over again? That is what I did, in the past. One of the techniques that worked really well for me was to sit down and write a fake personal ad. In that ad, I listed all of the qualities of the people that I had been attracting in my life. It wasn’t pretty.

When I saw all those negatives, I was prompted to turn around and re-frame the qualities. I wrote an ad about the opposite qualities. It was much better and in the end, that is what I went on to bring into my life. When you do this exercise, you see that you are attracting what you believe you deserve. Sometimes, “your type” and what you think you wanted, are not for your higher good.

Inner Peace

Do not let the behavior of others, destroy your inner peace.

Do not let the behavior of others, destroy your inner peace.

This is a famous quote by Dalai Lama.
The Dalai Lama is a high lama in the Gelug or “Yellow Hat” branch of Tibetan Buddhism. The name is a combination of the Sino-Mongolian word dalai meaning “Ocean” and the Tibetan word བླ་མ་ bla-ma meaning “guru, teacher”.

How can I stop time?

When we are asked the reason for the low productivity or bad results we are loaded with number of reasons. But one of the most common answer is always the lack of Time. So, most often I think about some ways to stop the time, make everything stand still and work hard in the meanwhile to get along with the pace of time. I wish.. 🙂

How can I stop time?

But now I can stop the time. Yes I can. And you all too. Thanks to Einstein. We have heard stories that Einstein was the only one who could invent the time machine but he could not. But his theories are still out there. One of his such theory is General Relativity. General relativity generalises special relativity and Newton’s law of universal gravitation, providing a unified description of gravity as a geometric property of space and time, or spacetime. The term relativity means that all uniform motion is relative, and that there is no absolute and well-defined state of rest (no privileged reference frames)—from mechanics to all the laws of physics, including both the laws of mechanics and of electrodynamics, whatever they may be. Time is also considered as one of the dimensions and its a moving identity too. So, it has relativity too. Perform a basic experiment which is described below.

Look for a clock with a very smooth sweeping second hand. The one on your wall might not work. It’s second strikes a significant change in the distance. Look for a clock like on this link: . If it appears relatively smooth, it will still work, you’ll be able to factor out what you are controlling.

After looking at the second hand for a bit, look off to the side of the clock, outside of the box, and about 15 to 20 minutes ahead of the second hand. You should still be able to see the second hand, but you won’t be looking directly at it. Now just relax and see if you can stop the second hand. If it starts catching up to the point you are looking at, jump ahead to another spot about 20 minutes ahead. With very little practice you are extremely likely to make a most remarkable discovery. You can stop time. Perhaps at first for only a second or two, but with practice, you’ll be able to freeze it for longer. If you can’t get it right away, try playing with your focus point, move it further away or closer to the frame of the clock. Or look at one of the hour markers on the clock about 20 to 30 minutes ahead. After you get it, try counting internally. The count you reach is the number of discrete thought processes you performed in zero clock time.

Once you’ve accomplished this amazing feat, what does it mean? It means if we are moving (rolling our eyes) with a constant speed and look ahead of the time constantly we will start moving parallel to the time and relatively it will look as if we have ceased the moment. We can be in that moment for an infinite duration.

In order to be more productive – the things that you really want to do – you have to stop using time management. You have to stop being ruled by time and have to start being ruled by tasks instead. That’s the only way you can really get ahead and get to the important things on your lists. Being ruled by time leaves you dealing with items of urgency. Being ruled by task allows you to deal with items of importance.

Task management and time management are very different. Knowing what you have to do and knowing how much time you have to do what it is you have to do require different mentalities. You need to learn how to manage your tasks first, then you’ll be in a far better position to manage your time.

In fact, by doing the former you may not have to do much of the latter.

So stop worrying about due dates and start making every date a “do date”. Stop tracking your time spent and start tracking what you do in the time you have. Pay more attention to the “what” and less attention to the “when”. That’s how you stop time in its tracks.

And it’s also how you start moving more efficiently and effectively down the right track.