Forum Settings
Forums

CSS hacks: Set different coding for each individual resolution and for phones

New
Nov 27, 2012 1:32 PM
#1

Online
Feb 2010
12631
This expert-level topic is part of our CSS Tutorials and Add-ons section:
http://myanimelist.net/forum/?topicid=419405


This is for the most advanced users who make their own lists and adjust the resolution for all computer and mobile device screens.

When making an original design a lot of times I notice it looks different on all resolutions so I have to code it to suit all sizes, but with this hack it is no longer necessary. I can code for each resolution individually. This can be really useful on a lot of lists especially if you want to make it look the same on all screen sizes!

If you encounter bugs or issues I overlooked let me know here, please.



Here's the basic code- it just splits your body background color to different colors per resolution size. Try it on a blank layout to see. Play with the zoom options to see the color change on different sizes! You can put your own unique coding per part for your original designs, phew! I left the hack in bold so you wouldn't mix it with the CSS you can customize.


/* Base styles here for below 1000px */
body {background: green;}

/* Media query for devices above 1000px */
@media all and (min-device-width:1001px) {


body {background: red;}
}


/* Media query for devices above 1024px */
@media all and (min-device-width:1025px) {


body {background: black;}
}

/* Media query for devices above 1140px */
@media all and (min-device-width:1141px) {


body {background: teal;}
}

/* Media query for devices above 1280px */
@media all and (min-device-width:1281px) {


body {background: blue;}
}

/* Media query for devices above 1366px */
@media all and (min-device-width:1367px) {


body {background: orange;}
}

/* Media query for devices above 1440px */
@media all and (min-device-width:1441px) {


body {background: purple;}
}

/* Media query for devices above 1600px */
@media all and (min-device-width:1601px) {


body {background: brown;}
}

/* Media query for devices above 1680px */
@media all and (min-device-width:1681px) {


body {background: silver;}
}

/* Media query for devices above 1920px */
@media all and (min-device-width:1921px) {


body {background: gold;}
}





Importing different layouts/CSS for different resolutions
You need to know how to already import. Put the link for layout 1 where "layout 1 here" is. Put the link for layout 2 where "layout 2 here" is. Layout 1 will show up on resolutions between 0 and 1499px wide. Layout 2 will show up on screens between 1500px and 2200px wide. You can alter the sizes or add more imports.

@import url(layout 1 here) screen and (min-width: 0px) and (max-width: 1499px);
@import url(layout 2 here) screen and (min-width: 1500px) and (max-width: 2200px);





Targeting phones
Check Screenfly.com for views from many devices and their resolutions. However keep in mind its not 100% completely accurate to what the devices see.
Shishio-kunOct 8, 2015 2:42 PM
Reply Disabled for Non-Club Members
Reply Disabled for Non-Club Members

More topics from this board

» theme help

threat - Jul 5

5 by Zaryf »»
Aug 21, 5:46 AM

» [CSS - Modern] 🍰 Clarity by V.L ( 1 2 3 4 5 ... Last Page )

Valerio_Lyndon - Apr 19, 2018

1261 by KiranaStarr »»
Aug 16, 5:48 PM

» [CSS] ⭐️ Customize your List Cursor + Cursor Fixes

Shishio-kun - Mar 8, 2021

30 by Shishio-kun »»
Jul 28, 3:17 AM

» How To Have Different Banner/Cover image & Background Image For Manga & Anime Lists

YasminaRegina - Jul 25

2 by YasminaRegina »»
Jul 26, 1:02 AM

Sticky: » 💚 [REPAIR STICKY] Repair/speed up layouts + Request layout fixes ( 1 2 )

Shishio-kun - Nov 17, 2023

52 by LucaBalsa »»
Jul 6, 2:02 PM
It’s time to ditch the text file.
Keep track of your anime easily by creating your own list.
Sign Up Login