Kevin Ling
Kevin Ling

Reputation: 550

Reactstrap Media object how to change the image size

I am using the Reactstrap Media object to add in image into the website but having difficulties changing the image size. May I ask how I can change the image size in the Media object?

<Media object src={themes.image} alt={themes.name} />

Upvotes: 3

Views: 5080

Answers (2)

Rohith Murali
Rohith Murali

Reputation: 5669

The list of props for Media has className so you can give a class in your css file like,

.my_image{
 height:100px;
 width:100px;
}

and use the Media as,

<Media object src={themes.image} alt={themes.name} className='my_image' />

Upvotes: 1

Hemadri Dasari
Hemadri Dasari

Reputation: 33974

You can change image size like below.

const imgStyle = {
  maxHeight: 128,
  maxWidth: 128
}

<Media object src={themes.image} style={imgStyle} alt={themes.name} />

Note: React by default adds px to the numbers if we don't specify explicitly. Here 128 is 128px

Upvotes: 3

Related Questions