コンテンツへスキップ

CSS note

ワードプレステーマとCSS

Shrunk Expand

メインナビゲーション

  • CSS イベント
  • テキスト
    • 縦書き
  • WordPress
    • gutenberg PHP
    • gutenberg CSS
  • 投稿一覧
  • タグ別アーカイブ: pointer-events
  • リンクを無効にするスタイル

    No links anchor element with CSS

    記述したリンクを無効にしたいといった事がたまにあります。

    例えば、

    電話番号リンク等を作成した場合、PCではうまく動作しないので、メディアクエリ―を使って、一定のブラウザサイズ以上では、電話番号リンクが動作しないようにするとか

    WordPressのプライマリーメニューなどで、親になる項目は、hoverした時に、サブメニューを表示したいけど親ページには飛ばしたくないといったケース等

    少し工夫すると、CSSだけでお手軽にリンクを無効にすることが出来ます。

    CSS

    .no-links{
    	pointer-events: none;
    	cursor: default;
    	text-decoration:none;
    }

    HTML

    	<article> 
    	<h2>No links</h2>
    <a class="no-links" href="http://www.tenman.info/">no link</a>
    <a href="http://www.tenman.info/">tenman.info</a>
    	</article> 
    

    example

    no link  
    tenman.info

    browser support

    ブラウザサポート

    Can I Use pointer-events? Data on support for the pointer-events feature across the major browsers from caniuse.com.

    relate link

    特定のカテゴリーで、表示はそのまま、リンクだけを外したい

    javascript

    aタグの無効化 - preventDefaultとreturn falseの違い

    [jQuery]イベントのバブリングって何?


    投稿日: 2012 年 6 月 tenman
    投稿グループ テキスト タグ pointer-events


©2025 cssTheme URI: http://www.tenman.info/wp3/bootsDescription: Raindrops theme of child theme boots, which is the theme for a simple blog, but changing the settings of the customizer, and is scalable themes that can be used as a portal site. I Won’t Let You Down. Supported languages Japanese - JAPAN (ja) French - FRANCE (fr_FR) Polish - POLAND (PL) (pl_PL) Portuguese - BRAZIL (pt_BR)Author: TenmanAuthor URI: http://www.tenman.info/wp3/Version: 1.400Tags:black, blue, gray, brown, green, orange, pink, purple, red, silver, tan, white, yellow,dark,light,one-column,two-columns,three-columns,four-columns,left-sidebar,right-sidebar, custom-colors, custom-header, custom-background, custom-menu, editor-style, theme-options, threaded-comments, sticky-post, translation-ready, post-formats, featured-images, full-width-template, fixed-layout, fluid-layout, responsive-layoutLicense: GNU General Public License v2.0License URI: http://www.gnu.org/licenses/gpl-2.0.htmlText Domain: bootsTemplate: raindrops 投稿フィード かつ コメントフィード Child theme CssTheme URI: Http://www.tenman.info/wp3/bootsDescription: Raindrops Theme Of Child Theme Boots, Which Is The Theme For A Simple Blog, But Changing The Settings Of The Customizer, And Is Scalable Themes That Can Be Used As A Portal Site. I Won’t Let You Down. Supported Languages Japanese - JAPAN (ja) French - FRANCE (fr_FR) Polish - POLAND (PL) (pl_PL) Portuguese - BRAZIL (pt_BR)Author: TenmanAuthor URI: Http://www.tenman.info/wp3/Version: 1.400Tags:black, Blue, Gray, Brown, Green, Orange, Pink, Purple, Red, Silver, Tan, White, Yellow,dark,light,one-column,two-columns,three-columns,four-columns,left-sidebar,right-sidebar, Custom-colors, Custom-header, Custom-background, Custom-menu, Editor-style, Theme-options, Threaded-comments, Sticky-post, Translation-ready, Post-formats, Featured-images, Full-width-template, Fixed-layout, Fluid-layout, Responsive-layoutLicense: GNU General Public License V2.0License URI: Http://www.gnu.org/licenses/gpl-2.0.htmlText Domain: BootsTemplate: Raindrops of レインドロップス テーマ
Lock Icon