Entrance Chat Gallery Guilds Search Everyone Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining the forum??
September 03, 2025 - @637.53 (what is this?)
Activity rating: Three Stars Posts & Arts: 46/1k.beats Unread Topics | Unread Replies | My Stuff | Random Topic | Recent Posts Start New Topic  Submit Art
News: ozwomp is requesting your location  :ozwomp: [Agree] Super News: Upload a banner! (or else!)

+  MelonLand Forum
|-+  World Wild Web
| |-+  ✁ ∙ Web Crafting
| | |-+  ☔︎ ∙ I need Help!
| | | |-+  Images can tile and wrap to fit page width. Can other elements do that?


« previous next »
Pages: [1] Print
Author Topic: Images can tile and wrap to fit page width. Can other elements do that?  (Read 264 times)
IndigoGolem
Casual Poster ⚓︎
*


⛺︎ My Room

View Profile WWW

Joined 2025!
« on: August 19, 2025 @889.58 »

I'm making a trading card game kind of like Magic: The Gathering, and i have several web pages that should be filled with pictures of full cards, and text versions of the cards. This would be pretty easy if i just wanted images. <img> elements already do exactly what i want with how lines of them wrap to fit the screen, and if they're all the same size they'll tile into a nice grid.

However, i also want text versions of every card, for screen readers and people with slow internet connections. <details> might be a good way to do this, but those get put on their own lines instead of staying on the same line.

<nobr> seems like it would work until the edge of the screen, when people would start having to scroll sideways to see more cards.

I could put everything in a table but the whole point of this question is that i don't want a fixed number of cells per row.

Adding the text as alt text to the images and scrapping <details> would work, but not well unless there's a way to have formatting there. At least a line break.

In short, i need to make a bunch of <details> elements with images as the summaries display on the same line but still wrap at the end of the screen. How can i? I'm open to using CSS, i just prefer to avoid it where HTML works instead.
Logged

loren
Sr. Member ⚓︎
****


⚘ ⚘ ⚘ ⚘ ⚘

⛺︎ My Room
StatusCafe: ribose
iMood: ribose
Itch.io: My Games
RSS: RSS

View Profile WWWArt

See A Bug Summer 2025 ParticipantFirst 1000 Members!spring 2023!Learning to swim!Joined 2022!
« Reply #1 on: August 19, 2025 @908.34 »

a series of <img> elements will be placed on the same line because (by default) they are inline elements! <details> elements get placed on new lines because (by default) they are block elements! here's w3school's page on block and inline elements.

the defaults can be overridden with css! if you want, you could use
Code
details, summary {
  display: inline;
}
to make the details and summary elements display inline. they should still wrap at the end of the page.
Logged

IndigoGolem
Casual Poster ⚓︎
*


⛺︎ My Room

View Profile WWW

Joined 2025!
« Reply #2 on: August 21, 2025 @667.03 »

the defaults can be overridden with css!

That is exactly what i was looking for. Thanks very much.
Logged

Pages: [1] Print 
« previous next »
 

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | ~ Send Feedback ~ Forum Guide | Rules | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi