• 締切済み

次のhtml・cssでspan内の文字を点滅させる

次のhtml・cssでspan内の文字を点滅させるには、どのようにしたらよいのでしょうか。 但し、テスト1が表示されている間は、テスト2と3は消えており、 テスト2、3が表示されている間はテスト1が消えている状態にしたいです。 なぜか、反復の意味を持つdurationタグの後ろに連結して、duration:blinkはできませんでした。 <div class="test"> <span class="brinking1">テスト1</span> <span class="brinking2">テスト2</span> <span class="brinking3">テスト3</span> </div> <style> .test { margin: auto; background-color: white; position: relative; } .test blinking { width: 50%; animation-name: test; -webkit-animation-name: test; animation-duration:blink 10s; -webkit-animation-duration: 10s; animation-iteration-count: infinite; -webkit-animation-iteration-count: infinite; opacity: 0;} .test .brinking1 { display: block; margin: 0 auto; } .test .brinking2,.test .brinking3 { animation-delay:5s; -webkit-animation-delay:5s; position: absolute; top: 0; left: 25%; } @keyframes test { 0% { opacity: 0; } 50% { opacity: 1; } } @-webkit-keyframes test { 0% { opacity: 0; } 50% { opacity: 1; } } </style>

  • CSS
  • 回答数1
  • ありがとう数0

みんなの回答

  • t_hirai
  • ベストアンサー率27% (159/583)
回答No.1

試してないから分かりませんが、「.test blinking {」で、 「blinking」の前にドットがいるのではないでしょうか?

関連するQ&A

  • cssのanimationの設定の仕方

    Animationの表示タイミングが合わないので教えてください。 今回初めてcssのanimationを使ってみました。 同時に、jQuery.BgSwitcher を使って背景画像5枚を5秒間づつ表示させてループさせています。(合計25秒間)そして、cssのanimation でテキストA,B,Cの3枚を25秒間表示させています。 表示タイミングは 【背景画像1を表示 テキストAを表示 テキストBを非表示 テキストCを非表示】 【背景画像2を表示 テキストAを非表示 テキストBを非表示 テキストCを非表示】 【背景画像3を表示 テキストAを非表示 テキストBを表示 テキストCを非表示】 【背景画像4を表示 テキストAを非表示 テキストBを非表示 テキストCを非表示】 【背景画像5を表示 テキストAを非表示 テキストBを非表示 テキストCを表示】 背景画像で使用しているjQuery.BgSwitcherの表示時間は1枚5秒です。5枚ですので25秒でループです。animationが適応されているテキストA,B,Cの animation-duration: 25s; にしています。 テキスト画像A,B,Cは表示されるタイミングではopacity:1 にしてそれ以外はopacity:0で非表示にして背景画像1,2,3とテキストA,B,Cとの表示タイミングが合わせたいです。 初めはタイミングよく背景画像とテキスト画像が表示されているのですが徐々に表示タイミングずれてしまい5分ぐらいするとanimationのテキストA,B,Cの表示タイミングが背景画像と大きくずれ、例えばテキストAが背景画像5で表示されるようになってしまいます。 jQuery.BgSwitcherでの背景画像5枚の1ループの時間は25秒。animationのテキストA,B,Cのanimation-duration: 25s; なのですが、徐々にずれてしまいます。 animation側の設定に問題があるかもしれませんので教えていただけないでしょうか? 現在のテストサイトは下記です。 http://cm-creation.net/yoshida/text-anime-test/index13.html どうぞよろしくお願いいたします。Cssとhtml設定は下記です。 ■cssの設定 .bg-slider { width: 99.1vw; height: 100vh; background-position:center center; background-size: cover; display: flex; justify-content: center; position: relative; } .textA { position: absolute;   top: 5%;    left:20%; animation-name:animation1; animation-duration:25s; animation-timing-function: ease-in-out; animation-delay: 0s;    opacity: 0;    animation-iteration-count: infinite; animation-direction: normal; animation-fill-mode: forwards; } .textB { position: absolute; top: 5%;    right:20%; animation-name:animation2; animation-duration:25s; animation-timing-function: ease-in-out; animation-delay: 0s;   opacity: 0;   animation-iteration-count: infinite; animation-direction: normal; animation-fill-mode: forwards; } .textC { position: absolute; top: 5%; animation-name:animation3; animation-duration: 25s; animation-timing-function: ease-in-out; animation-delay: 0s;     opacity: 0;    animation-iteration-count: infinite; animation-direction: normal; animation-fill-mode: forwards; } @keyframes animation1 { 0% { opacity: 0; transform: translate3d(0, 30px, 0);   } 5% { opacity: 1; transform: translate3d(0, 0, 0);    } 26% { opacity: 0; transform: translate3d(0, 0, 0); } 100% { opacity: 0; transform: translate3d(0, 0, 0); } } @keyframes animation2 { 0% { opacity: 0; transform: translate3d(0, 0px, 0); } 41% { opacity: 0; transform: translate3d(0, 30px, 0); }  45% { opacity: 1; transform: translate3d(0, 0, 0); } 66% { opacity: 0; transform: translate3d(0, 0px, 0); } 100% { opacity: 0; transform: translate3d(0, 0, 0); } } @keyframes animation3 { 0% { opacity: 0; transform: translate3d(0, 0px, 0); }   81% { opacity: 0; transform: translate3d(0, 30px, 0); } 85% { opacity: 1; transform: translate3d(0, 0, 0); }   101% { opacity: 0; transform: translate3d(0, 0px, 0); }  102% { opacity: 0; transform: translate3d(0, 0, 0); } } ■html <script> jQuery(function($) { $('.bg-slider').bgSwitcher({ images: image/main10.jpg','image/main11.jpg','image/main12.jpg','image/main13.jpg','image/main14.jpg'], // 切り替える背景画像を指定 interval: 5000, // 背景画像を切り替える間隔を指定 5000=5秒 loop: true, // shuffle: false, // effect: "fade", // エフェクトの種類をfade,blind,clip,slide,drop,hideから指定 duration: 500, // エフェクトの時間を指定します。 easing: "swing" // エフェクトのイージングをlinear,swingから指定 }); }); </script> <div class="container-fluid px-0 bg-slider " > <div class="textA"><img src="image/item8.png" class="img-fluid" alt=""/></div> <div class="textB"><img src="image/item9.png" class="img-fluid" alt=""/></div> <div class="textC"><img src="image/item10.png" class="img-fluid" alt=""/></div> </div>

    • ベストアンサー
    • HTML
  • スクロールで画面が読み込まれたら動くようにしたい

    下記html、cssでテキストを動くようにしたのですがjavascript(jquery)で スクロールで画面が読み込まれたら動くようにしたいのですがどうすれば良いでしょうか。 素人なのでコピペで教えて欲しいです。 html <body> <section> </section> <div class="heading"> <div> <p class="slide-up">テキスト</p> </div> <div> <p class="slide-up">テキスト</p> </div> <div> </div> </body> </body> </body> css body, html { width: 100%; font-family: 'Times New Roman', Times, serif; } section { height: 200vh; } .fadeUp { animation-name: fadeUpAnime; animation-duration: 0.5s; animation-fill-mode: forwards; opacity: 0; } .heading { margin: 80px 0 0 80px; font-size: 15em; line-height: 90%; } .heading>div { overflow: hidden; } .heading>div>p { width: -webkit-max-content; width: -moz-max-content; width: max-content; white-space: nowrap; margin: 0; } div.heading>div { -webkit-animation-delay: 1s; animation-delay: 1s; } .slide-up { -webkit-animation: slid 2s cubic-bezier(0.65, 0, 0.35, 1) both; animation: slid 2s cubic-bezier(0.65, 0, 0.35, 1) both; } @-webkit-keyframes slid { 0% { transform: translateY(300px); } 100% { transform: translateY(0); } } @keyframes slid { 0% { transform: translateY(300px); } 100% { transform: translateY(0); } }

  • スクロールで画面が読み込まれたら動くようにしたい

    html、cssでテキストを動くようにしたのですがjavascript(jquery)で スクロールで画面が読み込まれたら動くようにしたいのですがどうすれば良いでしょうか。 html <body> <section> </section> <div class="heading"> <div> <p class="slide-up">salon</p> </div> <div> <p class="slide-up">info</p> </div> <div> </div> </body> </body> </body> css body, html { width: 100%; font-family: 'Times New Roman', Times, serif; } section { height: 200vh; } .fadeUp { animation-name: fadeUpAnime; animation-duration: 0.5s; animation-fill-mode: forwards; opacity: 0; } .heading { margin: 80px 0 0 80px; font-size: 15em; line-height: 90%; } .heading>div { overflow: hidden; } .heading>div>p { width: -webkit-max-content; width: -moz-max-content; width: max-content; white-space: nowrap; margin: 0; } div.heading>div { -webkit-animation-delay: 1s; animation-delay: 1s; } .slide-up { -webkit-animation: slid 2s cubic-bezier(0.65, 0, 0.35, 1) both; animation: slid 2s cubic-bezier(0.65, 0, 0.35, 1) both; } @-webkit-keyframes slid { 0% { transform: translateY(300px); } 100% { transform: translateY(0); } } @keyframes slid { 0% { transform: translateY(300px); } 100% { transform: translateY(0); } }

  • アニメーションのプログラムの挙動の意味

    @charset "utf-8"; .box { width: 80px; height: 80px; background: pink; animation-name: move-around; animation-duration: 4s; animation-iteration-count: infinite; } ここから意味を知りたい。 @keyframes move-around { 25% { transform: translate(100px, 0); } 50% { transform: translate(100px, 100px); } 75% { transform: translate(0, 100px); } } ここまで ▢ → ▢ ↑    ↓ ▢ ← ▢ このプログラムを実行すると。 四角がこのように移動するのですが 自分の考えていた命令文と違う気がするのですが ご教示お願いしたいです、宜しくお願いします。 因みにドットインストールのアニメーション編の問題です。

    • ベストアンサー
    • CSS
  • xcodeで文字の点滅をしたいのですが

    xcode初心者です。 iphoneアプリ作成中でトップページの表紙にActionButtonを設置して「push start」と文字をいれました。 この文字を点滅させたいのです。 文字の点滅をネットで調べると点滅する為のメソッドがあるのですが、そのメソッドをどう使うのかがわかりません。そのメソッド↓ - (void)blinkImage:(UIImageView *)target { CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@"opacity"]; animation.duration = 0.1f; animation.autoreverses = YES; //animation.repeatCount = animation.repeatCount = 3; //infinite loop -> HUGE_VAL animation.fromValue = [NSNumber numberWithFloat:1.0f]; //MAX opacity animation.toValue = [NSNumber numberWithFloat:0.0f]; //MIN opacity [target.layer addAnimation:animation forKey:@"blink"]; } ActionButtonを -(IBAction)pushStartAction:(id)sender;としました。 これだと文字が弄れないと思いまして、Labelも作成しました。 @property(weak,nonatomic)IBOutlet UIButton *pushStartLabel; Buttonが表示される直後に点滅が始まるようにしたいので viewDidLoadに書くのかなと思いましたが、ここでどう書いたらいいのか わからなくなりました。 Buttonが表示される時に上記のメソッドを呼べばいいかと思うのですが、 分かる方ご教授頂ければと思います。 宜しくお願いします。

  • spanタグ 無視される

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>sample</title> <style type="text/css"> span.test{ padding: 6px 0px; background-color: gainsboro; text-align:center; border: 1px gray solid; margin-top:10px; margin-bottom:8px; color: gray; width: 100px; } </style> </head> <body> <span class="test"> <a href="#A"> A</a> </span> <br> <span class="test"> <a href="#B"> B</a> </span> </body> </html> ------------------------- というソースで spanタグで padding: margin-top:10px; margin-bottom:8px; width: が無視されてしまうのですが なぜでしょう? 更に画像のように文字が重なってしまいます。 padding: margin-top:10px; margin-bottom:8px; width: これらを適用させるにはどうすればいいでしょうか? AとBは隣同士に表示したいため、divではなく、spanを使用しました。

    • ベストアンサー
    • HTML
  • CSS3キーフレームアニメーションで%毎の時間指定

    CSS3キーフレームアニメーションで、 アニメーション全体ではなく、%毎の時間指定をするにはどうすればよいでしょうか? ・例えば、95%に記述した処理を、30秒かけて実施するには? 95%{opacity:0.2;animation-duration:30s}?

    • 締切済み
    • CSS
  • HTML CSS で文字を点滅させたい

    HTMLにCSSを含める学習中です。 以下のようにHTMLを書き、edgeで表示してみましたが点滅してくれません。 どこが違うのか教えてもらえませんでしょうか。 <HTML> <HEAD> <META http-equiv="Content-Type" content="text/html;charset=SHIFT_JIS"> <TITLE>テスト ホームページ</TITLE> <style type="text/css"> p { color: orange; font-size: 20px; animation: blinkEffect 1s ease infinite; } </style> </HEAD> <BODY> □□□□□□□□□□□ <BR> <p class="p">この部分の文字を点滅</p> ■■■■■■■■■■■ <BR> <BR> <p>これは例文です。</p> <BR> </BODY> </HTML>

  • 超段組で作成の文字ずれの対応

    文字サイズを大にすると下記写真の表示されますが何か対策がありますか。 写真の上が文字サイズを大です。下が文字サイズを中です。 .up {font-size:0.82em;vertical-align:super;} .wmx {width:57em;clear:both;} .s05 {margin-left:5em;} .l03 {width:3em;float:left;} .l08 {width:8em;float:left;} .l18 {width:18em;float:left;} .l20 {width:20em;float:left;} .s009 {margin-left:0.9em;} .rz {font:0.9em/110% "MS 明朝",serif;letter-spacing:0.1em;} .m_f {margin-top:0.3em;} .rt {font:0.71em/100% "MS 明朝",serif;} .c_b {clear:both;} .mtf {margin-top:0.2em;} <div class="wmx"> 駿州庵原郡樽の上村、武田甚右エ門の子に、兄に左次右エ門、弟に権兵衛といふ者あり、かの権兵衛25の年、<span class="up">(今より)</span>3 <div class="s05 l18"><div class="s009 rz">辛 未</div></div><div class="s009 l08"><div class="rz">狩り</div></div></div><div class="l20"><div class="m_f rt">けんぞくかえ</div></div><div class="l03"><div class="m_f rt">しし</div></div> <div class="c_b">0年以前、かのとひつじの年正月17日に、竜爪山に殺生に出て、我が眷 属 鹿のしし16匹連れて遊びゐる中に、鹿の額白く</div> <div class="c_b"><div class="mtf">背筋同じく白房の如くなるを、<span class="up">(彼の者が)</span>鉄砲にて撃ちとむる。それによって我、彼の者に乗り移る。<span class="up">(その結果彼の者は)</span>言葉乱</div> 超段組で作成の文字ずれの対応方法を教えて下さい http://ryuso.info/rk/rk275_277.htm

    • 締切済み
    • CSS
  • HTMLやcssに詳しい方教えてください

    HTML、cssに詳しい方、助言お願いします。 footerの部分なのですが、footerより上の部分(サイドのナビやメイン部分)にj Query、javascriptを入れる(入れたのはアコーディオン)と、footerの部分がおかしくなります(footerのbackground-colorが一部消えるなど) どなたか、もしおかしい部分があるのでしたら、おかしい部分の指摘をお願いします。xxxはテキストを入れている部分です。 footerのHTML <div class="footercolor clearfix"> <div id="footer"> <div class="footerbox1"> <ul class="footertext1"> <li><a href="../ranking.html">xxx</a></li> <li><a href="../area-top/area.html">xxx</a></li> </ul></div> <div class="footerbox2"> <ul class="footertext2"> <li><a href="../index.html">xxx</a></li> <li><a href="../site.html">xxx</a></li> <li><a href="../info.html">xxx</a></li> <li><a href="../system.html">xxx</a></li> </ul></div> <div class="footerbox3"> <ul class="footertext3"> <li><a href="../inquiry.html">xxx</a></li> </ul></div> </div> <address class="copyright">Copyright (C) xxx.com 2014 All Rights Reserved.</address> footerのcss .footercolor{ background-color:#FFCC99; } #footer{ width:960px; margin:0 auto; } .footerbox1{ width:320px; float:left; } .footerbox2{ width:320px; float:left; } .footerbox3{ width:320px; float:left; } .footertext1{ text-align:center; margin-top:12px; list-style:none; padding:3px; } .footertext2{ margin-top:12px; list-style:none; padding:3px; text-align:left; margin-left:80px; } .footertext3{ text-align:center; margin-top:12px; list-style:none; padding:3px; margin-left:50px; } .footertext1 a:hover{ filter:alpha(opacity=50); -moz-opacity: 0.5; opacity: 0.5; } .footertext2 a:hover{ filter:alpha(opacity=50); -moz-opacity: 0.5; opacity: 0.5; } .footertext3 a:hover{ filter:alpha(opacity=50); -moz-opacity: 0.5; opacity: 0.5; } .copyright{ clear:both; text-align:center; font-weight:bold; padding-top:50px; padding-bottom:10px; }

    • 締切済み
    • SEO

専門家に質問してみよう