Pallavi Sharma
Pallavi Sharma

Reputation: 655

why the image not take full width in %?

I am trying to make small page in html. I am able to do that. But it look good when plunker screen is small. Example: when you run the project it look fine. But when user run on full screen it look awkward.

here is image what I am trying to do
enter image description here http://plnkr.co/edit/Cz10CYGKBBkG0oT0eO6C?p=preview

here is my code http://plnkr.co/edit/Cz10CYGKBBkG0oT0eO6C?p=preview

Actually When user run on full screen I notice these thing ?

Upvotes: 1

Views: 2167

Answers (5)

Felix A J
Felix A J

Reputation: 6470

  • #slideTest - remove height: 100px;, add overflow: hidden;
  • .slider-slide - remove height: 100%;
  • .slider-slides - remove height: 100%;, add overflow: hidden;
  • .slider - add overflow: hidden;
  • List item

    .slider-slide img{ width: 100%; height: auto; }

-

.slider-slide{
  height: auto;
}
.slider-slides{
   height: auto;
   overflow: hidden;
}
.slider{
  overflow: hidden;
}
.slider-slide img{
 width: 100%;
 height: auto;
}

Upvotes: 0

Michael Christensen
Michael Christensen

Reputation: 195

Have you tried? :

ion-slide img {
    max-width: 100%;
    display: block;
    height: auto;
    width: 100%;
}

Upvotes: 0

Bram Vanroy
Bram Vanroy

Reputation: 28447

http://plnkr.co/edit/3fu32oUq47KSmli6TP2p?p=preview

Add these rules

.slider-slides img {
  width: 100%;
  height: auto;
}
.slider-pager {
    background: rgba(255,255,255,0.7);
}

The latter to make the controls visible.

Upvotes: 1

Frankey
Frankey

Reputation: 3757

You might want to add the following css to your code, though there is still a problem with the responsive height.

.slider-slide img {
  width:100%;
}

http://plnkr.co/edit/dUvIbYDxH27o81NKJ8dg?p=preview

Upvotes: 0

GolezTrol
GolezTrol

Reputation: 116110

The actual image you used is 202px wide, while the space you want to occupy if 210px wide. If you want the image to cover that area, you can make the image itself larger and it will do that automatically.

Also, you can specify width: 100% in CSS for the img tag. But as long as the image is smaller, it will be streched and that won't look as nice as having a proper sized source image.

So I think the best solution is to do both. Set the proper size through CSS and make the source image large enough to cover that area completely.

Upvotes: 0

Related Questions