Movatterモバイル変換


[0]ホーム

URL:


Menu
×
See More 
Sign In
+1 Get Certified Upgrade Teachers Spaces Get Certified Upgrade Teachers Spaces
   ❮   
     ❯   

CSS References

CSS ReferenceCSS Browser SupportCSS SelectorsCSS CombinatorsCSS Pseudo-classesCSS Pseudo-elementsCSS At-rulesCSS FunctionsCSS Reference AuralCSS Web Safe FontsCSS Fallback FontsCSS AnimatableCSS UnitsCSS PX-EM ConverterCSS ColorsCSS Color ValuesCSS Default ValuesCSS Entities

CSS Properties

accent-coloralign-contentalign-itemsalign-selfallanimationanimation-delayanimation-directionanimation-durationanimation-fill-modeanimation-iteration-countanimation-nameanimation-play-stateanimation-timing-functionaspect-ratiobackdrop-filterbackface-visibilitybackgroundbackground-attachmentbackground-blend-modebackground-clipbackground-colorbackground-imagebackground-originbackground-positionbackground-position-xbackground-position-ybackground-repeatbackground-sizeblock-sizeborderborder-blockborder-block-colorborder-block-endborder-block-end-colorborder-block-end-styleborder-block-end-widthborder-block-startborder-block-start-colorborder-block-start-styleborder-block-start-widthborder-block-styleborder-block-widthborder-bottomborder-bottom-colorborder-bottom-left-radiusborder-bottom-right-radiusborder-bottom-styleborder-bottom-widthborder-collapseborder-colorborder-end-end-radiusborder-end-start-radiusborder-imageborder-image-outsetborder-image-repeatborder-image-sliceborder-image-sourceborder-image-widthborder-inlineborder-inline-colorborder-inline-endborder-inline-end-colorborder-inline-end-styleborder-inline-end-widthborder-inline-startborder-inline-start-colorborder-inline-start-styleborder-inline-start-widthborder-inline-styleborder-inline-widthborder-leftborder-left-colorborder-left-styleborder-left-widthborder-radiusborder-rightborder-right-colorborder-right-styleborder-right-widthborder-spacingborder-start-end-radiusborder-start-start-radiusborder-styleborder-topborder-top-colorborder-top-left-radiusborder-top-right-radiusborder-top-styleborder-top-widthborder-widthbottombox-decoration-breakbox-reflectbox-shadowbox-sizingbreak-afterbreak-beforebreak-insidecaption-sidecaret-color@charsetclearclipclip-pathcolorcolor-schemecolumn-countcolumn-fillcolumn-gapcolumn-rulecolumn-rule-colorcolumn-rule-stylecolumn-rule-widthcolumn-spancolumn-widthcolumns@containercontentcounter-incrementcounter-resetcounter-set@counter-stylecursordirectiondisplayempty-cellsfilterflexflex-basisflex-directionflex-flowflex-growflex-shrinkflex-wrapfloatfont@font-facefont-familyfont-feature-settingsfont-kerning@font-palette-valuesfont-sizefont-size-adjustfont-stretchfont-stylefont-variantfont-variant-capsfont-weightgapgridgrid-areagrid-auto-columnsgrid-auto-flowgrid-auto-rowsgrid-columngrid-column-endgrid-column-startgrid-rowgrid-row-endgrid-row-startgrid-templategrid-template-areasgrid-template-columnsgrid-template-rowshanging-punctuationheighthyphenshyphenate-characterimage-rendering@importinitial-letterinline-sizeinsetinset-blockinset-block-endinset-block-startinset-inlineinset-inline-endinset-inline-startisolationjustify-contentjustify-itemsjustify-self@keyframes@layerleftletter-spacingline-heightlist-stylelist-style-imagelist-style-positionlist-style-typemarginmargin-blockmargin-block-endmargin-block-startmargin-bottommargin-inlinemargin-inline-endmargin-inline-startmargin-leftmargin-rightmargin-topmarkermarker-endmarker-midmarker-startmaskmask-clipmask-compositemask-imagemask-modemask-originmask-positionmask-repeatmask-sizemask-typemax-block-sizemax-heightmax-inline-sizemax-width@mediamin-block-sizemin-inline-sizemin-heightmin-widthmix-blend-mode@namespaceobject-fitobject-positionoffsetoffset-anchoroffset-distanceoffset-pathoffset-positionoffset-rotateopacityorderorphansoutlineoutline-coloroutline-offsetoutline-styleoutline-widthoverflowoverflow-anchoroverflow-wrapoverflow-xoverflow-yoverscroll-behavioroverscroll-behavior-blockoverscroll-behavior-inlineoverscroll-behavior-xoverscroll-behavior-ypaddingpadding-blockpadding-block-endpadding-block-startpadding-bottompadding-inlinepadding-inline-endpadding-inline-startpadding-leftpadding-rightpadding-top@pagepage-break-afterpage-break-beforepage-break-insidepaint-orderperspectiveperspective-originplace-contentplace-itemsplace-selfpointer-eventsposition@propertyquotesresizerightrotaterow-gapscale@scopescroll-behaviorscroll-marginscroll-margin-blockscroll-margin-block-endscroll-margin-block-startscroll-margin-bottomscroll-margin-inlinescroll-margin-inline-endscroll-margin-inline-startscroll-margin-leftscroll-margin-rightscroll-margin-topscroll-paddingscroll-padding-blockscroll-padding-block-endscroll-padding-block-startscroll-padding-bottomscroll-padding-inlinescroll-padding-inline-endscroll-padding-inline-startscroll-padding-leftscroll-padding-rightscroll-padding-topscroll-snap-alignscroll-snap-stopscroll-snap-typescrollbar-colorshape-outside@starting-style@supportstab-sizetable-layouttext-aligntext-align-lasttext-decorationtext-decoration-colortext-decoration-linetext-decoration-styletext-decoration-thicknesstext-emphasistext-emphasis-colortext-emphasis-positiontext-emphasis-styletext-indenttext-justifytext-orientationtext-overflowtext-shadowtext-transformtext-underline-offsettext-underline-positiontoptransformtransform-origintransform-styletransitiontransition-delaytransition-durationtransition-propertytransition-timing-functiontranslateunicode-bidiuser-selectvertical-alignvisibilitywhite-spacewidowswidthword-breakword-spacingword-wrapwriting-modez-indexzoom



CSSPseudo-classes Reference


CSS Pseudo-classes

A CSS pseudo-class is a keyword that can be added to a selector, to define a style for a special state of an element.

Some common use for pseudo-classes:

  • Style an element when a user moves the mouse over it
  • Style visited and unvisited links differently
  • Style an element when it gets focus
  • Style valid/invalid/required/optional form elements
  • Style an element that is the first child of its parent

Syntax

Pseudo-classes are always denoted by a single colon (:) followed by the pseudo-class name:

selector:pseudo-class-name {
  CSS properties
}

The table below lists all the pseudo-class keywords in CSS:

Pseudo-classExamplesExample description
:activea:activeSelects the active link
:any-linka:anylink
area:anylink
Selects any <a> or <area> element with an href attribute
:auto-fillinput:autofillSelects any <input> element with its value autofilled by the browser
:checkedinput:checked
option:checked
Matches any <input> or <option> element that is checked
:defaultinput:default
button:default
option:default
Selects form elements that are default in a group of related elements
:defined:definedSelects any element that has been defined (standard or custom elements)
:dir():dir(ltr)
:dir(rtl)
Selects any element with the specified text direction
:disabled:disabled
input:disabled
option:disabled
Selects any element that is disabled. Most used for form elements
:emptydiv:emptySelects any element that has no children (including text nodes)
:enabled:enabled
input:enabled
Selects any element that is enabled. Most used for form elements
:first@page :firstRepresents the first page of a printed document (used with the @page rule)
:first-childp:first-child
li:first-child
Selects the element that is the first child of its parent (among a group of sibling elements)
:first-of-typep:first-of-type
li:first-of-type
Selects the first element of its type among a group of sibling elements
:focusinput:focus
select:focus
Selects the element that gets focus. Most used for form elements
:focus-visiblebutton:focus-visibleSelects the element that gets focus (used to apply focus styles only when the keyboard is used to focus something, not the mouse)
:focus-withinform:focus-within
label:focus-within
Matches an element if the element or any of its descendants gets focus
:fullscreen:fullscreenSelects any element that is currently in full-screen mode
:has()h2:has(+p)Selects h2 elements that are immediately followed by a p element, and applies the style to h2
:hovera:hover
p:hover
Selects element on mouse over
:in-rangeinput:in-rangeSelect any <input> element with a value within the specified range limit
:indeterminateinput:indeterminateSelects any form element that is in an indeterminate state
:invalidinput:invalid
fieldset:invalid
Selects invalid form elements
:is():is(ul, ol)Selects all <ul> and <ol>elements
:lang()p:lang(it)Selects any <p> element with a lang attribute equal to "it" (Italian)
:last-childli:last-childSelects any <li> element that is the last child of its parent
:last-of-typep:last-of-typeSelects any <p> element that is the last <p> element of its parent
:left@page :leftRepresents all left-hand pages of a printed document (used with the @page rule)
:linka:linkSelects any unvisited link
:modal:modalSelects the element that is in a modal state
:not():not(p)Selects any element that is not a <p> element
:nth-child()p:nth-child(2)Selects any <p> element that is the second child of its parent
:nth-last-child()p:nth-last-child(2)Selects any <p> element that is the second child of its parent, counting from the end
:nth-last-of-type()p:nth-last-of-type(2)Selects any <p> element that is the second <p> element of its parent, counting from the end
:nth-of-type()p:nth-of-type(2)Selects any <p> element that is the second <p> element of its parent
:only-childp:only-childSelects any <p> element that is the only child of its parent
:only-of-typep:only-of-typeSelects any <p> element that is the only <p> element of its parent
:optionalinput:optional
select:optional
textarea:optional
Selects any <input>, <select>, or <textarea> elements without a "required" attribute
:out-of-rangeinput:out-of-rangeSelects any <input> element with a value outside the specified range limit
:placeholder-showninput:placeholder-shown
textarea:placeholder-shown
Selects any <input> or <textarea> element that is currently displaying placeholder text
:popover-open:popover-openSelects any element that is in a showing popover state
:read-onlyinput:read-onlySelects input elements with the "readonly" attribute specified
:read-writeinput:read-writeSelects editable input elements
:requiredinput:requiredSelects input elements with the "required" attribute specified
:right@page :rightRepresents all right-hand pages of a printed document (used with the @page rule)
:root:rootSelects the document's root element
:scope:scopeSelects elements that are a reference point, or scope, for selectors to match against
:state():state()Selects custom elements that have the specified custom state
:target:targetSelects the current active target element
:user-invalid:user-invalidSelects any form element with an invalid value (after the user have interacted with it)
:user-valid:user-validSelects any form element with a valid value (after the user have interacted with it)
:validinput:validSelects all input elements with a valid value
:visiteda:visited
area:visited
Selects all visited links
:where():where(ol, ul)Selects all <ul> and <ol>elements


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning.
Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness
of all content. While using W3Schools, you agree to have read and accepted ourterms of use,cookies andprivacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved.W3Schools is Powered by W3.CSS.


[8]ページ先頭

©2009-2025 Movatter.jp