honk

超有意思的 html 頁面

  •  2
     
  •   honk · Oct 19, 2020 · 5565 views
    This topic created in 2214 days ago, the information mentioned may be changed or developed.
    17 replies  •  2020-10-20 19:28:34 +08:00
    ashine
    ashine
    Oct 19, 2020
    1
    没发现哪里特别的,不就是几个 css 的特性吗
    wanacry
    wanacry
    Oct 19, 2020 via iPhone
    2
    有意思的点在哪?
    opengps
    opengps
    Oct 19, 2020❤️1
    3
    谁解读下用法,html 代码可见但是却不影响只选中文本,我是第一次见
    JmmBite
    JmmBite
    Oct 19, 2020
    4
    ```css
    html::before {content:'<html>'}
    html::after {content:'</html>'}
    head::before {content:'<head>'}
    head::after {content:'</head>'}
    title::before {content:'<title>'}
    title::after {content:'</title>'}
    body::before {content:'<body>'}
    body::after {content:'</body>'}
    h1::before {content:'<h1>'}
    h1::after {content:'</h1>'}
    h2::before {content:'<h2>'}
    h2::after {content:'</h2>'}
    p::before {content:'<p>'}
    p::after {content:'</p>'}
    pre::before {content:'<pre>'}
    pre::after {content:'</pre>'}
    code::before {content:'<code>'}
    code::after {content:'</code>'}
    a::before {content:'<a>'}
    a::after {content:'</a>'}
    aside::before {content:'<aside>'}
    aside::after {content:'</aside>'}
    blockquote::before {content:'<blockquote>'}
    blockquote::after {content:'</blockquote>'}
    em::before {content:'<em>'}
    em::after {content:'</em>'}
    strong::before {content:'<strong>'}
    strong::after {content:'</strong>'}
    ```
    xycool
    xycool
    Oct 19, 2020
    5
    @opengps #3 套娃用法,仔细查看一个标签的样式就能发现,比如:
    ```h1::before {content:'<h1>'}
    h1::after {content:'</h1>'}```
    finian
    finian
    Oct 19, 2020
    6
    有意思的地方就是源码和展示的内容是一样的
    yuzo555
    yuzo555
    Oct 19, 2020❤️2
    7
    用 CSS 的 content 属性实现在常见元素的 before 和 after 加上文字开关;
    (@opengps 而 content 属性显示内容是无法被选中的)

    然后给 * 所有元素加上 display:block,这样就实现了 <body> 内部的 <style> 内部内容也能显示出来。
    des
    des
    Oct 19, 2020
    8
    这不算有意思吧,来看看这个? sojo.im
    honk
    honk
    OP
    Oct 19, 2020 via Android
    9
    @des 闪瞎了我的眼
    martinsu
    martinsu
    Oct 20, 2020
    10
    @des Edge 提示风险
    kaiki
    kaiki
    Oct 20, 2020
    11
    可惜 link 用的 attr,实际上是在 css 里面把这个 link 重写了一遍
    sinv
    sinv
    Oct 20, 2020 via Android
    12
    @des Hacked by RR
    Mutoo
    Mutoo
    Oct 20, 2020 via iPhone
    13
    我的主页也是类似的效果,只不过是 javascript 实现: https://mutoo.im
    Ritter
    Ritter
    Oct 20, 2020
    15
    菜狗有个问题 这样每个标签前后都加 before after 不累吗 还是有工具可以批量生成
    honk
    honk
    OP
    Oct 20, 2020 via Android
    16
    @Ritter 只是 CSS 特性的取巧式利用。
    真实项目不可能这样用的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   953 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 19:20 · PVG 03:20 · LAX 11:20 · JFK 14:20
    ♥ Do have faith in what you're doing.