I have a wordpress site and I am using the spacious theme. And what I want to archive is just a green box under de image slider. So the code of the image slider is like this:
<section id="featured-slider">
<div class="slider-cycle" style="height: 465.922px;">
<nav id="controllers" class="clearfix">
<a class="active"/>
<a class=""/>
<a class=""/>
<a class=""/>
<a class=""/>
</nav>
<div class="slides displayblock cycle-slide cycle-slide-active" style="position: absolute; top: 0px; left: 0px; z-index: 99; opacity: 1; display: block; visibility: visible;">
<figure>
<img class="lazy loaded" width="1500" height="655" alt="" src="https://www.nieuwdenhaag.nl/wp-content/uploads/2022/07/slide-1-meeuwen-1500-655-slider-2.png" data-src="https://www.nieuwdenhaag.nl/wp-content/uploads/2022/07/slide-1-meeuwen-1500-655-slider-2.png" data-was-processed="true">
</figure>
<div class="entry-container">
<div class="clearfix"/>
<a class="slider-read-more-button" href="https://www.nieuwdenhaag.nl/doe-mee-2/" title="">Doe mee</a>
</div>
</div>
<div class="slides displaynone cycle-slide" style="position: absolute; top: 0px; left: 0px; z-index: 97; visibility: hidden; opacity: 0; display: block;">
<figure>
<img class="lazy loaded" width="4950" height="2162" alt="" src="https://www.nieuwdenhaag.nl/wp-content/uploads/2022/07/Mensen-in-het-park-Den-Haag.png" data-src="https://www.nieuwdenhaag.nl/wp-content/uploads/2022/07/Mensen-in-het-park-Den-Haag.png" data-was-processed="true">
</figure>
<div class="entry-container">
<div class="clearfix"/>
<a class="slider-read-more-button" href="https://www.nieuwdenhaag.nl/steun-ons/" title="">Steun ons</a>
</div>
</div>
<div class="slides displaynone cycle-slide" style="position: absolute; top: 0px; left: 0px; z-index: 96; visibility: hidden; opacity: 0; display: block;">
<figure>
<img class="lazy loaded" width="4350" height="1899" alt="" src="https://www.nieuwdenhaag.nl/wp-content/uploads/2022/07/slide-3-zomer-Den-Haag-kinderen-spelen-slider.png" data-src="https://www.nieuwdenhaag.nl/wp-content/uploads/2022/07/slide-3-zomer-Den-Haag-kinderen-spelen-slider.png" data-was-processed="true">
</figure>
<div class="entry-container">
<div class="clearfix"/>
<a class="slider-read-more-button" href="https://www.nieuwdenhaag.nl/verbind-op-locatie-of-thema/" title="">Verbind op locatie of thema</a>
</div>
</div>
<div class="slides displaynone cycle-slide" style="position: absolute; top: 0px; left: 0px; z-index: 95; visibility: hidden; opacity: 0; display: block;">
<figure>
<img class="lazy loaded" width="4799" height="2095" alt="" src="https://www.nieuwdenhaag.nl/wp-content/uploads/2022/07/terras-vol-Den-Haag-blur-TEST-5250-2095-TEST.png" data-src="https://www.nieuwdenhaag.nl/wp-content/uploads/2022/07/terras-vol-Den-Haag-blur-TEST-5250-2095-TEST.png" data-was-processed="true">
</figure>
<div class="entry-container">
<div class="clearfix"/>
<a class="slider-read-more-button" href="https://www.nieuwdenhaag.nl/word-lid/" title="">Word lid en één van ons</a>
</div>
</div>
<div class="slides displaynone cycle-slide" style="position: absolute; top: 0px; left: 0px; z-index: 100; visibility: hidden; opacity: 0; display: block;">
<figure>
<img class="lazy loaded" width="4200" height="1834" alt="" src="https://www.nieuwdenhaag.nl/wp-content/uploads/2022/07/surfers-strand-test-4200-1834-ICARUS-2.png" data-src="https://www.nieuwdenhaag.nl/wp-content/uploads/2022/07/surfers-strand-test-4200-1834-ICARUS-2.png" data-was-processed="true">
</figure>
<div class="entry-container">
<div class="clearfix"/>
<a class="slider-read-more-button" href="https://www.nieuwdenhaag.nl/evenementen/" title="">Evenementen >>> agenda</a>
</div>
</div>
</div>
</section>
And I try it with css like this:
#featured-slider img {
border-bottom: 70px solid #72BF44;
width: 1067x;
height: 466px;
}
But this is not the correct way. Because the images are transforming. And also the greenbox takes space from the images.
And I also want to have some text in the green box.
So I have added a image how it have to look like.
With the text in the green box. And I am using the Guttenberg layout for editing the pages.
if I do it with the option: "Custom HTML" in the Gutenberg page.
It already looks better. But how to make this full width. Like the images above?
There is a class inner-wrap:
<div class="inner-wrap">
<div id="primary">
<div id="content" class="clearfix">
<div style="background:#72BF44;height:70px;width: 100%;"></div>
</div>
with the css:
.inner-wrap {
width: 94%;
}
.inner-wrap {
margin: 0 auto;
max-width: 1218px;
}
So how to overrule the inner-wrap, so that the greenbox has the full widht of the images?
Add an "Custom HTML" block with this content:
<div style="background:#72BF44;height:70px"></div>
Related
This is probably something very simple, yet I can't seem to figure it out. I am working on an image gallery where the images are sometimes in the portrait and sometimes in the landscape mode. For the gallery to look uniform, I need the thumbnails to be the same size and only upon a click, the full image will be displayed. I'm using Zurb Foundation and SCSS.
This is my code at the moment:
<div class="img-single column column-block">
<a data-open="galleryModal">
<img src="assets/img-01.jpg" class="thumbnail" alt="">
</a>
</div>
.img-single {
width: 300px;
height: 300px;
img {
width: 100%;
height: 100%;
}
}
At the moment, the image stretches to be 300px by 300px. I just need to display a thumbnail of the image with the image's centre to be displayed, and not distorted. I also tried adding vertical-align: middle; and played with max-width and max-height values, but it didn't do anything. How can it be done?
You may take advantage of the new object-fit CSS property and make the image appear as you want.
Here is some example code for you, showing the difference between the image placed using object-fit and the default image:
.img-single {
display: inline-block;
width: 300px;
height: 300px;
overflow: hidden;
}
.img-single img {
width: 100%;
height: 100%;
object-fit: cover;
}
<div class="img-single column column-block">
<a data-open="galleryModal">
<img src="https://unsplash.it/458/354?image=0" class="thumbnail" alt="Image with object-fit" title="Image with object-fit">
</a>
</div>
<img src="https://unsplash.it/458/354?image=0" alt="Just the image" title="Just the image">
You may also position the image differently within the .img-single container using the object-position property if you want.
Hope it helped.
PS: I also used the overflow property in such cases to avoid images from bleeding out. Cheers!
You can center the image in a smaller container using background-image on a div.
<div class="thumbnail" style="background: url("assets/img-01.jpg") no-repeat;"></div>
.thumbnail {
background-position: center;
width: 50px;
height: 50px;
}
If you remove Foundation's thumbnail class this should work.
HTML (e.g)
<div class="img-grid row small-up-2 medium-up-3 large-up-4">
<div class="img-single column column-block">
<a data-open="galleryModal">
<img src="https://placeimg.com/620/580/animals" class="" alt="">
</a>
</div>
<div class="img-single column column-block">
<a data-open="galleryModal">
<img src="https://placeimg.com/440/780/animals" class="" alt="">
</a>
</div>
<div class="img-single column column-block">
<a data-open="galleryModal">
<img src="https://placeimg.com/460/640/animals" class="" alt="">
</a>
</div>
<div class="img-single column column-block">
<a data-open="galleryModal">
<img src="https://placeimg.com/720/420/animals" class="" alt="">
</a>
</div>
<div class="img-single column column-block">
<a data-open="galleryModal">
<img src="https://placeimg.com/660/400/animals" class="" alt="">
</a>
</div>
<div class="img-single column column-block">
<a data-open="galleryModal">
<img src="https://placeimg.com/480/840/animals" class="" alt="">
</a>
</div>
<div class="img-single column column-block">
<a data-open="galleryModal">
<img src="https://placeimg.com/400/640/animals" class="" alt="">
</a>
</div>
<div class="img-single column column-block">
<a data-open="galleryModal">
<img src="https://placeimg.com/440/780/animals" class="" alt="">
</a>
</div>
</div>
SCSS
.img-single {
width: 300px;
height: 300px;
position: relative;
overflow: hidden;
img {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
min-width: 300px;
min-height: 300px;
}
}
JSFiddle demo
I'm trying to put some text over image and it isn't working. It just puts my text under my image and I can't bring it up.
My code:
.Happylady {
position: relative;
width: 100%;
}
.Happylady p {
float: left;
position: absolute;
left: 0;
top: 80px;
width: 100%;
}
<div class="Bannerimage">
<img src="content/severroom.png" class="centerimage" />
<p>Check out speeds up to 60Mbps!</p>
<button >View Packages!</button>
</div>
<div class="Internet">
<div class="Information">
<h3>INTERNET</h3>
<h7>CABLE, DSL & RURAL WIRELESS</h7>
</div
<div class="HappyLady">
<img src="content/happylaptoplady.png" alt="" />
<div class="contents">
<h4 class="Pricing">From <span class="Dollar">$29.99</span> per month!</h4>
<div class="Benefits">
<p>UNLIMITED PLANS AVAILABLE</p>
<p>NOW WITH LOWER PRICES</p>
<p>FASTER SPEEDS - UP TO 60 MBPS!</p>
</div>
</div>
</div>
</div>
<div class="Phone">
<h3>PHONE</h3>
<h7>RESIDENTIAL & COMMERCIAL</h7>
</div>
<div class="Television">
<h3>TELEVISION</h3>
<h7>SHAW DIRECT / INTERNET TV</h7>
</div>
Edit: I've added my entire HTML code... that may show where I'm going wrong.
Your class is misspelled in your CSS and you're positioning all your paragraphs over top of each other. You need to wrap your content in a container and position it. Also you won't need that float.
.HappyLady {
position: relative;
width: 100%;
}
.HappyLady div.contents {
position: absolute;
left: 0;
top: 80px;
width: 100%;
}
<div class="HappyLady">
<img src="http://placehold.it/400x400" alt="" />
<div class="contents">
<h4 class="Pricing">From <span class="Dollar">$29.99</span> per month!</h4>
<div class="Benefits">
<p>UNLIMITED PLANS AVAILABLE</p>
<p>NOW WITH LOWER PRICES</p>
<p>FASTER SPEEDS - UP TO 60 MBPS!</p>
</div>
</div>
</div>
Try to refactor your code using the image as a background-image:
.HappyLady {
position: relative;
width: 100%;
background-image: url('http://truespeed.ca/wp-content/uploads/2016/06/happylaptoplady.png');
background-size:100% 100%;
}
and remove the image tag from your code.
So I have that html code with images+title:
<div class="container">
<div class="box"><img src="image1.jpg" class="thumb"><p>Title 1</p></div>
<div class="box"><img src="image2.jpg" class="thumb"><p>Title 2</p></div>
<div class="box"><img src="image3.jpg" class="thumb"><p>Title 3</p></div>
<div class="box"><img src="image4.jpg" class="thumb"><p>Title 4</p></div>
...
<div class="box"><img src="image49.jpg" class="thumb"><p>Title</p></div>
<div class="box"><img src="image50.jpg" class="thumb"><p>Title</p></div>
</div>
And css:
.container {
width:80%;
margin: 0 auto;
}
.box {
display:inline-block;
width:150px;
margin-right:5px;
float:left;
}
With that code I have more "white" space on right, I want to have these pictures in the center for different browser size without setting up width for container.
Is it possible with css?
add to your container class text-align: center; and remove float:left; from box class.
That's what you call a centered, widthless float.
#outer {
/* This is just so you can see that they're centered */
width: 400px;
border: 1px solid black;
overflow: hidden;
}
.centered {
position: relative;
float: left;
left: 50%;
/* This and below is just because I have them stacked */
height: 100px;
padding-bottom: 10px;
clear: left;
}
.centered div {
position: relative;
float: left;
left: -50%;
}
<div id="outer">
<div class="centered">
<div>
<img src="http://placehold.it/200x100" alt="" />
</div>
</div>
<div class="centered">
<div>
<img src="http://placehold.it/300x100" alt="" />
</div>
</div>
<div class="centered">
<div>
<img src="http://placehold.it/50x100" alt="" />
<img src="http://placehold.it/50x100" alt="" />
<img src="http://placehold.it/50x100" alt="" />
<img src="http://placehold.it/50x100" alt="" />
<img src="http://placehold.it/50x100" alt="" />
</div>
</div>
</div>
I'm relatively new at this level of complexity – at any rate, creating a webpage on the Squarespace platform which will feature a code block that presents a grid of 12 clickable tiles with Hover response and click through functionality. While Squarespace has built in responsiveness, whatever is in the code block is exempt from that.
So, the problem I'm having is that my nicely centered grid of 12 tiles is only centered when displayed on a fully open browser window. As the browser window diminishes in size and the tiles begin stacking, the grid aligns to the right. I've already put the gallery in a div in order to get the original centering.
Is there a way to force centering regardless of browser size?
To see the behavior in action, change Result window size of jsfiddle:
http://jsfiddle.net/terryogara/VQ3hk/
Thank you, and here's the code:
<style type="text/css">
.caption-style-1 li{
list-style-type: none;
margin: 0px;
padding: 5px;
position: relative;
overflow: hidden;
}
.caption-style-1 li:hover .caption{
opacity: 1;
}
.caption-style-1 li:active .caption{
opacity: .5;
}
.caption-style-1 img{
float: left;
}
.caption-style-1 .caption{
cursor: pointer;
position: absolute;
opacity: 0;
-webkit-transition:all 0.45s ease-in-out;
-moz-transition:all 0.45s ease-in-out;
-o-transition:all 0.45s ease-in-out;
-ms-transition:all 0.45s ease-in-out;
transition:all 0.45s ease-in-out;
}
.caption-style-1 .blur{
background-color: rgba(0,0,0,0.65);
height: 180px;
width: 180px;
position: relative;
}
.caption-style-1 .caption-text{
position: absolute;
width: 180px;
height: 180px;
text-align: center;
top:10px;
}
.outer-container {
width: 100%;
min-width: 980px
margin: 0 auto;
text-align: center;
}
.inner-container {
display: inline-block;
}
</style>
<!-- CONTENT -->
<!-- OUTER CONTAINER -->
<div class="outer-container">
<ul class="caption-style-1">
<!-- ROW 1 TOP | IMAGE GALLERY 1 -->
<div class="inner-container">
<!-- IMAGE 1 -->
<div style="float: right;">
<div style="float: right;">
<a href="http://www.example.com">
<li>
<img src="http://murmurhaus.com/wp-content/uploads/2014/07/ph-180x180.png" height="180" width="180" alt="ALT">
<div class="caption">
<div class="blur"></div>
<div class="caption-text">
<h1>TEXT HERE</h1>
</div>
</div>
</li></a>
</div>
<!-- IMAGE 2 -->
<div style="float: right;">
<a href="http://www.google.com">
<li>
<img src="http://murmurhaus.com/wp-content/uploads/2014/07/ph-180x180.png" height="180" width="180" alt="ALT">
<div class="caption">
<div class="blur"></div>
<div class="caption-text">
<h1>TEXT HERE</h1>
</div>
</div>
</li></a>
</div>
</div>
<!-- IMAGE 3 -->
<div style="float: right;">
<div style="float: right;">
<a href="http://http://stackoverflow.com/">
<li>
<img src="http://murmurhaus.com/wp-content/uploads/2014/07/ph-180x180.png" height="180" width="180" alt="ALT">
<div class="caption">
<div class="blur"></div>
<div class="caption-text">
<h1>TEXT HERE</h1>
</div>
</div>
</li></a>
</div>
<!-- IMAGE 4 -->
<div style="float: right;">
<li>
<img src="http://murmurhaus.com/wp-content/uploads/2014/07/ph-180x180.png" height="180" width="180" alt="ALT">
<div class="caption">
<div class="blur"></div>
<div class="caption-text">
<h1>TEXT HERE</h1>
</div>
</div>
</li></a>
</div>
</div>
<!-- END GALLERY 1-->
<!-- CLOSE INNER CONTAINER -->
</div>
<!-- CLOSE OUTER CONTAINER -->
</ul>
</div>
<!-- END ROW 1 -->
I have a site with a portfolio image, when the image is hovered on, an overlay appears.
I have implemented this in such a way that it means when the code is multiplied (for 3 different portfolio items) the overlay is always only over the first image, rather than on each different image being rolled-over.
Can anyone help?
Live link is here
The code used to make the image overlay:
CSS:
.image {
position: relative;
height: 240px;
}
.hoverimage {
position: absolute;
top: 5px;
left: 25px;
display: none;
}
.image:hover .hoverimage {
display: block;
}
HTML:
<img src="images/portfolio_image_1.png" class="captionme"
title="I am the only son" alt="Porfolio detail" />
<img src="images/portfolio_image_1.png" class="captionme"
title="I am the only son" alt="Porfolio detail" />
<img src="images/portfolio_image_1.png" class="captionme"
title="I am the only son" alt="Porfolio detail" />
To overlay on each different image being rolled-over, you'll have to make some changes in your HTML and CSS files. In your HTML file search for <div class="image"> and put each <img class="hoverimage"> element inside <div class=""imgpost">:
<div class="image">
<div class="imgpost">
<img src="images/portfolio_image_1.png" class="captionme" title="I am the only son" alt="Porfolio detail">
<div class="thecaption">I am the only son</div>
<img class="hoverimage" src="images/portfolio_overlay.png" alt="">
</div>
<div class="imgpost">
<img src="images/portfolio_image_1.png" class="captionme" title="I am the only son" alt="Porfolio detail">
<div class="thecaption">I am the only son</div>
<img class="hoverimage" src="images/portfolio_overlay.png" alt="">
</div>
<div class="imgpost">
<img src="images/portfolio_image_1.png" class="captionme" title="I am the only son" alt="Porfolio detail">
<div class="thecaption">I am the only son</div>
<img class="hoverimage" src="images/portfolio_overlay.png" alt="">
</div>
</div>
Then in your CSS add/modify the folowing styles:
.hoverimage { position: absolute; top: 1px; left: 1px; display: none;}
.imgpost .hoverimage {
border: none;
background: none;
}
.imgpost:hover .hoverimage {
display: block;
}
Then delete this style:
.image:hover .hoverimage { display: block; }