Comments (3)
Hey,
You could use title and subTitle slots instead of props:
<Card {image} imageAlt="{name}'s pic" width="15.5em">
<span slot="title" class="text-warning">
{name}
</span>
<span slot="subTitle" class="text-danger">
{description}
</span>
Card Content
</Card>
Then either use color utilities classes or add a selector and use regular css.
from spaper.
Hey @Oli8 ,
That worked great! I had one other related question: How would I go about doing the same thing with the width of the card?
For context, I am trying to optimize the website for mobile, so I would like to ideally use a media query to change the width of the card at a given screen size. However, I was not sure how I could do that for the card component.
Also, I would like the image to automatically scale to the card's width while maintaining its aspect ratio.
Thank you for your help!
from spaper.
You should probably use papercss grid, we should soon have components for that matter in spaper but you can still use it via good old HTML.
<div class="row">
{#each ... }
<div class="col lg-3 md-6 sm-12">
<Card ... >...</Card>
</div>
{/each }
</div>
This will get you four cards on a row in "large" screens, two in "medium" screens and one in "small".
Regarding the image size, I don't have a good solution on the top of my head, maybe something with max-height/width or something more complex with javascript watching images dimension and resizing them.
from spaper.
Related Issues (16)
- Consider adding font dependency through npm to reduce font loading related flash of unstyled text HOT 1
- <Input /> does not work inside a <Tab> HOT 3
- Burnt toast HOT 6
- node-sass HOT 2
- Unexpected behaviour with dynamic tabs HOT 2
- Using native HTML progress element for <Progress> component HOT 2
- SvelteKit Updates HOT 6
- Hovering on a toast then leave the area closes the toast even if there's remaining time (when `pause on hover` is checked) HOT 2
- Form Component missing types HOT 2
- Label Warning with Vite in Svelte Kit HOT 1
- Cannot insert a CloseButton as Table content HOT 1
- Collapsible broken in Tab HOT 1
- Multiple toast at the same time throws error HOT 4
- Add components for Flexgrid HOT 2
- Documentation should state this needs to be added as devDependency
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spaper.