Skip to content

Kévin Dunglas

Founder of Les-Tilleuls.coop (worker-owned cooperative). Creator of API Platform, Mercure.rocks, Vulcain.rocks and of some Symfony components.

Menu
  • Talks
  • Resume
  • Sponsor me
  • Contact
Menu

Changer la couleur du texte sélectionné dans une page web

Posted on April 5, 2008January 12, 2014 by Kévin Dunglas

Comme vous pouvez l’avez peut-être remarqué sur ce blog, il est possible de changer la couleur des sélections dans une page web avec les CSS. Pour créer cet effet sympa, qui ne fonctionne que sous Firefox et Safari, nous devront utiliser les sélecteurs non standardisés ::-moz-selection pour le premier et ::selection pour le second. Ils supportent tous deux les propriétés color et background-color.

Un petit example :

/* Le code pour Firefox / Gecko */
::-moz-selection {
color: white;
background-color: #379CB3;
}
/* Le code pour Safari / Webkit */
::selection {
color: white;
background-color: #379CB3;
}

Vous pouvez aussi changer les couleurs de la sélection pour un élément particulier. Par exemple span::-moz-selection pour les navigateurs basés sur le moteur de rendu Gecko et span::selection pour ceux utilisant Webkit n’affectera que le texte encadré de la balise HTML <span>.

Related posts:

  1. Mon premier billet sur le blog d’Ankama Web
  2. Masquer les IPs dans DokuWiki
  3. Du code dans vos pages web !
  4. Création de la Mozilla Corporation, la vigilance est de mise !

Leave a Reply Cancel reply

Follow me on Twitter

My Tweets

Subscribe to this blog

Recent Posts

  • Read the Linux Manual Pages on Mac and BSD, Directly From the Terminal
  • Ne vous lamentez pas, organisez-vous !
  • FrankenPHP: The Modern Php App Server, written in Go
  • API Platform 3 Is Released!
  • Mercure 0.14: Major Performance Improvement and New Features

Top Posts & Pages

  • JSON Columns and Doctrine DBAL 3 Upgrade
  • Securely Access Private Git Repositories and Composer Packages in Docker Builds
  • Generate a Symfony password hash from the command line
  • Preventing CORS Preflight Requests Using Content Negotiation
  • Goroutines, threads, and thread IDs
  • Symfony's New Native Docker Support (Symfony World)
  • FrankenPHP: The Modern Php App Server, written in Go
  • Connection to a MS SQL Server from Symfony / Doctrine on Mac or Linux
  • PHP 7: Introducing a domain name validator and making the URL validator stricter
  • 6 plugins Symfony indispensables

Persistence in PHP with the Doctrine ORM

Persistence in PHP with the Doctrine ORM

Tags

Apache API API Platform Buzz Caddy Docker Doctrine Go Google GraphQL HTTP/2 Hydra hypermedia Hébergement Javascript JSON-LD Kubernetes La Coopérative des Tilleuls Les-Tilleuls.coop Lille Linux Mac Mercure Mercure.rocks Messagerie Instantanée MySQL PHP Punk Rock Python React REST Rock'n'Roll RSS Schema.org Security SEO SEO Symfony Symfony Live Sécurité Ubuntu Web 2.0 Wordpress XHTML XML

Archives

Categories

  • DevOps (25)
  • Mercure (4)
  • Opinions (91)
  • Programming (185)
    • Android (5)
    • Go (13)
    • JavaScript (43)
    • PHP (143)
      • API Platform (65)
      • Symfony (89)
    • Python (14)
      • Django (5)
  • Security (15)
  • SEO (24)
  • Talks (39)
  • Ubuntu (68)
  • Wordpress (6)

Social

  • Mastodon
  • Twitter
  • LinkedIn
  • YouTube
  • GitHub

Links

  • API Platform
  • Les-Tilleuls.coop
  • Mercure.rocks
  • Vulcain.rocks
© 2023 Kévin Dunglas | Powered by Minimalist Blog WordPress Theme