Movatterモバイル変換


[0]ホーム

URL:


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

CSS Tutorial

CSS HOMECSS IntroductionCSS SyntaxCSS SelectorsCSS How ToCSS CommentsCSS ErrorsCSS ColorsCSS BackgroundsCSS BordersCSS MarginsCSS PaddingCSS Height / WidthCSS Box ModelCSS OutlineCSS TextCSS FontsCSS IconsCSS LinksCSS ListsCSS TablesCSS DisplayCSS Max-widthCSS PositionCSS Position OffsetsCSS Z-indexCSS OverflowCSS FloatCSS Inline-blockCSS AlignCSS CombinatorsCSS Pseudo-classesCSS Pseudo-elementsCSS OpacityCSS Navigation BarsCSS DropdownsCSS Image GalleryCSS Image SpritesCSS Attr SelectorsCSS FormsCSS CountersCSS UnitsCSS InheritanceCSS SpecificityCSS !importantCSS Math FunctionsCSS OptimizationCSS AccessibilityCSS Website Layout

CSS Advanced

CSS Rounded CornersCSS Border ImagesCSS BackgroundsCSS ColorsCSS GradientsCSS ShadowsCSS Text EffectsCSS Custom FontsCSS 2D TransformsCSS 3D TransformsCSS TransitionsCSS AnimationsCSS TooltipsCSS Image StylingCSS Image ModalCSS Image CenteringCSS Image FiltersCSS Image ShapesCSS object-fitCSS object-positionCSS MaskingCSS ButtonsCSS PaginationCSS Multiple ColumnsCSS User InterfaceCSS VariablesCSS @propertyCSS Box SizingCSS Media Queries

CSS Flexbox

Flexbox IntroFlex ContainerFlex ItemsFlex Responsive

CSS Grid

Grid IntroGrid ContainerGrid ItemsGrid 12-column LayoutCSS @supports

CSS Responsive

RWD IntroRWD ViewportRWD Grid ViewRWD Media QueriesRWD ImagesRWD VideosRWD FrameworksRWD Templates

CSS SASS

SASS Tutorial

CSS Examples

CSS TemplatesCSS ExamplesCSS EditorCSS SnippetsCSS QuizCSS ExercisesCSS Code ChallengesCSS WebsiteCSS SyllabusCSS Study PlanCSS Interview PrepCSS BootcampCSS Certificate

CSS References

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

CSSContent Pseudo-elements


Content Pseudo-elements

Content pseudo-elements allow you to insert content before or after elements, style list markers, and more.


The CSS ::before Pseudo-element

The::before pseudo-element is used to insert some content before the content of a specified element.

Use thecontent property to specify the content to insert.

Example

Insert an image before the content of each <h3> element: 

h3::before {
  content: url(smiley.gif);
}
Try it Yourself »

The CSS ::after Pseudo-element

The::after pseudo-element is used to insert some content after the content of a specified element.

Use thecontent property to specify the content to insert. 

Example

Insert an image after the content of each <h3> element:

h3::after{
  content: url(smiley.gif);
}
Try it Yourself »


The CSS ::marker Pseudo-element

The::marker pseudo-element is used to style the list item markers.

Example

Style the markers of list items: 

::marker {
  color: red;
  font-size: 23px;
}
Try it Yourself »

The CSS ::selection Pseudo-element

The::selection pseudo-element is used to style the part of a text that is selected by a user.

Example

Style the user-selected text with a red color, and a yellow background: 

::selection {
  color: red;
  background: yellow;
}
Try it Yourself »

The CSS ::backdrop Pseudo-element

The::backdrop pseudo-element is used to style the viewbox behind a dialog box or popover element.

Example

Style the viewbox behind a dialog box: 

dialog::backdrop {
  background-color: lightgreen;
}
Try it Yourself »


CSS Pseudo-elements Reference

For a complete list of all CSS Pseudo-elements, visit ourCSS Pseudo-elements Reference.



×

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-2026 by Refsnes Data. All Rights Reserved.W3Schools is Powered by W3.CSS.

-->
[8]ページ先頭

©2009-2026 Movatter.jp