I have a problem with the CSS rendering of my cards with the IOS application. I use media queries so that my cards adapt to different screens, whether or not displaying certain elements.
To do this, I use the visibility: collapse property. This works well with the Anki for Mac application, but does not give the desired rendering on iPhone. I apply this property to a table and according to W3C:
“This value removes a row or column. The space taken up by the row or column will be available for other content.”
and the CSS code:
.pasalecran {
visibility: collapse;
}
The problem is that in the iOS app, the value “collapse” is interpreted as the value “hidden”. This means that the content {{Verso1}} is not displayed BUT the space occupied by {{Verso1}} always takes up space.
Thank you very much (in advance) for your advice. Is this a known problem? I specify that I do not wish to use display: none; because the {{Verso1}} content would come out of the stream, which would cause other problems when changing the orientation of a smartphone for example.
Thank you for your reply. I understand the interesting technique, but here, {{Verso1}} is not empty and {{Verso2}} is not empty because I want to display {{Verso1}} or {{Verso2}} depending on the size of the screen.
So I don’t think I can use the example you give.
My code works very well with the Desktop application for Mac (I will test under windows) but not with AnkiMobile.
Thanks for your example. I will use it in my explanations I did not know the class. Mobile, but it’s interesting, but I don’t think my problem is there because I know how to manage different screens with media queries.
Click on Capture-3.png (I can just add 2 links and 1 image)
I don’t want to use the value “hidden” because it produces unwanted space.
This is why I use the value “collapse” applied to a row in an array and which allows me to free up the space used by the row whose property “visibility” has the value “collapse”.
Click on Capture-4.png
Here’s what I get, with the Mac app:
Click on Capture-5.png
and with AnkiMobile:
Click on Capture-6.jpeg
This is what is expected. However, I would like to remove a line from this table with AnkiMobile but that line remains visible with the Mac application.
So I changed the CSS code:
Click on Capture-7.png
I get this with the MAC app, this is what I want:
Click on Capture-8.png
But (bad surprise) with AnkiMobile:
Click on Capture-9.jpeg
My problem is that the CSS code “visibility: collapse;” is not interpreted correctly (I think) with AnkiMobile while it is interpreted correctly with the Mac application.
Thank you for your example and of course your time.
Curiously that page seems to indicate Chrome behaves the same way, so I’m surprised it works in the computer version. Perhaps you could accomplish the same thing by using flexbox or a grid instead?