Css Select Parent Based On Child Code Example


Example 1: css parent selector


/* There is no such selector
in 2008, the following was suggested */

a < img { 'border': none }

/* Which in theory, would set an an images 'a' parent
border to none
Of course, this does not exist

Another suggestion... */

div:parent { 'border': none }

/* Pretty self explainatory, nevertheless it does not
exist.

You will have to use JavaScript/jQuery */

$('some-element').parent();

Example 2: styles for parent of selector


Short answer: no such selector exists. Use JavaScript
Long answer: by Kaotik below

Example 3: how to select elements from a parrent element css


// select all p elements with div as parent

div > p {
background-color: yellow;
}

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable