並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 32 件 / 32件

新着順 人気順

widthの検索結果1 - 32 件 / 32件

タグ検索の該当結果が少ないため、タイトル検索結果を表示しています。

widthに関するエントリは32件あります。 csshtmlweb制作 などが関連タグです。 人気エントリには 『【2020年夏】imgタグにはwidthとheight属性を書くのがいいらしい』などがあります。
  • 【2020年夏】imgタグにはwidthとheight属性を書くのがいいらしい

    そうなんです。 2020年夏、ページの読み込み中にレイアウトがシフトしないように、img要素にはwidthとheight属性を記述するのがいいらしいんです。 <img src="link/to/image.jpg" width="300" height="400" alt="画像の説明"> その昔、これが普通の時代もあったんですけどね。レスポンシブな時代にはwidthとheight属性を書かないのが一般的(?)になっていました。また、widthとheight属性が記述してあってもCSSでwidth: 100%; height: auto;が指定されているとレイアウトシフトが発生してしまっていました。 参考: img要素のサイズ属性の記述の有無についてのTwitterのアンケート なんでいまさら? なぜなら、2019年の後半にブラウザにレイアウトシフトを回避するための新たな機能が実装されたか

      【2020年夏】imgタグにはwidthとheight属性を書くのがいいらしい
    • CSSのwidth: 100%;のより良い代替手段として、stretchキーワードが実はかなり便利です

      幅いっぱいの要素から左右のマージンを引きたいときに、こういうCSSを使用すると思います。width: calc(100% - 48px); 便利なCSSですが、マージンを計算する必要があり、デザインの変更があった際はCSSも変更する必要もあります。 そこでstretchキーワードを使用すると、便利です。要素はオーバーフローせずに使用可能なスペースいっぱいに表示され、マージンの計算も必要なくなります。 The stretch keyword: a better alternative to width: 100% in CSS? by Ollie Williams 下記は各ポイントを意訳したものです。 ※当ブログでの翻訳記事は、元サイト様にライセンスを得て翻訳しています。 はじめに width: 100%;が便利な例 width: stretch;の使い方 stretchのサポートブラウザ

        CSSのwidth: 100%;のより良い代替手段として、stretchキーワードが実はかなり便利です
      • imgタグのwidthとheightを省略したらダメ! 画像によるレイアウトシフトを回避する最近登場した2つの優れた解決方法

        レイアウトシフトとは、Webページがロードされる時に画像のスペースが確保されず、画像が表示された時にその分レイアウトがずれてしまうことです。 このレイアウトシフトを回避するために10年以上もの間、アスペクト比を手動で適用する必要がありました。しかし、現在ではそんな馬鹿げたハックは必要ありません。最近登場した2つの優れた解決方法を紹介します。 Avoiding <img> layout shifts by Jake Archibald (@jaffathecake) 下記は各ポイントを意訳したものです。 ※当ブログでの翻訳記事は、元サイト様にライセンスを得て翻訳しています。 レイアウトシフトとは aspect-ratioプロパティによるレイアウトシフトの回避方法 widthとheightによるレイアウトシフトの回避方法 どちらの方法を使用すべきか レイアウトシフトとは デフォルトでは、<im

          imgタグのwidthとheightを省略したらダメ! 画像によるレイアウトシフトを回避する最近登場した2つの優れた解決方法
        • CSSのinterpolate-sizeプロパティやcalc-size()関数を使用すると、width: auto;やheight: auto;へのアニメーションができるようになります

          CSSだけでwidth: auto;やheight: auto;にアニメーションできたらいいな、と思ったことはありませんか? たとえば、下記のようにテキストの量によってサイズが異なるボタンです。 これまではCSSでアニメーションするときは、固定値(width: 100px;しかアニメーションが機能しませんでしたが、Chrome 129でサポートされたinterpolate-sizeプロパティやcalc-size()関数を使用すると、簡単にwidth: auto;へのアニメーションが実装できます。 Animate to height: auto; in CSS by Bramus! 下記は各ポイントを意訳したものです。 ※元サイト様のライセンスに基づいて翻訳しています。基づいてというのは、貢献部分に関して同ライセンスも含みます。 はじめに autoなどのキーワードをアニメーションさせる方法

            CSSのinterpolate-sizeプロパティやcalc-size()関数を使用すると、width: auto;やheight: auto;へのアニメーションができるようになります
          • ホバーの分岐にはメディアクエリのwidthではなくhoverを使おう

            メディアクエリにはhoverプロパティがあり、ユーザーがホバーに対応しているデバイスかどうかの判定が行えます。 これを使用することによって、画面幅での分岐が必要なくなるためタブレットのlandscape含めた対応も容易になります。 また、メディアクエリはJavaScriptからもmatchMediaという関数を使う事で使用することが可能なのでCSSとJavaScriptでの利用例を載せていきたいと思います。 CSS CSSでの利用は簡単ですね .link { background: rgba(0, 0, 0, 1); } @media (hover: hover) { .link:hover { background: rgba(0, 0, 0, 0.7); } }

              ホバーの分岐にはメディアクエリのwidthではなくhoverを使おう
            • Get the screen width & height without JavaScript

              July 16, 2024 Get the screen width and height as pixel values using a few lines of CSS. Powered by @property & trigonometric functions Unitless values so you can easily use them inside any formula Updates on screen resize (No need for JavaScript) @property --_w { syntax: '<length>'; inherits: true; initial-value: 100vw; } @property --_h { syntax: '<length>'; inherits: true; initial-value: 100vh; }

              • Table内の3点リーダーってどういう仕組み?max-width: 0ってドユコト? - Qiita

                Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article? 3点リーダーとは 3点リーダー(省略記号)とは、テキストが長くてボックスの領域を超えてしまう場合に「...」でテキストを省略表示する手法です。 3点リーダーを実装するために必要な4つの設定 1、ボックスのwidthの指定 テキストが表示される領域の幅を指定します。 2、white-space: nowrap; テキストの改行を禁止し、1行で表示します。 3、overflow: hidden; テキストが表示される領域の幅を超えた場合、その超えた部分を隠します。 4、text-overflow: ellipsis; 非表示の溢れた部分を3

                  Table内の3点リーダーってどういう仕組み?max-width: 0ってドユコト? - Qiita
                • どう発音する? 「alt」や「width」「git」など、読みが分かりづらい用語のまとめ【やじうまWatch】

                    どう発音する? 「alt」や「width」「git」など、読みが分かりづらい用語のまとめ【やじうまWatch】
                  • -webkit-text-stroke-widthをアニメーションさせるとたのしい - hitode909の日記

                    歌川さんの記事で-webkit-text-strokeの存在を知らなかった。昔はこういうことをやろうとすると、同じ文字の要素をいくつか生成して、ちょっとずつ座標を変えて重ねる、ということをやっていて地道なことをしていた。良い時代になって嬉しい。 だんだんstrokeを伸ばしていったらおもしろいかと思って、最初CSSアニメーションでやってみたら、アニメーションにはならず、残念ながらなめらかなアニメーションにはならず、かくかく動いていたので、こうしてrequestAnimationFrameで動かしています。みなさんには読みづらくてご迷惑をおかけします。 const text = document.querySelector('#entry-26006613784505675'); const updateTextStroke = () => { text.style = '-webkit-t

                      -webkit-text-stroke-widthをアニメーションさせるとたのしい - hitode909の日記
                    • Avoiding <img> layout shifts: aspect-ratio vs width & height attributes

                      By default, an <img> takes up zero space until the browser loads enough of the image to know its dimensions: When you run the demo, you'll see the <figcaption> immediately. Then, after a few seconds, this paragraph and subsequent page content shifts downwards to make room for the image. This makes the user experience massively frustrating, as content moves out from under the user's eyes/finger/poi

                        Avoiding <img> layout shifts: aspect-ratio vs width & height attributes
                      • ボタンコンポーネントのpropにwidthはいらない

                        ファンタラクティブのエンジニアの 太田 です。 Buttonコンポーネントのwidthの考え方について書きます。 よくあるSize定義 Buttonコンポーネントのサイズの定義でこのような定義がされているのを時々目にします。 UIライブラリでも同じような定義が使われていた気がしますが、最近はあまり見かけなくなったように感じています。 この定義方法はやめた方がいいのではと思っています。 問題点 width、height、テキストのサイズなどが同一のpropで制御されている widthが固定サイズ width、height、テキストのサイズなどが同一のpropで制御されている 高さやテキストのサイズはsmがいいけど、widthだけ変えたい場合に対応できません 対応方法 widthをsizeから分離する widthが固定サイズ デバイスサイズによって見え方が違う どのデバイスで見たときもデバイス

                          ボタンコンポーネントのpropにwidthはいらない
                        • CSS でレイアウトを作る時に考えていること(margin/width/height) - asoview! Tech Blog

                          この記事は、アソビュー! Advent Calendar 2022 の 17日目(裏面)です。 みなさん、こんにちは。アソビュー!でフロントエンドエンジニアをしている白井です。 弊社ではバックエンドエンジニアの比率が多いこともあり、CSS 怖い!CSS わからない!という声をよく聞きます。 CSS と少しでも仲良くなるために、今回はレイアウトを作る際に基本となる幅(width)、高さ(height)、余白(margin)を指定する際に考えていることなどお話ししようと思います。 まずはじめに レイアウトを整える前に、不要な CSS プロパティは消しておく 普段作業していて CSS を書き換えていると不必要なスタイル定義は意外と残ってしまいがちです(よくやってしまいます…)。 色や形に関するプロパティは大体決まっているので重複したりすることは少ないですが、要素の位置は display、posi

                            CSS でレイアウトを作る時に考えていること(margin/width/height) - asoview! Tech Blog
                          • source要素にwidth/height属性を指定して各画像のアスペクト比の維持とCLSの改善を図る | フロントエンドBlog | ミツエーリンクス

                            2021年5月31日 source要素にwidth/height属性を指定して各画像のアスペクト比の維持とCLSの改善を図る UI開発者 橋本 Google Chrome 90からsource要素におけるwidth属性、height属性の指定がサポートされました。 これまでpicture要素で表示する画像のアスペクト比は、picture要素に含まれるimg要素に指定されたwidth属性、height属性から計算されていましたが、source要素に指定したwidth属性、height属性からもアスペクト比が計算されるようになります。 width属性とheight属性を付けることで解決できる問題 Core Web Vitalsの3つ指標のうちの1つにCumulative Layout Shift、略してCLSというレイアウトシフトがどれくらい発生したかをスコアにしたものがあります。 レイアウト

                              source要素にwidth/height属性を指定して各画像のアスペクト比の維持とCLSの改善を図る | フロントエンドBlog | ミツエーリンクス
                            • picture要素で使うsourceタグにもwidthとheight属性を書くといいらしい

                              突然ですが、picture要素を使ってアスペクト比が違う画像を読み込む場合でも、imgとsourceにwidthとheightを記述すれば、レイアウトシフトが起こらなくなるって知ってました? <picture> <source srcset="img/img-800x480px.jpg" media="(min-width: 820px)" width="800" height="480"> <img src="img/img-480x480px.jpg" width="480" height="480" alt="画像の説明"> </picture> 実は1年以上前に公開されたChrome 90からサポートされていたそうで(僕はつい先日知りました)、上のコードのようにimgとsourceの両方にwidthとheightを記述すれば、ブラウザがそれらの値を認識して画像ファイルを読み込む前か

                                picture要素で使うsourceタグにもwidthとheight属性を書くといいらしい
                              • Nerd fontとpowerlineとambiguous width - Qiita

                                Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article? はじめに こんにちは。まとまった休日を使ってターミナルの設定をいじるのが最近の趣味です。 そんなことをしていたらフォント周りで2日くらい溶けた。失われた時間への供養として調べたことのメモを置いておく。 簡単にこの記事をまとめると、 Nerd Fontsの一部であるPowerline Extra Symbolsがかっちょいいので和文フォントでも使ってみたい なんか表示がずれるのでフォントずれの原因であるUnicodeのambiguous widthについて調べてみた 自分の環境では色々試したけど結局上手くいかないので自分でフォントを作るか

                                  Nerd fontとpowerlineとambiguous width - Qiita
                                • The stretch keyword: a better alternative to width: 100% in CSS?

                                  The stretch keyword: a better alternative to width: 100% in CSS? Certain HTML elements, like a div or a p, will stretch to take up the full available width by default. If you give them a horizontal margin, it won’t cause a horizontal scrollbar. This is an incredibly useful default behaviour. Of course, many other elements aren’t full-width by default. Let’s look at a few instances where width: 100

                                    The stretch keyword: a better alternative to width: 100% in CSS?
                                  • Setting Height And Width On Images Is Important Again — Smashing Magazine

                                    Thanks to some recent changes in browsers, it’s now well worth setting width and height attributes on your images to prevent layout shifts and improve the experience of your site visitors. Barry Polland loves improvements that just work without any effort required of website owners. That is not to ignore the hard work required by the browser developers and standardization teams, of course, but it’

                                      Setting Height And Width On Images Is Important Again — Smashing Magazine
                                    • Optimizing Ruby’s Memory Layout: Variable Width Allocation - Shopify

                                      In this blog post, I’ll be introducing how Shopify is improving CRuby’s performance in Ruby 3.2 by optimizing the memory layout in the garbage collector through the Variable Width Allocation project. Ruby’s Memory Structure and Limitations Ruby is a garbage collected language. It automatically allocates memory when objects are created and releases the memory when it detects that an object is no lo

                                        Optimizing Ruby’s Memory Layout: Variable Width Allocation - Shopify
                                      • Fit-to-Width Text

                                        Fit-to-Width TextWhat if I will tell you how we could solve fit-to-width text with pure CSS without any hardcoded parameters? Curiously, scroll-driven animations will allow us to do just that! Join me as I continue exploring the experimental implementations of the latest specs. Update from 2024 I discovered a new technique that works in all latest versions of major browsers: “Fit-to-Width Text: A 

                                        • 「amp-ad」の「width」のエラーについて

                                          Google Search Consoleからエラーが通知されたのですが、AMP for WPプラグインのバグのようです。 タグ「amp-ad」のレイアウト「width」に含まれる属性の値が無効です AMP for WPというプラグインを使っているのですが、バージョン0.9.85.1でレスポンシブデザインの広告が扱えるようになりました。 そこで有効にしたのですが、Google Search Consoleから「タグ「amp-ad」のレイアウト「width」に含まれる属性の値が無効です」というエラーが通知されました。 生成されたAMPページのソースコードを見てみると、 <amp-ad class="amp-ad-3" type="adsense" width=100vw height=320 data-ad-client="XXXXX" data-ad-slot="XXXXX" data-a

                                            「amp-ad」の「width」のエラーについて
                                          • table-layout:fixed;を指定してもテーブルのwidthがうまく効かない場合の対処法 | TechMemo

                                            テーブル内のthやtdに対して、CSSで横幅を指定してもうまく効かない場合の対処法をご紹介いたします。 複雑なテーブルを実装する時なんかは役立つと思います。 よくある解決法 「table-layout:fixed;」 よく紹介されている対処法は、該当のテーブルに対して「table-layout:fixed;」を指定してあげる方法です。 例えば、thだけを横幅100pxにしたい場合は、以下のように指定します。

                                              table-layout:fixed;を指定してもテーブルのwidthがうまく効かない場合の対処法 | TechMemo
                                            • [Bug]: string-width dependency stops storybook from executing · Issue #22431 · storybookjs/storybook

                                              yarn install v1.22.19 [1/5] 🔍 Validating package.json... [2/5] 🔍 Resolving packages... [3/5] 🚚 Fetching packages... warning Pattern ["string-width@^1.0.2 || 2 || 3 || 4"] is trying to unpack in the same destination "/Users/phil/Library/Caches/Yarn/v6/npm-string-width-cjs-4.2.3-269c7117d27b05ad2e536830a8ec895ef9c6d010-integrity/node_modules/string-width-cjs" as pattern ["string-width@^4.2.3"]. T

                                                [Bug]: string-width dependency stops storybook from executing · Issue #22431 · storybookjs/storybook
                                              • Flex items and min-width:0 | Dominic McPhee – Front End Developer

                                                Earlier I wrote about using flexbox to build responsive layouts. There is a behavior that can be surprising when using flexbox for layout like this. The content of a flex item in the layout can force it to not shrink appropriately. Let’s say for example you have a long URL displayed somewhere in your layout that you want to truncate. Applying overflow: hidden will not result in the item shrinking

                                                • max-width - CSS: カスケーディングスタイルシート | MDN

                                                  CSS チュートリアル CSS の基本 CSS の第一歩 CSS の第一歩の概要 CSS とは何か CSS 入門 CSS の全体像 CSS の働き 評価課題: 経歴ページのスタイル設定 CSS の構成要素 CSS の構成要素の概要 CSS セレクター Type, class, and ID selectors Attribute selectors Pseudo-classes and pseudo-elements Combinators カスケードと継承 Cascade layers ボックスモデル 背景と境界 書字方向の操作 内容のはみ出し CSS の値と単位 CSS における大きさの指定 画像、メディア、フォームの要素 表のスタイル付け CSS のデバッグ CSS の整理 評価課題: CSS の基本的な理解度 評価課題: 素敵なレターヘッドの便箋の作成 評価課題: かっこいいボック

                                                    max-width - CSS: カスケーディングスタイルシート | MDN
                                                  • of road the this What's width | ならべかえ 英語 リスニング

                                                    単語をならべかえて英文を完成させよう(レベル6)「of road the this What's width」「この道の幅はどれくらいですか。」#英語学習 | ならべかえ 英語 リスニング

                                                      of road the this What's width | ならべかえ 英語 リスニング
                                                    • 動画操作ソフト ffmpeg のエラー "width not divisible by 2" への対処 - Qiita

                                                      Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?

                                                        動画操作ソフト ffmpeg のエラー "width not divisible by 2" への対処 - Qiita
                                                      • width の読み方について - Qiita

                                                        Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?

                                                          width の読み方について - Qiita
                                                        • JavaScript margin 含めた width / height を取得したい - かもメモ

                                                          要素マージンを含めた width / height を取得するのがちょいと大変だったのでメモ。 html { font-size: 16px; } .div { margin: 0.3rem 0.2rem; // 4.8px 3.2px 相当 border: .3rem solid #000; // 4.8px 相当 width: 6.2rem; // 99.2px 相当 height: 6.2rem; // 99.2px 相当 } margin を含んだ値で取得できる API は無いっぽい clientWith / clientHeight … border, margin を含まない Int 値 offsetWidth / offsetHeight … border は含み margin は含まない Int 値 getBoundingClientRect … border は含み ma

                                                            JavaScript margin 含めた width / height を取得したい - かもメモ
                                                          • Width - Tailwind CSS

                                                            <div class="flex ..."> <div class="w-1/2 ... ">w-1/2</div> <div class="w-1/2 ... ">w-1/2</div> </div> <div class="flex ..."> <div class="w-2/5 ...">w-2/5</div> <div class="w-3/5 ...">w-3/5</div> </div> <div class="flex ..."> <div class="w-1/3 ...">w-1/3</div> <div class="w-2/3 ...">w-2/3</div> </div> <div class="flex ..."> <div class="w-1/4 ...">w-1/4</div> <div class="w-3/4 ...">w-3/4</div> </div

                                                              Width - Tailwind CSS
                                                            • [CSS] width:100% と width:auto の違い - Qiita

                                                              はじめに 質問されたときにパッと答えられなかったので記事にまとめました! width: 100%とは? widthにpaddingとborderは含まれない widthの幅指定にpaddingとborderが含まれないため、HTMLの子要素にwidth:100%を指定したうえで、paddingとborderを指定してしまうと、親要素から子要素がはみ出て画面に表示される サンプルコード <div class='parent'> <div class='children'>children</div> </div> .parent { width: 400px; height: 200px; background-color: red; } .children { width: 100%; height: 150px; border: 10px solid blue; background-c

                                                                [CSS] width:100% と width:auto の違い - Qiita
                                                              • WordPressで画像にwidthとheightを追加する方法

                                                                記述例 <img src="xxx.png" width="300" height="250"> 対応ブラウザ width属性とheight属性は以下のブラウザでサポートされています。 IEEdgeFirefoxChromeSafari widthとheightを付けるメリット 画像にwidth属性とheight属性を付けるとどのような利点があるのか説明します。 レイアウトシフトを回避できる FirefoxやChromeなどのメジャーなブラウザでは、img要素にwidthとheight属性を指定することで、画像が読み込まれる前に画像のサイズを計算してレイアウトを確保します。 画像の遅延読み込みをしている場合、画像のサイズを指定しておかないと画像が読み込まれた後にレイアウトが動いてしまう可能性があります。 レイアウトが動いてしまうことでユーザーに不要なクリックを誘発したり、アンカーリンクのス

                                                                  WordPressで画像にwidthとheightを追加する方法
                                                                • imgタグにwidth/heightをnpm-scriptsで自動付与する

                                                                  概要 npm-scriptsでimgに自動でwidth/heightを付与する方法です。 Node.js上でDOM操作をするために、jsdomというモジュールを使います。 わりかし思いつきで書いたコードなので、考慮不足等々あったらご指摘ください(というか誰か最適化してくれ)。 前提 Mac環境のみ検証済み(Windowsは未検証です。適宜調整してください) ローカルにある画像が対象 参考リポジトリ 全体のコードは以下リポジトリに置いてあるので気になった方は参考にしてもらえると幸いです。 npm-scriptsの実装 大まかな流れ Node.jsでHTMLファイルを取得 jsdomを使用して、画像のパスを取得 image-sizeを使用して画像のサイズを取得 imgにwidth/heightを付与する width/heightが付与されたHTMLファイルを吐き出す 想定ディレクトリ 以下のデ

                                                                    imgタグにwidth/heightをnpm-scriptsで自動付与する
                                                                  1

                                                                  新着記事