リンクの下線と文字の間隔を開けるには

このQ&Aのポイント
  • ブログでリンクの下線と文字の間隔を開ける方法を教えてください。padding-bottom: px という方法があるようですが、うまくいきません。
  • リンクのスタイルを変更して、下線と文字の間隔を開ける方法を教えてください。試したpadding-bottom: px の方法がうまくいきません。
  • ブログでリンクの下線と文字の間隔を変えたいのですが、うまくいきません。padding-bottom: px の方法を試してみましたが、うまくいきませんでした。
回答を見る
  • ベストアンサー

リンクの下線と文字の間隔を開けるには

ブログでやりたいんですが、教えてください。調べてみると、padding-bottom: px らしいんですけど、うまくいきません。リンクの部分は次のような記述(ライブドア)になっているんですが、どう書き換えればいいのでしょうか。 a{color:#666;text-decoration:underline;} a:link{color:#666;text-decoration:underline;} a:visited{text-decoration:underline;} a:active{} a:hover{background-color:orange;text-decoration:none;} よろしくおねがいします

  • N0W
  • お礼率91% (309/337)
  • HTML
  • 回答数1
  • ありがとう数2

質問者が選んだベストアンサー

  • ベストアンサー
  • k_jill
  • ベストアンサー率34% (36/105)
回答No.1

text-decorationだと多分下線の位置を細かく弄れないと思います。この下線装飾を消して、ボックスの枠線で擬似的な下線を作るのがpaddingを使う方法だと思います。  という事でやや無理矢理っぽいですが…。 a:link { text-decoration : none; margin : 0px; padding : 0px; padding-bottom : 2px; border-bottom-style : solid; border-bottom-width : 1px; } a:visited{ text-decoration : none; margin : 0px; padding : 0px; padding-bottom : 2px; border-bottom-style : solid; border-bottom-width : 1px; } a:hover { text-decoration : none; margin : 0px; padding : 0px; padding-bottom : 2px; border-bottom-style : solid; border-bottom-width : 1px; } a:active{ text-decoration : none; margin : 0px; padding : 0px; padding-bottom : 2px; border-bottom-style : solid; border-bottom-width : 1px; }  下線と文字の間隔は padding-bottom で変更して下さい。線の太さは border-bottom-width でどうぞ。  不細工な指定ですが多分此れで大丈夫なはず…。

N0W
質問者

お礼

すごい!できました! なるほどボックスの枠線を利用するしかなかったんですね。 ありがとうございました!

関連するQ&A

  • divでくくった中の要素にa link

    以下のdivでくくった中の要素にa link等の カラーの指定をしたいのですが、どのように記述したらよいでしょうか。 div.main { width: 560px; padding-top: 15px; padding-left: 20px; line-height: 130%; } --------------- div指定していないところでは a:link, a:visited { color: #000000; font-size: 12px; line-height: 120%; text-decoration: none; } a:hover { color: #0066CC; text-decoration: underline; } a.navia:link, a:visited { font-size: 8pt; color: #666666; text-decoration:none;} a.navia:hover { color: #FF6633 ; text-decoration:underline } の2つを記述しています。

    • ベストアンサー
    • HTML
  • IEで画像が表示できません

    Firefoxでは画像が表示できるのですがIEでは表示されません スタイルーシートは下記のとおりです。 お願いいたします。 body {background: url("http://pub.ne.jp/man96/image/user/1170964897.gif") repeat-y; background-position:0px 0px; padding: 1;} a { color: #66c; text-decoration: none; } a:link { color: #66c; text-decoration: none; } a:visited { color: #66c; text-decoration: none; } a:active { color: #66c; text-decoration: none; } a:hover { color: #66c; text-decoration: underline; } h1, h2, h3 { margin: 0px; padding: 0px; } #banner { font-family: verdana; color: #777; font-size: 13px; font-weight: bold; text-align: 0px 0px; margin-bottom:11px; background: #ccffff この画像がIEで表示されなくて背景色です url("http://pub.ne.jp/man96/image/user/1170626058.jpg")no-repeat; background-position: center;padding:0px;height:250px; } ちなみにURL:http://pub.ne.jp/man96/です

  • blog CSSのタイトル色の変更指定について!!

    このblog CSSのブログタイトルの色変更はどうすればいいですか? .blogtitle の所で色指定してもダメでした?他に方法があるのですか? livedoor Blog CSS FileName: ネコさん(20040819) Version: 2006.06.26 ----------------------------------------------------- */ #header{} #header td{ color:#FFF; font-size:12px; text-align:right; padding-right:10px; } #header a:link{color:#FFF;} #header a:visited{color:#FFF;} #header a:active{color:#FFF;} #header a:hover{color:#FFF;text-decoration:none;} body{ margin:0; padding:0; text-align:center; font-family: verdana ,arial ,sans-serif; background-color: #4d9d1c; /*background:#4d9d1c url('https://parts.blog.livedoor.jp/old_img_com/img/usr/20040819/bg.gif') repeat-y 50% 0;*/ } a{color:#666;text-decoration:underline;} a:link{color:#666;text-decoration:underline;} a:visited{text-decoration:underline;} a:active{} a:hover{color:#666;text-decoration:none;} #container{ width:833px; margin:0 auto; text-align:left; word-break:break-all; background:url('https://parts.blog.livedoor.jp/old_img_com/img/usr/20040819/header.gif') no-repeat; } #banner,#subbanner{ width:833px; height:185px; margin:0 auto 35px;; } #banner a{color:#fff;text-decoration:none;} #banner a:link{color:#fff;text-decoration:none;} #banner a:visited{text-decoration:none;} #banner a:active{} #banner a:hover{color:#fff;text-decoration:underline;} #subbanner a{color:#fff;text-decoration:underline;} #subbanner a:link{color:#fff;text-decoration:underline;} #subbanner a:visited{text-decoration:underline;} #subbanner a:active{} #subbanner a:hover{color:#fff;text-decoration:none;} h1,h2,h3{margin:0;padding:0;} .blogtitle{ font-size:20px; font-weight:bold; padding-top:85px; padding-right:70px; text-align:right; } .description{ color:#000; font-weight:bold; font-size:12px; padding-right:70px; text-align:right; } #categorytitlebody{} #categorytitle{ font-size:14px; font-weight:bold; text-align:center; padding:20px 10px 15px 10px; } #blogcontainer{width:755px;margin:0 auto auto 20px;background-color:#FFF;} #content{ width:564px; float:left; padding-left:10px; text-align:left; padding-bottom:50px; } #links{ width:170px; float:right; padding-bottom:50px; } .blog{} .date{ color:#4d9d1c; font-size:14px; font-weight:bold; text-align:left; margin-bottom:5px; } .title{ font-size:14px; font-weight:bold; text-align:left; background:url('https://parts.blog.livedoor.jp/old_img_com/img/usr/20040819/nikukyu.gif') no-repeat 0 50%; padding-left:26px; } .blogbody{ line-height:130%; text-align:left; background-color:#f3f1e2; padding:10px 0px 0px 10px; } .main,.mainmore,.portal-links{ line-height:150%; font-size:12px; padding:18px 10px 30px 26px; } blockquote{ padding:5px; margin:5px; border:2px dotted #4d9d1c; } .pict{margin:5px;} .posted{ color:#000; font-size:11px; text-align:left; margin:0; padding:10px 15px 10px 26px; } a.posted{color:#000;text-decoration:underline;} a.posted:link{color:#000;text-decoration:underline;} a.posted:visited{text-decoration:underline;} a.posted:active{} a.posted:hover{color:#000;text-decoration:none;} .menu{ font-size:11px; text-align:right; padding:2px 15px 20px 26px; } .blogbodybottom{ margin-bottom:20px; } .comblogbodybottom{ margin-bottom:20px; } #contentcommentbottom{} .formbodybottom{} #articletop{} #articlebody{} #articlebottom{} .trackbackurlbody{ text-align:left; padding-left:10px; } .trackbackurlttl{ background:url('https://parts.blog.livedoor.jp/old_img_com/img/usr/20040819/nikukyu.gif') no-repeat 0 50%; font-size:12px; font-weight:bold; padding-left:26px; } .trackbackurl{ padding-top:10px; padding-bottom:20px; text-align:left; } .trackbackurl table{width:350px;margin:0 auto;} input.trackbackbox{width:300px;} .trackbackurlbottom{} a.posttitle:link{color:#000;text-decoration:underline;font-si

    • 締切済み
    • CSS
  • リンクの下線を破線にしているのですが…

    リンクの下線を破線にするスタイルシートを使用しているのですが、 通常の左寄せや<center>タグで囲ったテキストでは正常に動作するのに、 <div align="right">または<p align="right">で囲った右寄せのテキストには破線が表示されません。 どうすれば表示されるようになるでしょうか。 私が使用しているスタイルシートは以下の通りです。 <style type="text/css"> <!-- A:link {color:#666666; text-decoration:none; border-bottom:1px dashed #00CCCC;} A:visited {color:#666666; text-decoration:none; border-bottom:1px dashed #00CCCC;} A:hover {color:#FF3300; text-decoration:none; border-bottom:1px dashed #00CCCC;} --> </style>

  • divでくくったけれど、反映が変になります。

    divで指定した2つのリンク要素なのですが、 mainのくくりの中の文字にleftsideの設定が反映されてしまいます。 でも、mainで指定した div#main a:hover { color: #6699FF ; text-decoration: underline; }だけはそのまま活きています。 どこが間違っているのでしょうか。 div#main a:link, a:visited { color: #3300FF ; text-decoration: underline; } div#main a:hover { color: #6699FF ; text-decoration: underline; } div#leftside a:link, a:visited { color: #000000 ; text-decoration: none; } div#leftside a:hover { color: #6699FF ; text-decoration: none; }

    • ベストアンサー
    • HTML
  • スタイルシートで。。

    こんにちは。 外部CSSをリンクさせてCSSを反映させています。 そこで質問です。 リンク箇所には下線がでるようにしていますが、リンクのある画像にまで下線がついてしまうのです。 画像だけには適用させない、というようなタグはありますか? ちなみにこういうのを記述してます a:link{color:#cccccc;text-decoration:none;border-bottom: #ffffff 1px dashed;} a:visited{color:#cccccc;text-decoration:none;border-bottom: #ffffff 1px dashed;} a:active{color:#cccccc;text-decoration:none;border-bottom : #ffffff 1px dashed;} a:hover{color:#cccccc ;text-decoration:none;background-color : #688999; border-bottom : #ffffff 1px dashed;} なにか回避方はありませんでしょうか? 教えてください、よろしくお願いいたします。

    • ベストアンサー
    • HTML
  • CSSでリンクテキストの背景色を透過させたい

    こんにちは。 検索してみたのですが、「背景色をつける」方法は数あれど、「透過させる」 方法は見つかりませんでしたので質問します。 ボックスの背景に青色グラデーションがかかっています。 このボックスの中に書いたテキストの一部に、リンクを貼りました。 ブラウザで確認すると、リンクテキスト部分の背景だけ、白くなっています。 通常のリンクは a{ text-decoration: underline; color: #333399;} a:link{ text-decoration: underline; color: #333399;} a:visited{ text-decoration: underline; color: #333399;} a:active{ text-decoration: underline; color: #333399;} a:hover{ text-decoration: underline; color: #99ccff;} と指定してますので、テキストリンクはオンマウス時だけテキスト色が 変わるようになっています。で、これを強引に透過できないか?と思い a{ text-decoration: underline; color: #333399; background-image: url("../img/spacer.gif");} a:link{ text-decoration: underline; color: #333399; background-image: url("../img/spacer.gif");} a:visited{ text-decoration: underline; color: #333399; background-image: url("../img/spacer.gif");} a:active{ text-decoration: underline; color: #333399; background-image: url("../img/spacer.gif");} a:hover{ text-decoration: underline; color: #99ccff; background-image: url("../img/spacer.gif");} ↑などということをやってみましたが、効果はありませんでした。 できる・できない、どちらでも構いませんので、ご存知の方がいらっしゃいましたらご教授願います。

  • CSSで表示が異なってしまう

    下記のようなCSSを使っているのですが、リンクが入ると表示が異なってしまいます。 画像の下のようにしたいのですが、どうすればよろしいでしょうか? よろしくお願いします。 ■ CSS A:link{ color:#0095ff; text-decoration: none;} A:visited{ color:#0095ff; text-decoration: none;} A:hover{ color:#00efff; text-decoration: underline;} A:active{ color:#00efff; text-decoration: underline;} .style02{ padding:3px 0 0 6px; margin-bottom: 5px; font-size:16px; font-weight:bold; background-image:url(../_images/h_02.gif); background-repeat:repeat-x; border: 1px solid #000000; color: #000000; } ■ ソース <a class="style02" href="http://www.hogehoge.com">トップページ</a> <div class="style02">トップページ</div>

    • ベストアンサー
    • HTML
  • リンクの色について

    スタイルシート部分を .navi1 a:link, .navi1 a:visited{ display:block; background-image:url(images/1.gif); text-decoration:none; line-height:30px; font-size:12px; text-align:left; height: 30px; padding-left:11px; font-weight: bold; color: #00FF00; } .navi1 a:hover, {text-decoration:none; color:#FFFF00;} .top a:link, .rank a:visited{ color:#379E02; } .top a:hover{ color: #FF0066;} HTML部分を <div class="navi1"><a href="#">テキスト1</a></div> <div class="top"><a href="#">テキスト2</a></div> とした時に、IEでは思ったように表示されるのですが FirefoxやChromeではテキスト1は#00FF00のままマウスを乗せても色が変わらず テキスト2は色が紫になっています。 これをIEと同じ様に表示させるにはどうすればいいのでしょうか?

    • ベストアンサー
    • HTML
  • リンクのスタイルシートについての質問

    スタイルシートを作成しています。 リンクにアクションをつけたのですが 思うような動作にならずに、悩んでします。 ちなみに動作確認はIE6で行っています。 ◆現在の動き リンクにマウスをのせると箱が上下に動いてしまう。 ◆どうしたいか リンクにマウスののせても箱が上下に動かないようにしたい。 固定したいとうことです。 以下に作成したソースをのせておきますので わかる方いましたら教えていただけると幸いです。 a.menu01{ text-decoration:none; text-align: center; border:#FFF solid 1px; background-color:#DACD96; width:280px; font-size:15px; font-weight:bold; color:#FFF; padding:5px; display:block; letter-spacing: 5px; margin-bottom:10px; } a.menu01:active { margin-bottom:10px; } a.menu01:visited{ margin-bottom:10px; text-decoration:none; } a.menu01:hover { text-decoration:none; color:#AA8B62; background-color:#FFFFFF; margin-bottom:10px; }

専門家に質問してみよう