<hr> Line appearing below relative div - html

I'm currently creating a website which is created by three main divs on one page. In-between each div, I have a faint hr to help visually 'split them up'.
Between my first and second divs, the hr displays fine.
Between the second and third is my problem - the hr displays underneath the second div. I have a feeling it is to do with the relative positioning of the container of my second div, but that is needed for me to position images within in.
I have tried display:block and wrapping the second div inside another container amongst other things, but nothing has yet worked.
I could try using div with a background/border rather than hr, but i'm not sure if this is the right way to approach it (i'm still learning my way around things).
Below is my code for the 'second div' and the hr I am trying to position.
<!-- PORTFOLIO -->
<div id="portfoliocont">
<div class="smallthumb" id="thumb1">
<a href="media/pamabest/pamabesttitle-large.jpg" class="overlay" data-lightbox="image-1" data-title="Pamabest" class="show">
<a href="media/pamabest/app-login.jpg" class="overlay" data-lightbox="image-1" data-title="Log in with your own account">
<a href="media/pamabest/tutorial.jpg" class="overlay" data-lightbox="image-1" data-title="Message your friends">
<a href="media/pamabest/app-profile.jpg" class="overlay" data-lightbox="image-1" data-title="Create your own profile">
<a href="media/pamabest/app-messages.jpg" class="overlay" data-lightbox="image-1" data-title="Message your friends">
<a href="media/pamabest/karaoke--menu.jpg" class="overlay" data-lightbox="image-1" data-title="Have a laugh">
<a href="media/pamabest/lists-viewlist.jpg" class="overlay" data-lightbox="image-1" data-title="Be prepared">
<a href="media/pamabest/mycar.jpg" class="overlay" data-lightbox="image-1" data-title="See the stats">
<a href="media/pamabest/weather.jpg" class="overlay" data-lightbox="image-1" data-title="Pack wisely">
<a href="media/pamabest/ticket5pariswhitestarstextured.jpg" class="overlay" data-lightbox="image-1" data-title="Front of 'Pamabest: Paris' ticket">
<a href="media/pamabest/ticketbackwhitestarstextured.jpg" class="overlay" data-lightbox="image-1" data-title="Back of 'Pamabest: Paris' ticket">
<a href="media/pamabest/travelticket2withbannertextured.jpg" class="overlay" data-lightbox="image-1" data-title="Front of 'Pamabest: Travel Pass' ticket">
<a href="media/pamabest/travelticket2backtextured.jpg" class="overlay" data-lightbox="image-1" data-title="Front of 'Pamabest: Travel Pass' ticket">
<img src="images/smallthumb/pamabest-small.jpg" alt="Imaginary music festival, Pamabest"/ title="Pamabest companion app">
<h1>"Pamabest" is a European, multi-cultural music festival aimed at 18-30 year olds.<br>A companion app would be used to help festival goers navigate the park and enhance their overall experiance.</h1></a>
<p>Pamabest music festival</p>
</div>
<div class="smallthumb" id="thumb2">
<a href="media/pisforpsychohd.mov" class="overlay">
<img src="images/smallthumb/psycho-small.jpg" alt="2 Minute video recreating a scene from the move, P is for Psycho" title="P is for Psycho video"/>
<h1>Filmed within a group, the video is a recreation of the 'bathroom scene' from the movie. <br>All editing was made in Premier Pro.</h1></a>
<p>P is for Pscyho</p>
</div>
<div class="smallthumb" id="thumb3">
<a href="media/silverlake/build/index.html" class="overlay" target="_blank">
<img src="images/smallthumb/silverlake-small.jpg" alt="Silverlake Website" title="Silverlake theme park website"/>
<h1>Silverlake theme park is based in the heart of Yorkshire, boasting a zoo and other child-friendly features. <br> The website was made with HTML5 and CSS3, graphical assests were made in Photoshop and Illustrator.</h1></a>
<p>Silverlake themepark</p>
</div>
<div class="blankthumb" id="thumb4"></div>
<div class="blankthumb" id="thumb5"></div>
<div class="blankthumb" id="thumb6"></div>
</div>
<hr>
And my CSS
hr {
margin: 40px 0px;
border: none;
height: 1px;
color: #ececec; /* old IE */
background-color: #ececec; /* Modern Browsers */
}
/* PORTFOLIO
--------------------------*/
#portfoliocont {
position: relative;
margin-bottom: 40px;
display: block;
}
.smallthumb, .blankthumb {
display: inline-block;
position: absolute;
}
.smallthumb a {
text-decoration: none;
}
.smallthumb img {
-webkit-box-shadow: 0px 0px 3px 1px rgba(0,0,0,0.23);
-moz-box-shadow: 0px 0px 3px 1px rgba(0,0,0,0.23);
box-shadow: 0px 0px 3px 1px rgba(0,0,0,0.23);
}
.blankthumb {
background: #f2f2f2;
width: 296px;
height: 174px;
}
#thumb1 {
left: 0px;
top: 0px;
}
#thumb2 {
left: 335px;
top: 0px;
}
#thumb3 {
right: 0px;
top: 0px;
}
#thumb4 {
left: 335px;
top: 250px;
}
#thumb5 {
right: 0px;
top: 250px;
}
#thumb6 {
left: 0px;
top: 250px;
}
#portfoliocont p {
padding-top: 10px;
color: #808080;
font-weight: 400;
}
.overlay h1 {
position: absolute;
/*display: inline-block;*/
height: 164px;
width: 276px;
bottom: 0;
top: 0;
color: white;
background-color: #806d9e;
opacity: 0;
font: 1em "Helvetica Neue";
text-align: left;
padding: 10px 10px 0px 10px;
line-height: 1.4em;
transition: transform 0.3s, opacity 0.3s;
-ms-transition: -ms-transform 0.3s, opacity 0.3s;
-webkit-transition: -webkit-transform 0.3s, opacity 0.3s;
}
.overlay h1 br{
display: block;
line-height: 2em;
}
.overlay:hover h1{
opacity: 1;
}
#thumb1 a.show {
display: block;
}
#thumb1 a {
display: hidden;
}
Thanks

Your problem here is all the thumbs with position: absolute;
When the browser renders an element with position: absolute; it doesn't take any space.
In your case, the #portfoliocont "has nothing inside".. What I mean is that anything inside that div occupies any space. Therefore, it's height is zero.
Following your zero-height div, the browser continues to render the <hr /> tag.
I strongly recommend not to position your thumbs absolutely. You have many other options, such as:
Display inline-block
Float left
Flexbox (watch out for browser support on this one)
Here is a simple example of using inline-block for the thumbs: https://jsfiddle.net/Lfhctqkg/

Defining div height, solved this little problem for me. An easier way, at least for a student on a simple task.

Related

Struggling to get words and Images inline

enter image description hereI am trying to get text underneath the images and have the images inline, I am getting them in line to make a slide show. Please see my code below
HTML:
<div class="slideshow-container">
<div class="mySlides fade">
<img src="images/British citizenship and Immigration.jpg" alt="British citizenship and Immigration Images">
<div class="text"><h6>British citizenship and
Immigration
</h6>
</div>
<div class="mySlides fade">
<img src="images/Australian Migration.jpg" alt="Australian Migration Images">
<div class="text"><h6>Australian Migration</h6>
<p class = "sent">Our team can assist with a range of Australian visa solutions. Our expert knowledge ensures you receive the best advice for your personal circumstances. </p>
</div>
</div>
<img src="images/Citizenship by investment.jpg" alt="Australian Migration Images">
<div class="text"><h6>Citizenship-by-investment</h6>
<p class = "sent">Enjoy the exclusive privileges that dual citizenship and international investment can provide. Our consultants can help you select the right programme and guide you every step of the way. </p>
</div>
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
</div>
</div>
CSS
.slideshow-container {
max-width: 1000px;
position: relative;
margin: auto;
}
.mySlides
{
display: flex;
}
I have tried display grid with grid-template-columns, the text does not go underneath and that does not seem to work.
Anyone have a solution?
Try to add display: inline-block on the actual Elements( that is the image and the word)
I managed to get it in line with the text underneath.
HTML
<div class="row">
<div class="column animation">
<img src="images/British citizenship and Immigration.jpg" alt="British citizenship and Immigration">
<h1>British citizenship and Immigration</h1>
</div>
<div class="column">
<img src="images/Australian Migration.jpg" alt="Australian Migration">
<h1>Australian Migration</h1>
<p>Our team can assist with a range of Australian visa solutions. Our expert knowledge ensures you receive the best advice for your personal circumstances.</p>
</div>
<div class="column">
<img src="images/Citizenship by investment.jpg" alt="Citizenship by investment">
<h1>Citizenship-by-investment</h1>
<p>Enjoy the exclusive privileges that dual citizenship and international investment can provide. Our consultants can help you select the right programme and guide you every step of the way.</p>
</div>
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
</div>
CSS
.row {
margin-top: 10px;
display: flex;
flex-wrap: wrap;
padding: 0px 8rem 0px 338px;
margin-top: -33vh;
margin-left:10vw;
}
.column {
flex:10%;
padding: 0 4px;
}
.prev, .next {
cursor: pointer;
position: relative;
top: 50%;
width: auto;
margin-top: -22px;
padding: 16px;
color: #115577;
font-weight: bold;
font-size: 30px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
user-select: none;
}
.next {
text-decoration: none;
top:7rem;
right: 26rem;
border-radius: 3px 0 0 3px;
}
.prev
{
text-decoration: none;
top:7rem;
left: -126rem;
}
.column h1
{
font-size:16px;
margin-left: 2.5rem;
}
.column img
{
margin-left:1vw;
}
.column p
{
text-align: center;
margin-left: 0rem;
margin-right: 25rem;
}
.animation {
animation-name: animation;
animation-duration: 1.5s;
}
#keyframes animation {
from {opacity: .4}
to {opacity: 1}
}
Thank you all for your help

Why does my "Popup window" not showing for the second time on click?

I have above code work fine here ( if i run code ) but it causing me error on my website.
What's happening is that on first time click on all links works fine but when i try to click second time then it shows blank page and you can't click anywhere on page so either i have to refresh or click back button.
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
overflow:hidden;
z-index:9999999;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #000;
}
.popup .close:hover {
color: #06D85F;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
#media screen and (max-width: 700px){
.popup{
width: 70%;
}
}
<div style="clear:both; height:23px; font-size:9px; color:#0033FF; text-align:right; margin-right:11px;"><a href="#1" >View</a></div>
<div id="1" class="overlay">
<div class="popup">
<h2>pop up window one </h2>
<a class="close" href="#" >×</a>
<div class="content">
this is my pop up window 1
</div>
</div>
</div>
<div style="clear:both; height:23px; font-size:9px; color:#0033FF; text-align:right; margin-right:11px;"><a href="#2" >View</a></div>
<div id="2" class="overlay">
<div class="popup">
<h2>pop up window one </h2>
<a class="close" href="#" >×</a>
<div class="content">
this is my pop up window 1
</div>
</div>
</div>
<div style="clear:both; height:23px; font-size:9px; color:#0033FF; text-align:right; margin-right:11px;"><a href="#3" >View 3</a></div>
<div id="3" class="overlay">
<div class="popup">
<h2>pop up window one </h2>
<a class="close" href="#" >×</a>
<div class="content">
this is my pop up window 1
</div>
</div>
</div>
As per your instructions I got that there is a problem with theme.js file in your website.
whenever you are clicking that close "x" button of popup a function in that file at line number 105 triggers and adds a inline css in your popup and reduces the opacity of the popup div to "opacity:0".
solution: you can just change that class name and remove the click even as a temporary solution. or you can edit theme.js file and reduce your code and get better performance...
choice is yours
I hope that this will help you. or else you can tell me for any kind of help!
Thank you!
Happy Coding!!!
It is working perfectly in Stack overflow code snippet.
i think there might be some problem with your local environment.
Although if u need any kind of help, feel free to ask me!
Thank you!
Happy Coding!

Unslider Styling Style Issue Dots

I am currently styling the http://unslider.com/ jquery banner.
I want to style the dots to be centered in a rectangle.
When I set the background in the dots class it pulls them out of the center.
I would just wrap a div around them but since there are not referenced in the html I am not sure what to do. I have tried to do this using background but it created issues.
CSS:
.banner { width 100% !important;
height:auto !important;
position: relative;
overflow: auto;
}
.dots {
position: absolute;
left: 0;
right: 0;
bottom: 5%;
text-align: center;
background-color:rgba(0, 0, 0, 0.5);
height:3vw;
width:7vw;
padding-top:1vw;
}
.dots li {
display: inline-block;
width: 10px;
height: 10px;
margin: 0 4px;
text-indent: -999em;
border: 2px solid #fff;
border-radius: 6px;
cursor: pointer;
background:#e8e8e9;
-webkit-transition: background .5s, opacity .5s;
-moz-transition: background .5s, opacity .5s;
transition: background .5s, opacity .5s;
}
HTML:
<div class="banner">
<ul>
<li><div class ="image-container"><img src="images_slider/slide1.jpg" alt="Slide1" width="1920" height="500">
<img class="leftbtn hvr-grow" alt="" src="images_slider/learnmore.png">
<img class="rightbtn hvr-grow" alt="" src="images_slider/catalog.png"></div>
</li>
<li><div class ="image-container"><img src="images_slider/slide2.jpg" alt="Slide2" width="1920" height="500">
<img class="leftbtn hvr-grow" alt="" src="images_slider/contact.png"></div>
</li>
<li><div class ="image-container"><img src="images_slider/slide3.jpg" alt="Slide3" width="1920" height="500">
<img class="leftbtn hvr-grow" alt="" src="images_slider/learnmore.png">
<img class="rightbtn hvr-grow" alt="" src="#"></div>
</li>
</ul>
</div>
As I said in my comments the dots are already centered in unslider, you dont have to add a class to the dots. If you want to make a centered rectangle of the dots navigation under the slider, you only need this in your css-code:
nav.unslider-nav {
margin: 0 auto;
width: 25%;
background-color:rgba(0, 0, 0, 0.5);
}
margin: 0 auto; centers the dots navigation if not 100%change width:; as you like the other selectors to use in your css-code to change dots as you like are:
nav.unslider-nav ol
nav.unslider-nav ol li
nav.unslider-nav ol li.unslider-active
It turns out something in the unslider code was inserting padding and large border around the dots causing funky behavior. I set them all to zero and the centering is now fine.

Overlaying a Image with CSS

I have a store with a gallery. I was looking to overlay the Thumbnail if a Sold stamp that I made.
If i disable the image the overlay is showing bellow, so I know it is inserting the image, it isn't on top though.
What I see:
How I know the overlay is below (thumbnail disabled):
HTML:
<li class="post-66 product type-product status-publish has-post-thumbnail sold-individually shipping-taxable purchasable product-type-simple outofstock">
<center>
<a href="http://url.com">
<img width="150" height="150" src="thumbnail.jpg" class="attachment-shop_catalog wp-post-image" alt="coelho1" />
<h3>Coelho de Peluxe</h3>
</a>
</center>
</li>
CSS:
.outofstock {
background: url("soldoverlay.png") top left no-repeat;
position: relative;
z-index: 200;
}
.attachment-shop_catalog{
z-index: 1;
}
Can anyone please help me?
Kind Regards
The best way to make an overlay is use a pseudo-element using the class you already have outofstock. Check this snippet as an example:
li {
position: relative;
display: inline-block;
white-space: nowrap;
text-align:center;
margin:10px;
}
.outofstock:after {
content: " ";
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, .6);
z-index: 10;
}
<ul>
<li>
<a href="http://url.com">
<img width="150" height="150" src="http://placehold.it/150" alt="coelho1" />
<h3>WITHOUT OVERLAY</h3>
</a>
</li>
<li class="outofstock">
<a href="http://url.com">
<img width="150" height="150" src="http://placehold.it/150" alt="coelho1" />
<h3>OVERLAY</h3>
</a>
</li>
</ul>
Edit
To keep the link to of the href you can create the pseudo-element inside the a tag like this:
li {
display: inline-block;
white-space: nowrap;
text-align: center;
margin: 10px;
}
a {
position: relative;
display:block;
}
.outofstock a:after {
content: " ";
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, .6);
z-index: 10;
}
<ul>
<li>
<a href="http://url.com">
<img width="150" height="150" src="http://placehold.it/150" alt="coelho1" />
<h3>WITHOUT OVERLAY</h3>
</a>
</li>
<li class="outofstock">
<a href="http://url.com">
<img width="150" height="150" src="http://placehold.it/150" alt="coelho1" />
<h3>OVERLAY</h3>
</a>
</li>
</ul>
you could avoid to use an image and play with CSS 2D transformations (supported even on IE9)
e.g. http://codepen.io/anon/pen/NPydBP
Markup
<ul>
<li data-in-stock="vendido">
<a href="">
<img src="http://dummyimage.com/400x280/cccccc/fff.jpg" />
</a>
</li>
</ul>
CSS
li {
position: relative;
overflow: hidden;
}
[data-in-stock]:after {
position: absolute;
top: 0;
left: 0;
z-index: 1;
content: attr(data-in-stock);
display: block;
min-width: 160px;
color: #fff;
background: #222;
padding: 6px 10px;
text-transform: uppercase;
font: 1em Arial;
-webkit-transform: rotate(-42deg) translateX(-50px);
-moz-transform: rotate(-42deg) translateX(-50px);
transform: rotate(-42deg) translateX(-50px);
}
The text overlapped comes from the data-in-stock attribute in the markup, so you can easily change the text or optionally serve a different page language
This approach could also work if you need to show an image instead of a text (the content property also accepts an url to an image): see http://codepen.io/anon/pen/dPdNBQ
Final Result
1) Create a DIV to place your image in, set left and top css, and set z-index to 5, set width and height to be same as image
2) Create another DIV with same left, top, width, and height, but set z-index higher. Place img tag with outofstock in it

issue with css positioning in wordpress columns

I am having an issue with positioning a caption on top of a picture. The pictures are in a column, there are 4 columns. The first 3 columns seem to work fine but then when it comes to the last column, it does not look right at all and I feel like it may have to do with wordpress css? I have tried to add css to the last column which positions it correctly but then the width is not right... I am so confused. This may be such a simple fix but I can't seem to figure it out
Here is the link to the website
http://aminkhalil.com
Here is my html code
[fourcol_one]
<a href="#" class="caption">
<img class="hover" alt="Services" src="http://growinggood.com/wp-content/uploads/2014/02/billboard-slider-images.jpg" />
<span class="caption">Services</span></a>
[/fourcol_one]
[fourcol_one]
<a href="#" class="caption">
<img class="hover" alt="Keep Healthy" src="http://growinggood.com/wp-content/uploads/2014/02/billboard-slider-images.jpg" />
<span class="caption">Keep Healthy</span></a>
[/fourcol_one]
[fourcol_one]
<a href="#" class="caption">
<img class="hover" alt="Meet The Staff" src="http://growinggood.com/wp-content/uploads/2014/02/billboard-slider-images.jpg" />
<span class="caption">Meet The Staff</span></a>
[/fourcol_one]
[fourcol_one_last]
<a href="#" class="caption">
<img class="hover" alt="Portal" src="http://growinggood.com/wp-content/uploads/2014/02/billboard-slider-images.jpg" />
<span class="caption">Portal</span></a>
[/fourcol_one_last]
Here is my css
a.caption{
position:relative;
}
a:hover img.hover{
opacity: 0.5;
filter: alpha(opacity=530);
}
span.caption{
color: #fff !important;
position: absolute;
bottom: 0;
left: 2%;
padding: 1.9%;
width: 93%;
background-color: rgba(0,0,0,0.5);
}
.last span.caption{
bottom: 22px;
left: 3px;
}
Any help is appreciated. Thank you in advance!!
I figured it out!! I had some extra spaces/breaks in the HTML which was making the first 3 columns different than the last. I added/changed a couple of things to span.caption and deleted the CSS for .last span.caption
span.caption{
color: #fff !important;
position: absolute;
padding: 1.9%;
width: 93.5%;
background-color: rgba(0,0,0,0.5);
display: block; /* added */
bottom: 0; /* changed */
left: 3px; /* changed */
}
Thanks to anyone who may have done any research!!