---
title: "Discussion on \"#66 CSS :target / ::target-text —— 在滾動時，強調 hash 連結的目標\" | Hashnode"
description: "Discussion on \"#66 CSS :target / ::target-text —— 在滾動時，強調 hash 連結的目標\". ⚠️ 本篇文章已搬遷至 css.im1010ioio.dev，請至新站閱讀完整版。\n\n\n昨天我們讓很長內容的滾動範圍可以用 hash 連結滑順地滾動，今天我們要進一步優化它。\n當網頁內容很長，使用者滾來滾去時可能會搞不清楚目前位置，所以今天我要來用 CSS 最簡單的方法 Highligh hash 連結的目標。\n今天我們要介紹 2 個 CSS 選擇器語法：\n\n:target：針對 HTML 元素去調整樣式\n\n::target-text：針對指定的「文字片段」去調整樣式\n\n\n非常簡單喔！讓我們一起..."
url: "https://hashnode.com/posts/css-pseudo-target-and-target-text/68cace72ff3f9e133c1b63a3"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [#66 CSS :target / ::target-text —— 在滾動時，強調 hash 連結的目標](https://im1010ioio.hashnode.dev/css-pseudo-target-and-target-text?utm_source=hashnode&utm_medium=feed)

⚠️ 本篇文章已搬遷至 css.im1010ioio.dev，請至新站閱讀完整版。 昨天我們讓很長內容的滾動範圍可以用 hash 連結滑順地滾動，今天我們要進一步優化它。 當網頁內容很長，使用者滾來滾去時可能會搞不清楚目前位置，所以今天我要來用 CSS 最簡單的方法 Highligh hash 連結的目標。 今天我們要介紹 2 個 CSS 選擇器語法： :target：針對 HTML 元素去調整樣式 ::target-text：針對指定的「文字片段」去調整樣式 非常簡單喔！讓我們一起...

Sep 17, 2025 · 1 min read · im1010ioio.hashnode.dev  
Updated Feb 4  
Read the article

-   [#target-text](https://hashnode.com/tag/target-text)
-   [#css](https://hashnode.com/tag/css)
-   [#css3](https://hashnode.com/tag/css3)
-   [#pseudo-elements](https://hashnode.com/tag/pseudo-elements)
-   [#target](https://hashnode.com/tag/target)
-   [#hashing](https://hashnode.com/tag/hashing)
-   [#links](https://hashnode.com/tag/links)

## Written by

[YI-LIN CHEN (Eva)](https://hashnode.com/@im1010ioio)

@im1010ioio · Taipei, Taiwan

  
[View profile](https://hashnode.com/@im1010ioio)

ғʀᴏɴᴛᴇɴᴅ ᴅᴇᴠᴇʟᴏᴘᴇʀ / ᴅᴇsɪɢɴᴇʀ / ᴄʀᴇᴀᴛᴏʀ

Chief Designer @HealthyPlate

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
