【簡単】パソコンとスマホでCSSを切り替える方法【初心者向け】

プログラミング
Image by herry wibisono from Pixabay

シュテル(@sterchannel2020)です!

CSSファイルってパソコン表示の分だけでもめっちゃ長くなりますね。スマホ版を書いていくのは別ファイルにしたほうがいいのかな?

会社でちょうどサイト改修の案件があるので、1番簡単に切り替える方法を覚えていくとします👍

画面幅に合わせて2つのCSSファイルを切り替える方法

PHPを使った方法などもあるようですが、初心者にはこの方法がもっともシンプルでしたので、ひとまずこれを覚えておきます。

デバイス多種でメディアクエリの設定は混迷?

今現在、さまざまな画面サイズのデバイスが出回っており、それぞれに縦表示と横表示があります…。

正直全てに対応しきるのは至難の業。

制作はPC場面でおこなっているので確認作業だけでもかなり手間取ります。

スマホ縦表示ファーストで設計する

言うまでもなくGoogleはモバイルファーストを宣言しています。(そしてこれはスマホファーストという意味)

そのため、設計の基本指針としては、

約6~7割のユーザーがスマホの縦表示で見ているという前提で、

「スマホ表示」

「PC&タブレット表示」

の2つのCSS設定を設けるのがシンプルでベターな策だと思います。

実際の改修過程も追記します。

これで改修案件を進めていき、また過程をお知らせしますね。

ではまた。

コメント

  1. EvaleenelOi より:

    writing chapter 4 of dissertation
    [url=”https://dissertations-writing.org”]dissertation writing service new york[/url]
    free dissertation help

  2. Just simply needed to mention I’m just glad I came on your website!

    https://jobland24.com/author/deerdrebwarad/

  3. MaggeeelOi より:

    phd dissertation writing services
    [url=”https://dissertationwriting-service.com”]dissertation help service proposal[/url]
    writing dissertation tips

  4. RegineelOi より:

    dissertation awards
    [url=”https://helpon-doctoral-dissertations.net”]buy a dissertation online help[/url]
    doctoral dissertation help history

  5. KirstielOi より:

    help with masters dissertation
    [url=”https://help-with-dissertations.com”]free dissertation help[/url]
    how to cite a dissertation chicago

  6. tinyurl.com より:

    hey there and thank you for your info – I have
    certainly picked up anything new from right here. I did
    however expertise a few technical issues using this
    website, since I experienced to reload the website lots of times previous to I could get it to load correctly.

    I had been wondering if your hosting is OK? Not that I’m
    complaining, but slow loading instances times will sometimes affect your placement in google and could damage your high-quality score if advertising and marketing with Adwords.
    Anyway I’m adding this RSS to my e-mail and can look out for a lot more
    of your respective intriguing content. Ensure that you update this again very soon.

  7. KirstielOi より:

    dissertation help online free
    [url=”https://help-with-dissertations.com”]dissertation writing uk[/url]
    best dissertation writing help chicago

  8. CharlaelOi より:

    cheap dissertation help in atlanta
    [url=”https://mydissertationwritinghelp.com”]online nursing dissertation help[/url]
    phd dissertation writing help

  9. It’s an remarkable article designed for all the online users; they will take
    advantage from it I am sure.

  10. KH より:

    You’re so interesting! I do not suppose I’ve truly read something like that
    before. So good to find somebody with original thoughts
    on this issue. Really.. thanks for starting this up. This site is one thing
    that’s needed on the web, someone with a
    bit of originality!

  11. It’s an remarkable piece of writing in favor of all the web people; they will obtain advantage from
    it I am sure.

  12. Great article. I’m going through many of these issues as well..

  13. tinyurl.com より:

    Yes! Finally something about a.

  14. tinyurl.com より:

    Have you ever considered writing an e-book or guest authoring on other blogs?
    I have a blog based on the same information you discuss and would really like to have you share some stories/information. I know my subscribers would
    enjoy your work. If you are even remotely interested, feel free to shoot me an email.

  15. tinyurl.com より:

    Right now it looks like Movable Type is the best blogging platform
    available right now. (from what I’ve read) Is that what you are using on your blog?

  16. KatineelOi より:

    slot 777
    [url=”https://2-free-slots.com”]all free 777 slots games[/url]
    slots for free

  17. I’m very pleased to find this web site. I wanted to thank you for your time due to this
    fantastic read!! I definitely loved every little bit of it and i also
    have you book marked to check out new things in your site.

  18. AurlieelOi より:

    slots farm
    [url=”https://411slotmachine.com”]scatter slots download[/url]
    777 nudist

  19. AddieelOi より:

    slots free
    [url=”https://beat-slot-machines.com”]video slots free[/url]
    igt slots free

  20. PerrineelOi より:

    play with my pussy
    [url=”https://candylandslotmachine.com”]casino slots with bonus realmoneyonlyhr[/url]
    free slots vegas world games

  21. CyndiaelOi より:

    old vegas slots on facebook
    [url=”https://download-slot-machines.com”]double diamond free slots[/url]
    allwin casino

  22. CyndiaelOi より:

    murka slots girls
    [url=”https://download-slot-machines.com”]igt slot machine games for ipad realmoneyonlyhr[/url]
    best time to play slots

  23. CyndiaelOi より:

    slotomania free slots no download
    [url=”https://download-slot-machines.com”]pit people more slots[/url]
    all free casino slots

  24. PaolinaelOi より:

    house of fun slots
    [url=”https://freeonlneslotmachine.com”]all wins casino[/url]
    gsn casino slots free

  25. TwylaelOi より:

    online slot machines
    [url=”https://giocoslotmachinegratis.com”]hollywood fun slots[/url]
    video poker free slots

  26. ShalnaelOi より:

    play slots for free online no downloads
    [url=”https://pennyslotmachines.org”]casino jackpots[/url]
    free slots for fun

  27. AdrianaelOi より:

    machines Г  sous casino gratuit big bonus slots
    [url=”https://slotmachinegambler.com”]free vegas penny slots[/url]
    guide casinos

  28. NeddaelOi より:

    free video poker slots
    [url=”https://slotmachinegameinfo.com”]slots era[/url]
    pit people more slots

  29. IngunnaelOi より:

    cash river casino slots free
    [url=”https://slotmachineonlinegratis.org”]vegas online slots[/url]
    slot machines free games

  30. 1mechanism より:

    2fundamentals

  31. JannelleelOi より:

    slots online real money
    [url=”https://slotmachinescafe.com”]jackpotjoy[/url]
    free slot machine games no dow loading

  32. EadieelOi より:

    deal or no deal slots cheats
    [url=”https://slotmachinescasinos.com”]card game slots[/url]
    play free lucky 777 slots

  33. RaneeelOi より:

    online svenska casino slots
    [url=”https://slotmachinesforum.net”]free atari slots[/url]
    all wins casino

  34. DennaelOi より:

    free slots on
    [url=”https://slotmachinesworld.com”]heart of vegas real casino slots free on facebook[/url]
    super lucky casino slots

  35. KareeelOi より:

    play slots online
    [url=”https://www-slotmachines.com”]house of fun free online slots[/url]
    konami slots

  36. writing a master’s dissertation https://professionaldissertationwriting.com/

  37. phd without dissertation https://dissertationwritingcenter.com/

  38. doctoral dissertation help reference https://dissertationhelpexpert.com/

  39. online edd no dissertation https://accountingdissertationhelp.com/

  40. writing doctoral dissertation https://examplesofdissertation.com/

  41. dissertation writing tips https://writing-a-dissertation.net/

タイトルとURLをコピーしました