Reputation: 3913
i want to make my div center and occupy 80% of the screen , on max window size it is working fine but when resize window then my image div become very small;
<body style="background-image:url('img/Mesh2.png');background-repeat:no-repeat; background-size: cover; width=:'100%'">
<h1>iSlider</h1>
<div id="myImageFlow" class="imageflow">
<div id="front">Initialy This is Front </div>
<!--
<img src="img/img1.png" id="id1" longdesc="img/img1.png" width="300" height="360" alt="img1" />
<img src="img/img2.png" id="id2" longdesc="img/img2.png" width="300" height="360" alt="img2" />
<img src="img/img3.png" id="id3" longdesc="img/img3.png" width="300" height="360" alt="img3" />
<img src="img/img4.png" id="id4" longdesc="img/img4.png" width="300" height="360" alt="img4" />
<img src="img/img5.png" id="id5" longdesc="img/img5.png" width="300" height="360" alt="img5" />
<img src="img/img6.png" id="id6" longdesc="img/img6.png" width="300" height="360" alt="img6" />
<img src="img/img7.png" id="id7" longdesc="img/img7.png" width="300" height="360" alt="img7" />
<img src="img/img8.png" id="id8" longdesc="img/img8.png" width="300" height="360" alt="img8" />
<img src="img/img9.png" id="id9" longdesc="img/img9.png" width="300" height="360" alt="img9" />
<img src="img/img10.png" id="id10" longdesc="img/img10.png" width="300" height="360" alt="img10" />
<img src="img/img11.png" id="id11" longdesc="img/img11.png" width="300" height="360" alt="img11" />
<img src="img/img12.png" id="id12" longdesc="img/img12.png" width="300" height="360" alt="img12" />
<img src="img/img13.png" id="id13" longdesc="img/img13.png" width="300" height="360" alt="img13" />
<img src="img/img14.png" id="id14" longdesc="img/img14.png" width="300" height="360" alt="img14" />
<img src="img/img15.png" id="id15" longdesc="img/img15.png" width="300" height="360" alt="img15" />
<img src="img/img16.png" id="id16" longdesc="img/img16.png" width="300" height="360" alt="img16" />
</div>
Upvotes: 1
Views: 4992
Reputation: 2679
Horrible code.
You shouldn't use inline style, and longdesc isn't supported.
Use CSS !
To center a div :
.class{
width: 80%;
margin: 0 auto;
display: block;
}
And if you need to use a custom attribute, use data-longdesc="" and not (NEVER) longdesc. And if your 80% div become too small on resize, that's because it's a percentage. Use min-width: 300px, per exemple.
Upvotes: 3