I am working on a proof of concept - a module written in javascript which extends the capabilities of conventional CSS.
I'm happy with what I have put together so far (although there is a lot more to do), and I have reached a suitable stage where I need to look back and double-check that haven't missed something mind-numbingly obvious.
Please look at the styled markup below. The two examples on the left are styled with conventional CSS. The two examples on the right are styled with the module I have written - which I have called ACSSSS (Augmented CSS Selector Syntax) or axe for short.
Question: Is it possible to achieve the presentation of the two examples on the right with conventional CSS alone? (And if so, how?)
Update (April 2017)
Two and a bit months after I first posted this question, @Ferrybig
has pointed out in the comments below that in any StackSnippet I need to link to the external axe script via an https://
connection. All fixed! You can now open up the code snippet below and see all the axe selectors in action.
/******************
GENERAL STYLE RULES
******************/
body, div, h2, ul {
transition: all .75s ease-out;
}
div {
display: inline-block;
width: 190px;
margin: 6px;
padding: 12px;
border: 1px dashed rgb(127,127,127);
text-align: center;
vertical-align: top;
}
h2 {
line-height: 36px;
margin: 0;
font-size: 18px;
font-family: arial, helvetica, sans-serif;
}
ul {
padding-left: 12px;
color: rgb(255,255,255);
text-align: left;
background-color: rgb(0,0,127);
border: 6px solid rgb(0,0,0);
border-radius: 15px;
box-shadow: 4px 4px 4px rgba(127,127,127, 0.5);
list-style: none;
}
li {
height: 48px;
max-height: 48px;
font-size: 24px;
line-height: 48px;
margin-left: -12px;
padding-left: 12px;
transition: all 0.5s ease-out;
}
li:first-of-type {
border-radius: 9px 9px 0 0;
}
li:last-of-type {
border-radius: 0 0 9px 9px;
}
li:hover {
margin-left: -12px;
padding-left: 12px;
cursor: pointer;
}
.axe-info {
position: absolute;
top: 0;
left: 0;
height: 24px;
line-height: 24px;
font-size: 18px;
color: rgb(255,255,255);
text-align: center;
padding: 12px 24px;
border-radius: 24px;
opacity: 0;
transform: translateX(-600px);
transition: all 0.75s linear;
}
.axe-info strong {
font-size: 26px;
}
.rainbow-list li:hover ~ li,
.priority-list li:hover ~ li {
color: rgba(255,255,255,0.5);
}
div + hr {
margin-top: 120px;
}
hr ~ ol li {
height: auto;
max-height: none;
}
code {
display: inline-block;
padding: 0 12px;
}
/***********
RAINBOW LIST
************/
.rainbow-list li:hover {
background-color: red;
}
.rainbow-list li:hover + li {
background-color: orange;
}
.rainbow-list li:hover + li + li {
background-color: yellow;
}
.rainbow-list li:hover + li + li + li {
background-color: green;
}
.rainbow-list li:hover + li + li + li + li {
background-color: blue;
}
.rainbow-list li:hover + li + li + li + li + li {
background-color: indigo;
}
/************
PRIORITY LIST
*************/
.priority-list li:hover {
font-size: 36px;
background-color: rgba(255,255,255,0.6);
}
.priority-list li:hover + li {
background-color: rgba(255,255,255,0.3);
font-size: 30px;
}
.priority-list li:hover + li + li {
font-size: 24px;
}
.priority-list li:hover + li + li + li {
background-color: rgba(0,0,0,0.3);
font-size: 18px;
}
.priority-list li:hover + li + li + li + li {
background-color: rgba(0,0,0,0.6);
font-size: 12px;
}
.priority-list li:hover + li + li + li + li + li {
background-color: rgba(0,0,0,0.9);
font-size: 6px;
}
/*********************
RAINBOW LIST WITH AXE
*********************/
.rainbow-list-with-axe li:hover ? li ? li ? li ? li ? li ? li,
.rainbow-list-with-axe li:hover {
background-color: red;
}
.rainbow-list-with-axe li:hover ? li ? li ? li ? li ? li,
.rainbow-list-with-axe li:hover + li {
background-color: orange;
}
.rainbow-list-with-axe li:hover ? li ? li ? li ? li,
.rainbow-list-with-axe li:hover + li + li {
background-color: yellow;
}
.rainbow-list-with-axe li:hover ? li ? li ? li,
.rainbow-list-with-axe li:hover + li + li + li {
background-color: green;
}
.rainbow-list-with-axe li:hover ? li ? li,
.rainbow-list-with-axe li:hover + li + li + li + li {
background-color: blue;
}
.rainbow-list-with-axe li:hover ? li,
.rainbow-list-with-axe li:hover + li + li + li + li + li {
background-color: indigo;
}
.rainbow-list-with-axe:hover ^ body {
background-color: rgba(0,255,0,0.2);
}
/*********************
PRIORITY LIST WITH AXE
*********************/
.priority-list-with-axe li:hover {
font-size: 36px;
background-color: rgba(255,255,255,0.6);
}
.priority-list-with-axe li:hover ? li,
.priority-list-with-axe li:hover + li {
background-color: rgba(255,255,255,0.3);
font-size: 30px;
}
.priority-list-with-axe li:hover ? li ? li,
.priority-list-with-axe li:hover + li + li {
font-size: 24px;
}
.priority-list-with-axe li:hover ? li ? li ? li,
.priority-list-with-axe li:hover + li + li + li {
background-color: rgba(0,0,0,0.3);
font-size: 18px;
}
.priority-list-with-axe li:hover ? li ? li ? li ? li,
.priority-list-with-axe li:hover + li + li + li + li {
background-color: rgba(0,0,0,0.6);
font-size: 12px;
}
.priority-list-with-axe li:hover ? li ? li ? li ? li ? li,
.priority-list-with-axe li:hover + li + li + li + li + li {
background-color: rgba(0,0,0,0.9);
font-size: 6px;
}
.rainbow-list-with-axe:hover < div + div ul {
background-color: red;
}
.rainbow-list-with-axe:hover < div ? div ? div ul {
background-color: orange;
}
.rainbow-list-with-axe:hover < div ? div ul {
background-color: green;
}
.priority-list-with-axe:hover < div ? div ? div ? div ul {
background-color: red;
}
.priority-list-with-axe:hover < div ? div ? div ul {
background-color: orange;
}
.priority-list-with-axe:hover < div ? div ul {
background-color: green;
}
.priority-list-with-axe:hover ^ body {
background-color: rgba(255,0,0,0.1);
}
/******************
BOTH LISTS WITH AXE
*******************/
.rainbow-list-with-axe li:hover | li,
.priority-list-with-axe li:hover | li {
color: rgba(255,255,255,0.5);
}
.rainbow-list-with-axe:hover ? h2,
.priority-list-with-axe:hover ? h2 {
color: rgb(223,0,0);
font-size: 22px;
}
.rainbow-list-with-axe:hover < div,
.priority-list-with-axe:hover < div {
border: 1px solid gray;
}
.rainbow-list-with-axe:hover < div | div h2,
.priority-list-with-axe:hover < div | div h2 {
color: gray;
font-size: 12px;
}
.rainbow-list-with-axe:hover < div | div ul,
.priority-list-with-axe:hover < div | div ul {
border:6px dashed rgba(255,255,255,0.4);
}
.rainbow-list-with-axe:hover < div ! div,
.priority-list-with-axe:hover < div ! div {
transform: translateY(72px);
}
.rainbow-list-with-axe:hover < div % div ul,
.priority-list-with-axe:hover < div % div ul {
transform: scale(0.75);
}
.rainbow-list-with-axe:hover \ .axe-info,
.priority-list-with-axe:hover \ .axe-info {
opacity: 1;
}
.rainbow-list-with-axe:hover \ .axe-info {
background-color: rgb(0,91,0);
transform: translateX(184px);
}
.priority-list-with-axe:hover \ .axe-info {
background-color: rgb(191,0,0);
transform: translateX(420px);
}
<p class="axe-info">This list is styled with <strong>axe</strong> ►</p>
<div>
<h2>Rainbow List</h2>
<ul class="rainbow-list">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
</ul>
</div>
<div>
<h2>Priority List</h2>
<ul class="priority-list">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
</ul>
</div>
<div>
<h2><em>axe</em> Rainbow List</h2>
<ul class="rainbow-list-with-axe">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
</ul>
</div>
<div>
<h2><em>axe</em> Priority List</h2>
<ul class="priority-list-with-axe">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
</ul>
</div>
<script src="https://rouninmedia.github.io/axe/axe.js"></script>
From Original Post (February 2017)
N.B. I wanted to present this in a StackSnippet, but it isn't hugely straightforward to find and access the stylesheet and the correct part of the CSSOM from the StackSnippet interface, so I am providing a custom link instead.