CSS? ???? ???? ????? ????? ???? ????? ?? ??? ? ??? ????? ???? ????. ??? ?? ?? ? ??? ?? CSS? ??? :has() ?? ??????. ? ?? ???? ?? ?? ?? ??? ????? ?? ?? ?? ??? ?? ?? ??? ?? ???? ???? ??? ? ????.
? ????? :has() ?? ???? ???? ???? ???? ?? ?? ?????.
:has() ?? ???? ??????
:has() ?? ???? ??, ?? ?? ??? ???? ??? ???? ??? ? ?? ??? ?? "?? ???"??? ???.
selector:has(selectorList)
- ???? ??? ???? ?? ?????.
- selectorList? ?? ??, ?? ?? ?? ?? ??? ??? ?? ??? ??? ? ?? ?????.
?? ??
- ?? ??: ???? ?? ???? ?? ??? ???? ??? ?????.
- ??? ??: , ~ ? >? ?? ???? ?? ?????. ???? ??? ??
- ??? ?????: JavaScript? ???? ?? ?? ?????? ??? ??? ? ?????.
?? ?: :has()? ???? ??? ???? ?? ??? ??
body { font-family: sans-serif; } .box { width: 50px; height: 40px; background-color: red; margin: 5px; } .border { border: 2px solid black; } .circle { width: 40px; height: 40px; background-color: blue; border-radius: 25px; } /* Highlighting boxes that are followed by a circle */ .box:has(+ .circle) { width: 80px; height: 80px; }
<!DOCTYPE html> <html> <head> <title>CSS :has() Example</title> <meta charset="UTF-8" /> <link rel="stylesheet" href="./styles.css" /> </head> <body> <div> <p><strong>Explanation</strong></p> <p><em>Basic Styles</em><br> The .box class defines small red rectangles with a margin.<br> The .circle class creates blue circular elements.</p> <p>Dynamic Sizing Using :has():<br> The rule .box:has(+ .circle) applies styles to any .box element that is immediately followed by a .circle.<br> This rule changes the dimensions of such .box elements to 80px by 80px, making them stand out.</p> <p><em>Visual Output</em></p> <p>Initially, the boxes are uniform in size.<br> The .box element immediately preceding a .circle grows larger due to the :has() rule.</p> <p><img src="/static/imghw/default1.png" data-src="https://img.php.cn/upload/article/000/000/000/173495132393104.jpg" class="lazy" alt="CSS :has() Pseudo-Class: A Powerful Selector for Dynamic Styling" /></p> <h2> Use Cases for :has() </h2> <p>The :has() pseudo-class is versatile and can be applied in numerous scenarios:</p> <h3> 1. <strong>Interactive Layouts</strong> </h3> <p>Style a parent element based on the presence of a specific child or sibling element, e.g., highlighting a card if it contains a button.<br> </p> <pre class="brush:php;toolbar:false">.card:has(button) { border: 2px solid green; }
2. ?? ?? ??
?? ??? ??? ??
li:has(ul) { font-weight: bold; }
3. ?? ??
?? ?? ?? ??? ???? ???? ?? ?? ??? ???????.
.form-group:has(input:invalid) { border-color: red; }
4. ??? ?? ?? ??
??? ?? ??? ???? ??? ???? ?????.
h1:has(+ p) { margin-bottom: 10px; }
:has()? ??
-
??? ??:
- DOM? ???? ???? ?? ??? JavaScript? ???? ????.
-
?? ??:
- ??? ??? ?? JavaScript ???? ?? ??? ??????.
-
CSS ???:
- ??? ??? ?? ??? ???? ????? ?? ???? ??? ??????.
???? ??
?? :has() ?? ???? ??? ??? ???? ?? ?????? ?????.
- ??: 105
- ??: 105
- ???: 15.4
- Firefox: ??? ?? ????.
?? ????? ?? ?? ?? ???? ??? ? ????.
??
:has() ?? ???? ?? CSS? ??? ?? ???? ???? ?? ??? ??? ?????. ??? ?? ??? ???? ???? ??? ? ?? ??? ?? CSS ??? ?????, ?? ???? ?????, DOM ?? ? JavaScript? ?? ???? ????.
?????? :has() ?? ???? ???? ????? ???? ? ???? ?? ??? ???? ?????!
? ??? CSS :has() ?? ???: ?? ????? ?? ??? ???? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? ??











CSS? ??? ??? ????? ????? ??? ? ?? CSS? ????? ?? ??????, ?? ?? ? ??? ??, ??? ?? ?? ??? CSS ? ????? ?? ??? ?? ???? ???? ??? ??? ???. 1. ?? CSS? ???? HTML? ?? ?????. 2. JavaScript? ?? ??? CSS ??; 3. ??? ??? ???? ?? ???? ????? ??????. 4. CSS? ???? ???? ??? ????. ?? CSS? ???? ?? ??? ???? Rel = "Preload"?????? ????, ??? ?? ??? ????? ???? ??? ?? ? ??? ???? ??? ?????.

TheBestoproachforcssdspectionseproject'sspecificneeds.forlargerProjects, externalcsSisbetterduetomainabainabainabilitableability ? forsmallerprojectsorsingle-pageapplications, ?? csmightbemoresuitable.it 'scrucialtobalanceprojectsize, ??

???, cssdoesnothavetobeInlowercase. ???, lowercaseisRecomedended for : 1) ??? ? ??, 2) ??? ?? rorsinerrorsinerrorsIngerRorsIngerRorsInteChnologies, 3) ??? ?? ??, ? 4) ?? ? ???? ????.

cssismostlycase-Insensitive, buturlsandfamilynamesarecase-insensitive.1) propertiesandvalueslikecolor : red; anteOtcase-inditive.2) urlsmustmatchtheserver'scase, ?? ??,/images/logo.png.3) fontfamilynames'opens'mustoccase.

AutoPrefixer? ?? ???? ??? ???? ?? ?? ???? CSS ??? ???? ???? ?????. 1. ????? ???? ???? ???? ??? ?????. 2. PostCSS ???? ??, CSS? ?? ???? ???? ?? ???? ??? ???? ??? ?? ??? ?????. 3. ?? ???? ???? ??, ??????? ?? ? ?? ???????? ????? ?? ?????. 4. ???? ???? ???? ???? ?? ?? ????, ???? ?? ??? ?? ???? ???? ????? ?? ???? ?? ????.

CSSCOUNTERSCANAUTOMALLYNUMBERSESSESSENDS.1) USECOUNTER-RESETTIONITIALIZE, CORKENT-INCREMENTTOINCERES, andCOUNTER () ORCOUNTERS () TODISPLAYVALUES.2) COMPINEWITHJAVAISCRIPTORDINAMICCONTENTTOEREACCUTERUPDATES.

CSS?? ??? ? ?? ??? ?? ??? ???? ??, ??, URL ? ??? ?? ????? ?? ?? ??? ?????. 1. ???? ?? ??? ??? ? ???? ?? ?? ??? ??????. 2. ?? 16 ?? ??? ?? ??? ?????, ??? ???? ???? ?? ??? ??? ???? ????. 3. URL? ??? ???? ???? ??? ??? ? ????. 4. ??? ?? ?? (??)? ??? ???? ??? ? ???? ??????? ???????.

theconic-gradient () functionincsscreatescurcular gradientsthattroTecolorstopsaroundacentral point
