So i have like that:
http://imgur.com/a/IfHym
Position i did with
position:absolute
and thats what i got
Tried to change but than all images crashing
In html i did like this :
<div class="gallery">
<article class = 'container1'>
<figure class = 'cool'>
<a href="http://www.eminem.com/" class="phorosRef">
<img src="Photos/ Infinite_(1996),_by_Eminem.png"alt="" width="300px" height="300px" class="photos"></a>
</figure>
<figure class="cool">
<a href="http://www.eminem.com/" class="phorosRef">
<img src="Photos/Eminem_-_The_Slim_Shady_LP_CD_cover.jpg" width="300px" height="300px" alt="" class="photos"></a>
</figure>
<figure class="cool">
<a href="http://www.eminem.com/" class="phorosRef">
<img src="Photos/eminem-marshall-mathers.jpg" height="300px" width="300px" alt="" class="photos"></a>
</figure>
<figure class = 'cool'>
<a href="http://www.eminem.com/" class="phorosRef">
<img src="Photos/ Eminem_-_the_eminem_show.jpg" alt="" width="300px" height="300px" class="photos"></a>
</figure>
<article class = 'container2'></article>
<figure class="cool2">
<a href="http://www.eminem.com/" class="phorosRef">
<img src="Photos/скачанные файлы.jpeg" width="300px" height="300px" alt="" class="photos"></a>
</figure>
<figure class="cool2">
<a href="http://www.eminem.com/" class="phorosRef">
<img src="Photos/20090506133342!Relapse_cover.jpg" width="300px" height="300px" alt="" class="photos"></a>
</figure><br/>
<figure class="cool2">
<a href="http://www.eminem.com/" class="phorosRef">
<img src="Photos/71HH7D7Z66L._SL1500_.jpg" width="300px" height="300px" alt="" class="photos"></a>
</figure><br/>
<figure class = 'cool2'>
<a href="http://www.eminem.com/" class="phorosRef">
<img src="Photos/The_Marshall_Mathers_LP_2.png" alt="" class="photos"></a>
</figure>
</article>
</div>
May you give me some advices about it?
Also i can show my css code
See you
Elements with position: absolute will not collide with other elements, meaning that they will just stack on top of each other. I'm guessing the second image in your link is what you want to achieve. In that case I suggest two sections, filled with images.
<div class="section left">
<img/>...
</div>
<div class="section right">
<img/>...
</div>
Then apply `position: absolute' to those sections, and give them a width.
.section {
position: absolute;
width: 250px;
top: 0px;
}
.section.left {
left: 0px;
}
.section.right{
right: 0px;
}
This will create two columns on your page, fill them with images and stick them to the left and right side respectively.
Related
How to make images from image gallery appear same size? (if originally they have different dimensions).
jsfiddle.net
Add a description of the image here
<div class="img">
<a target="_blank" href="https://unsplash.it/g/300/400">
<img src="https://unsplash.it/g/200/300" alt="Forest" width="600" height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="https://unsplash.it/g/400/400">
<img src="https://unsplash.it/g/400/400" alt="Northern Lights" width="600"height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="https://unsplash.it/g/400/400">
<img src="https://unsplash.it/g/400/400" alt="Northern Lights" width="600" height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="https://unsplash.it/g/400/400">
<img src="https://unsplash.it/g/400/400" alt="Northern Lights" width="600" height="400">
</a>
<div class="desc">Add a description of the image here</div>
Update Css Add img Class In Css. And Remove height :auto in div.img img Class
Note: You Can Change Hight & width in Css
img
{
width:300px;
height:200px;
}
div.img img
{
width: 100%;
}
See Live Demo Here
Snippet Example Below
div.img {
margin: 5px;
border: 1px solid #ccc;
float: left;
width: 180px;
}
div.img:hover {
border: 1px solid #777;
}
div.img img {
width: 100%;
}
div.desc {
padding: 15px;
text-align: center;
}
img
{
width:300px;
height:200px;
}
<!DOCTYPE html>
<body>
<div class="img">
<a target="_blank" href="https://unsplash.it/200/300/?random">
<img src="https://unsplash.it/200/300/?random" alt="Trolltunga Norway" >
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="https://unsplash.it/g/300/400">
<img src="https://unsplash.it/g/200/300" alt="Forest" >
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="https://unsplash.it/g/400/400">
<img src="https://unsplash.it/g/400/400" alt="Northern Lights" >
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="https://unsplash.it/g/400/400">
<img src="https://unsplash.it/g/400/400" alt="Northern Lights" >
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="https://unsplash.it/g/400/400">
<img src="https://unsplash.it/g/400/400" alt="Northern Lights" >
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="https://unsplash.it/g/400/400">
<img src="https://unsplash.it/g/400/400" alt="Northern Lights" >
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="https://unsplash.it/g/400/400">
<img src="https://unsplash.it/g/400/400" alt="Northern Lights" >
</a>
<div class="desc">Add a description of the image here</div>
</div>
That depends on how you want to adjust the ones that aren't the same size. In other words, if you have a 300x200 image and a 300x300 image, you could:
stretch the 300x200 one out to 300x300, which would make it look distorted
scale the 300x200 one up so it's large enough to fill a 300x300 box, then crop out or hide the excess
keep the 300x200 one at its normal size but put it in a 300x300 box with some whitespace above and below it
crop the top and bottom of the 300x300 one so it's also 300x200
These are all options you have and they'd all be implemented a little differently, so first figure out which way you want to go.
I have this code, I heard that hspace will be not in use anymore. How can I add space between them on above and between 10px would be good, I tried with margin-top did not worked and broke my other widgets as well.
Here is an example:
Here the code does not have space between them on vertical
This is the wide view here it looks better, once resized into smaller screens I get the above result
I would like to have 10px beween them and when resized on top too.
I want them all in once code, since this is a widget I want it with built in CSS.
<div align="center">
<a href="https://facebook.com/testclue">
<img src="http://uhl.hosting/wp-content/uploads/2016/02/Facebook.png" align="middle" alt="TestClue on Facebook" height="60" width="60" hspace="10">
</a>
<a href="https://twitter.com/testclue">
<img src="http://uhl.hosting/wp-content/uploads/2016/02/Twitter.png" align="middle" alt="TestClue on Twitter" height="60" width="60" hspace="10">
</a>
<a href="https://www.linkedin.com/company/testclue">
<img src="http://uhl.hosting/wp-content/uploads/2016/02/in.png" align="middle" alt="TestClue on LinkedIN" height="60" width="60" hspace="10">
</a>
<a href="https://plus.google.com/+Testclue">
<img src="http://uhl.hosting/wp-content/uploads/2016/02/G.png" align="middle" alt="TestClue on Google+" height="60" width="60" hspace="10">
</a>
</div>
I would recommend to remove all the inline code that you have on your tags, as some of them got deprecated or are not as useful as the CSS.
I would suggest you to do something like this.
For the HTML:
<div id="social-networks-container">
<div class="social-network">
<a href="https://facebook.com/testclue">
<img src="http://uhl.hosting/wp-content/uploads/2016/02/Facebook.png" />
</a>
</div>
<div class="social-network">
<a href="https://twitter.com/testclue">
<img src="http://uhl.hosting/wp-content/uploads/2016/02/Twitter.png" />
</a>
</div>
<div class="social-network">
<a href="https://www.linkedin.com/company/testclue">
<img src="http://uhl.hosting/wp-content/uploads/2016/02/in.png" />
</a>
</div>
<div class="social-network">
<a href="https://plus.google.com/+Testclue">
<img src="http://uhl.hosting/wp-content/uploads/2016/02/G.png" />
</a>
</div>
</div>
And for the CSS:
#social-networks-container .social-network {
display: inline-block;
margin: 10px;
}
#social-networks-container .social-network a {
display: block;
}
An example of this working: https://jsfiddle.net/vfvhqvzf/1/
UPDATE:
If you just want to use inline code on your html you could also try this:
<div style="display:inline-flex;">
<a href="https://facebook.com/testclue" style="display: block;padding: 10px;">
<img src="http://uhl.hosting/wp-content/uploads/2016/02/Facebook.png" />
</a>
<a href="https://twitter.com/testclue" style="display: block;padding: 10px;">
<img src="http://uhl.hosting/wp-content/uploads/2016/02/Twitter.png" />
</a>
<a href="https://www.linkedin.com/company/testclue" style="display: block;padding: 10px;">
<img src="http://uhl.hosting/wp-content/uploads/2016/02/in.png" />
</a>
<a href="https://plus.google.com/+Testclue" style="display: block;padding: 10px;">
<img src="http://uhl.hosting/wp-content/uploads/2016/02/G.png" />
</a>
</div>
Demo: https://jsfiddle.net/vfvhqvzf/4/
Maybe you can try this:
padding: 10px;
Add:
style="padding-top:10px;"
to each 'a' (anchor) element
<div id="divT">
<img class="divTimg" src="divT/00.jpg" alt="img">
<img class="divTimg" src="divT/01.jpg" alt="img">
<img class="divTimg" src="divT/02.jpg" alt="img">
<img class="divTimg" src="divT/03.jpg" alt="img">
<img class="divTimg" src="divT/04.jpg" alt="img">
<img class="divTimg" src="divT/05.jpg" alt="img">
<div class="clear"></div>
</div>
css
#divT{
overflow-x:hidden;
}
.divTimg{
float:left;
width:17%;
cursor:pointer;
border-right:2px ridge gold;
}
05.jpg is placed in a new line, bellow the rest of images, but I need to keep them all in one line, and if there is no space enough - the last image should be visible partly.
I tried with various values of overflow-x for the parrent div, but without success.
To achieve the 'scrolling off to the side effect' you need to create a wrapper element, that contains a much wider element that then contains your images. This then allows you to shrink or grow the visible section, while having the hidden content appear scrollable.
<div class="scroll">
<div class="scroll_wrapper">
<img class="scroll_image" src="" />
<img class="scroll_image" src="" />
<img class="scroll_image" src="" />
<img class="scroll_image" src="" />
<img class="scroll_image" src="" />
<img class="scroll_image" src="" />
<img class="scroll_image" src="" />
<img class="scroll_image" src="" />
<img class="scroll_image" src="" />
// images
</div>
</div>
And then the CSS
.scroll {
width: 200px; // how much you want to see at once
overflow: auto;
}
.scroll_wrapper {
width: 600px; // this can be any number higher than the total width of the elements inside it
}
.scroll_image {
background: red;
height: 10px;
width: 50px; // just to test the scrolling
}
The jsfiddle for this can be found here
Just wrap your image list with another wrapper:
<div id="wrapper">
<div id="divT">
<img class="divTimg" src="divT/00.jpg" alt="img">
<img class="divTimg" src="divT/01.jpg" alt="img">
<img class="divTimg" src="divT/02.jpg" alt="img">
<img class="divTimg" src="divT/03.jpg" alt="img">
<img class="divTimg" src="divT/04.jpg" alt="img">
<img class="divTimg" src="divT/05.jpg" alt="omg">
<div class="clear"></div>
</div>
</div>
Add some styles:
#wrapper {
overflow:hidden;
}
#divT {
width:105%;
}
I'm trying to select every 4th image in my div gallery. I can't seem to figure out why I can't select it.
#gallery img:nth-of-type(4n){
border: 5px solid #000;
}
I've tried a few other ideas but to no success. Can anyone help me and explain to me why this isn't selecting every 4th image in my div gallery? Thanks in advance.
<div id="gallery">
<a href="/system/images/series_uploads/5/original/ankara_5602p_alabaster.jpg?1330114093" rel="lightbox['gallery']">
<img alt="" src="/system/images/series_uploads/5/gallery/ankara_5602p_alabaster.jpg?1330114093" title="Ankara" />
<div class="gallery-text">
<h3>Ankara</h3>
<p>Porcelain</p>
</div>
</a>
<a href="/system/images/series_uploads/6/original/ankara_5624p_noce.jpg?1330114095" rel="lightbox['gallery']">
<img alt="" src="/system/images/series_uploads/6/gallery/ankara_5624p_noce.jpg?1330114095" title="Ankara" />
<div class="gallery-text">
<h3>Ankara</h3>
<p>Porcelain</p>
</div>
</a>
<a href="/system/images/series_uploads/7/original/ashton_23931_smokey_beige_.jpg?1330114250" rel="lightbox['gallery']">
<img alt="" src="/system/images/series_uploads/7/gallery/ashton_23931_smokey_beige_.jpg?1330114250" title="Ashton" />
<div class="gallery-text">
<h3>Ashton</h3>
<p>Porcelain</p>
</div>
</a>
<a href="/system/images/series_uploads/8/original/ashton_23942_camel_haze_entry.jpg?1330114251" rel="lightbox['gallery']">
<img alt="" src="/system/images/series_uploads/8/gallery/ashton_23942_camel_haze_entry.jpg?1330114251" title="Ashton" />
<div class="gallery-text">
<h3>Ashton</h3>
<p>Porcelain</p>
</div>
</a>
<a href="/system/images/series_uploads/9/original/ashton_23942_camel_haze_lr.jpg?1330114252" rel="lightbox['gallery']">
<img alt="" src="/system/images/series_uploads/9/gallery/ashton_23942_camel_haze_lr.jpg?1330114252" title="Ashton" />
<div class="gallery-text">
<h3>Ashton</h3>
<p>Porcelain</p>
</div>
</a>
<a href="/system/images/series_uploads/10/original/berkshire_25525_oak.jpg?1330115116" rel="lightbox['gallery']">
<img alt="" src="/system/images/series_uploads/10/gallery/berkshire_25525_oak.jpg?1330115116" title="Berkshire" />
<div class="gallery-text">
<h3>Berkshire</h3>
<p>HDP – High Definition Porcelain</p>
</div>
</a>
<a href="/system/images/series_uploads/11/original/berkshire_25585_walnut_famousdaves01.jpg?1330115118" rel="lightbox['gallery']">
<img alt="" src="/system/images/series_uploads/11/gallery/berkshire_25585_walnut_famousdaves01.jpg?1330115118" title="Berkshire" />
<div class="gallery-text">
<h3>Berkshire</h3>
<p>HDP – High Definition Porcelain</p>
</div>
</a>
</div>
they aren't siblings that's why you should use
#gallery a:nth-of-type(4n) img{
border: 5px solid #000;
}
http://boythemovie.co.nz/wordpress/downloads-2
Thanks to WP formatting, the images with captions sit in their own divs, whilst the others are all within a single <p> tag.
What I would like is for all the images, with or without captions, to flow nicely.
For now I have:
HTML - which I can't change:
<div style="width: 250px" class="wp-caption alignnone" id="attachment_158">
<a href="http://boythemovie.co.nz/wordpress/wp-content/uploads/WaihauBay.jpg">
<img width="240" height="159" alt="" src="http://boythemovie.co.nz/wordpress/wp-content/uploads/WaihauBay-240x159.jpg" title="WaihauBay" class="size-medium wp-image-158 ">
</a>
<p class="wp-caption-text">
Caption text goes here
</p>
</div>
<p>
<a href="http://boythemovie.co.nz/wordpress/wp-content/uploads/1011.jpg">
<img width="240" height="160" alt="" src="http://boythemovie.co.nz/wordpress/wp-content/uploads/1011-240x160.jpg" title="1011" class="alignnone size-medium wp-image-162">
</a>
<a href="http://boythemovie.co.nz/wordpress/wp-content/uploads/1062.jpg">
<img width="240" height="159" alt="" src="http://boythemovie.co.nz/wordpress/wp-content/uploads/1062-240x159.jpg" title="1062" class="alignnone size-medium wp-image-164">
</a>
<a href="http://boythemovie.co.nz/wordpress/wp-content/uploads/1064.jpg">
<img width="240" height="160" alt="" src="http://boythemovie.co.nz/wordpress/wp-content/uploads/1064-240x160.jpg" title="1064" class="alignnone size-medium wp-image-166">
</a>
<a href="http://boythemovie.co.nz/wordpress/wp-content/uploads/521.jpg">
<img width="240" height="160" alt="" src="http://boythemovie.co.nz/wordpress/wp-content/uploads/521-240x160.jpg" title="521" class="alignnone size-medium wp-image-168">
</a>
<a href="http://boythemovie.co.nz/wordpress/wp-content/uploads/519.jpg">
<img width="240" height="160" alt="" src="http://boythemovie.co.nz/wordpress/wp-content/uploads/519-240x160.jpg" title="519" class="alignnone size-medium wp-image-170">
</a>
<a href="http://boythemovie.co.nz/wordpress/wp-content/uploads/507.jpg">
<img width="240" height="360" alt="" src="http://boythemovie.co.nz/wordpress/wp-content/uploads/507-240x360.jpg" title="507" class="alignnone size-medium wp-image-171">
</a>
<a href="http://boythemovie.co.nz/wordpress/wp-content/uploads/508.jpg">
<img width="240" height="360" alt="" src="http://boythemovie.co.nz/wordpress/wp-content/uploads/508-240x360.jpg" title="508" class="alignnone size-medium wp-image-172">
</a>
<a href="http://boythemovie.co.nz/wordpress/wp-content/uploads/BOY_1.jpg">
<img width="240" height="159" alt="" src="http://boythemovie.co.nz/wordpress/wp-content/uploads/BOY_1-240x159.jpg" title="BOY_1" class=" alignnone">
</a>
<a href="http://boythemovie.co.nz/wordpress/wp-content/uploads/BOY_3.jpg">
<img width="240" height="311" alt="" src="http://boythemovie.co.nz/wordpress/wp-content/uploads/BOY_3-240x311.jpg" title="BOY_3">
</a>
<a href="http://boythemovie.co.nz/wordpress/wp-content/uploads/BOY_2.jpg">
<img width="240" height="158" alt="" src="http://boythemovie.co.nz/wordpress/wp-content/uploads/BOY_2-240x158.jpg" title="BOY_2" class="alignnone size-medium wp-image-175">
</a>
<a href="http://boythemovie.co.nz/wordpress/wp-content/uploads/BOY_5.jpg">
<img width="240" height="160" alt="" src="http://boythemovie.co.nz/wordpress/wp-content/uploads/BOY_5-240x160.jpg" title="BOY_5" class="alignnone size-medium wp-image-177">
</a>
</p>
CSS:
.wp-caption {
float: left;
}
#content img {
float: left;
}
Any help in understanding how floated elements work in this case would be greatly appreciated!
Floated elements should normally be used to wrap text around a certain element, for instance, your image. From my estimates of your question, you are trying to position caption for an image so that the position of other images are not disturbed.
Why not use the display:inline-block property. In that manner you can have plenty of such parent div enclosing n number of elements without affecting the position of elements outside this div
It can be summarized as follows.
<div id="theGlobalDiv">
<div id="withCaption" style="display:inline-block" >
<img src="image.jpeg" />
<p id="caption">Some caption inserted here</p>
</div>
<div id="withoutCaption" style="display:inline-block" >
<img src="image2.jpeg" />
</div>
</div>
Hence, display:inline-block will display withCaption and withoutCaption in one line but the elements inside them will be on successsive lines. NOTE that inline-block works only when elements using this property are inside another block level element. Hence, if you try to enclose div inside a p or two or more divs as ultimate parent elements, set to this property, then it will fail to achieve the desired flow