Maria.A
Maria.A

Reputation: 43

My images do not change size

How do I change the size of my pictures? I want them all in the same size, what am I doing wrong?

HTML:

<img src="tennis.jpg" class="aktiviteter">
<img src="venner.jpg" class="aktiviteter">
<img src="shopping.jpg" class="aktiviteter">

CSS:

.aktiviteter {
    width="450px" 
    height="300px"
}

Upvotes: 0

Views: 94

Answers (3)

Luke Shinn
Luke Shinn

Reputation: 346

Alternative

Sometimes I like to make images part of the background. I've found they respond better on different screens.

HTML

<div class="container"><img src="tennis.jpg" class="aktiviteter"></div>
<div class="container"><img src="venner.jpg" class="aktiviteter"></div>
<div class="container"><img src="shopping.jpg" class="aktiviteter"></div>

CSS

.container:nth-child(1) {
height:300px;
width: 450px
background: url('../tennis.jpg') no-repeat center;
}


Original

Replace your = with :

.aktiviteter {
    width: 450px; 
    height: 300px;
}

Upvotes: 0

SuperDJ
SuperDJ

Reputation: 7661

Have a look at some documentation it would have prevented you from asking a question like this.

.aktiviteter {
    width:450px; 
    height:300px;
}
<img src="https://cdn.pixabay.com/photo/2016/05/09/11/09/tennis-1381230_960_720.jpg" class="aktiviteter">
<img src="https://cdn.pixabay.com/photo/2017/07/31/20/36/dark-2560832_960_720.jpg" class="aktiviteter">
<img src="https://cdn.pixabay.com/photo/2015/10/12/15/18/store-984393_960_720.jpg" class="aktiviteter">

Upvotes: 0

Ecordero
Ecordero

Reputation: 61

You dont use "=" in css, and you dont need quotes. Also try ending the statement with semi colons

.aktiviteter {
    width: 450px; 
    height: 300px;
}

Upvotes: 2

Related Questions