Skip to content

Make CSS responsive to improve mobile layout#64

Merged
smith558 merged 9 commits into
learnyouahaskell:mainfrom
Gabe-Mitnick:responsive-css
Apr 25, 2025
Merged

Make CSS responsive to improve mobile layout#64
smith558 merged 9 commits into
learnyouahaskell:mainfrom
Gabe-Mitnick:responsive-css

Conversation

@Gabe-Mitnick
Copy link
Copy Markdown
Contributor

Before

On narrow viewports (e.g. a phone or a narrow window on desktop) the layout would break and there would be lots of horizontal scrolling and text spilling off the edge of the background
scrot 3

After

Responsive CSS keeps the layout nice on narrow viewports.
scrot 4
I also added a lang="en" attribute to each html file because apparently that's good for accessibility, SEO, and hyphenation behavior.

Remaining issues

  • The home page — The layout is kind of a mess, so I just left it as-is — still looking really zoomed-out on mobile.
image
  • Code blocks — It's hard to display pre-formatted code blocks in a narrow viewport. Currently, the code blocks have two different behaviors.
    • Some code blocks have their text wrap when a line is too long to fit in the width of the code block. This can be confusing since it breaks indentation rules, and it's hard to distinguish automatic line wrapping from intentional stylistic line breaks.
    • Other code blocks don't let the text wrap, and instead allow the user to scroll horizontally to see all of the text. This can be confusing because it's hard to notice if a code block has more text for you to see if you scroll. For example, both of these text blocks need the user to scroll to see cut-off text. That's easy to see in the second block, but harder in the first.
    scrot 2

One potential fix is to add a gradient fade-out that indicates to the user that there's more content that they can't see without scrolling, like this:
image
But I couldn't figure out a way to implement that properly without modifying the html generator to add an extra wrapper div around each code block. Another solution is to have the entire black block scroll side to side, which would look like this, but proper implementation for this would also require an extra wrapper div.
image
Despite these problems, though, I think this PR is strictly an improvement on the existing CSS.

@Gabe-Mitnick
Copy link
Copy Markdown
Contributor Author

Hi @smith558 @memowe , could someone review this?

@Gabe-Mitnick
Copy link
Copy Markdown
Contributor Author

@memowe Are you able to review this?

@smith558
Copy link
Copy Markdown
Member

Hi @smith558 @memowe , could someone review this?

Hi! Will look at this tomorrow. Apologies. Please remind me if I do not!

@smith558 smith558 merged commit 7c5423a into learnyouahaskell:main Apr 25, 2025
@smith558
Copy link
Copy Markdown
Member

@Gabe-Mitnick I am not sure if the HTML generator is actually being used right now, we wanted to do something about it

@memowe
Copy link
Copy Markdown
Collaborator

memowe commented Apr 25, 2025

@memowe Are you able to review this?

I'll try to have a detailed look tomorrow. :)

ulysses4ever added a commit to ulysses4ever/learnyouahaskell.github.io that referenced this pull request Dec 8, 2025
ulysses4ever added a commit that referenced this pull request Dec 17, 2025
* Fix unmatched paragraph tags

* Capitalize Higher Order Functions title consistently

* Change apostrophes in text to curved closing quotes

* Write ellipsis as ... in markdown and as single character in html

* Write em dash as a single character in html

* Adjust HTML whitespace to make automatic replacement easier

* Replace single quotes with ' in code blocks

* Replace double quotes with " in code blocks

* Change double quotes in HTML text to curved double quote characters

* Change " to literal double quote in inline code in 1 location

* Replace raw characters with entities (e.g. <) in code blocks

* Align use of no-break space U+00A0 and   in markdown and HTML

* Change <a name...> anchors to id attributes on h2 tags

* Add id attributes to heading tags that do not have them

* Change order of attributes in img tags

* Delete px from img tag width and height attributes

* Replace newline with space in img alt attributes

* Change license link rel attribute from nofollow to license and adjust its position

* Post-process pandoc output to add chapters class to chapter list

* Change HTML chapter list to match markdown: remove enclosing paragraph and add type attribute

* Add upper margin to chapter list to restore the spacing from the removed <p> tag

* Change <b> and <em> tags to <strong> in HTML

* Change <i> tags to <em> in HTML

* Change hintbox tag from <p> to <div> in one location

* Put <p> tag around contents of hintboxes

* Change <span> tags to <code> and adjust CSS for inline code

* Do all remaining changes to replace existing HTML with markdown-generated HTML

* add github pages workflow

Signed-off-by: Artem Pelenitsyn <a.pelenitsyn@gmail.com>

* CI: make github pages workflow regenerate HTML from Markdown

Removed duplicate checkout action in deploy workflow.

* change em -> strong on index.html to preserve original formatting

* fix formatting of an error message

* Adjust alignment of snippet

* Adjust style to make sure that inline snippet are line breakable (line
wrap)

* remove generated files (including docs/*.html except index), clean up generate.sh, add .gitignore & Makefile

* clean up assets: remove dup CSS, move top-level sh-scripts under sh/Scripts

* responsive design for mobile (manually cherry-pick 7c5423a from #64)

---------

Signed-off-by: Artem Pelenitsyn <a.pelenitsyn@gmail.com>
Co-authored-by: Gregory Cox <gcox_gcox@proton.me>
Co-authored-by: Pier-Luc Caron St-Pierre <pierluc.caronstpierre@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants