Mobile site

by levans, Sep 24, 2019, 4:15 AM

So, I just used the mobile version of the site for the first time. I must say, my blog looks terrible.

Comment

5 Comments

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
BugMaster recently fixed the code so its blog looks good on mobile. I recommend you check that post out :D

by Radio2, Sep 24, 2019, 4:47 AM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Hi levans,

The pleasure is all mine.

Since we're limited to what we can do with blog CSS, my solution isn't perfect, but it's good enough.

I'll let you in on one secret: At narrow screen widths the sidebar content isn't really hidden. But it's lower on the page than all of the posts. With infinite scroll, it keeps moving further and further down. You'd end up seeing it again if you scroll all the way to the last post in the blog.

The next part of the CSS relies on ensuring that #main has a background color of white and that it is above the gray background of whatever the surrounding div is -- I forget if that's #content or #wrapper or something else. But #main needs to be able to cover it up at all widths.

Finally -- and this is the important part -- I used calc to change the width of #main dynamically since we can't use media queries.

Putting it all together, I have:
#main {
  min-width: calc(100% - 260px);
  width: calc((786px - 100%) * 1000);
  max-width: 100%;
  background-color: white;
  border: none;
  z-index: 5;
}

I tried using calc to give the sidebar content a width of 0 when the screen is narrow, but it wouldn't go away entirely. It could be that this content is getting a non-zero min-width further down the cascade? I dunno. But at that point I had decided that things were good enough for now and that I can try again in the future.

by BugMaster, Sep 24, 2019, 1:42 PM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
I wound up doing this:

@media (max-width: 767px) {
  #content {
    background-color: white;
  }
  #main {
    width: calc(100% - 40px);
    margin: auto 20px;
  }
  #side {
    display: none;
  }
}

by levans, Sep 24, 2019, 5:09 PM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Oh, cool.

I couldn't get media queries to work, so I assumed that they did not work. Looks like that was an error on my part!

Next step: steal levans's CSS to improve the BugMaster Blog!

by BugMaster, Sep 24, 2019, 5:33 PM

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Actually it's not a boring blog Levans...

by vsar0406, Sep 26, 2019, 1:36 AM

Opinions expressed herein are my own and not necessarily those of AoPS Incorporated.

avatar

levans
Archives
- January 2025
+ September 2023
+ September 2022
+ August 2020
+ November 2019
+ March 2019
+ January 2019
+ December 2018
+ September 2016
+ August 2015
+ July 2015
+ April 2015
+ February 2015
+ October 2014
+ August 2014
+ March 2014
+ February 2014
+ October 2013
+ September 2013
+ August 2013
CoC
+ June 2013
+ April 2013
+ February 2013
+ November 2012
+ September 2012
+ August 2012
+ April 2012
+ February 2012
+ January 2012
+ November 2011
Shouts
Submit
  • beautiful css omg

    by yaxuan, Feb 10, 2025, 5:31 AM

  • hello I just saw this

    the CSS here is pro
    $\text{also what is this font}$

    by Yrock, Feb 4, 2025, 2:36 AM

  • hiii it's been a long time

    300th shout!! :D

    by evt917, Dec 20, 2024, 5:15 PM

  • @LostInBali, it's totally based on terminals.

    by levans, May 22, 2024, 12:09 AM

  • HIIII! This is beautiful CSS and it reminds me of bash!!!!!!!
    (I do hope you like terminals)

    by LostInBali, May 1, 2024, 8:41 AM

  • COOOOL BLOG!!

    by Yummo, Feb 4, 2024, 7:09 PM

  • geez 100k+ views

    by ujulee, Dec 5, 2023, 5:47 PM

  • HOW SO ORZ WHAT THE HECK

    by madeleinelee, Dec 5, 2023, 6:03 AM

  • hi $          $

    by Bob_Smart, Nov 4, 2023, 4:38 AM

  • I like this blog so much it's so impressive!

    by BabaLama, May 2, 2023, 1:26 AM

  • bump$    $

    by TethysTide, Nov 16, 2022, 4:18 PM

  • pls don't click my username thanks :)

    by RyanWang, Sep 28, 2022, 4:26 AM

  • aops* $     $

    by programmeruser, Sep 27, 2022, 9:51 PM

  • Hello!$    $

    by Peregrine11, Aug 29, 2022, 9:02 PM

  • this is the best blog on aopa

    by programmeruser, Jun 16, 2022, 12:10 AM

302 shouts
About Owner
  • Posts: 5190
  • Joined: Apr 27, 2007
Blog Stats
  • Blog created: Jul 27, 2011
  • Total entries: 105
  • Total visits: 107928
  • Total comments: 616
Search Blog
a