Icon images not displaying in an inline-block fashion - html

I have a small bug that is driving me nuts. I have three social media icons that I want to display in an inline-block fashion. My code is correct, as far as I can see. I even made a snippet and it looks to be correct. I looked in my dev tools and do not see anything causing this issue. It is happening on my site in a viewport of 640px or less. This is making it hard to see what is wrong in the dev tools because of the small screen.
Does anyone see anything standing out? Please view the page in a viewport of 640px or less.
Click here to see live
.nav-panel-container {
position: fixed;
width: 70%;
height: 100%;
top: 0;
bottom: 0;
background: #F0F0F0;
z-index: 1;
-webkit-transition-property: -webkit-transform;
-moz-transition-property: -moz-transform;
transition-property: transform;
-webkit-transition-duration: 0.7s;
-moz-transition-duration: 0.7s;
transition-duration: 0.7s;
-webkit-transition-delay: 0.3s;
-moz-transition-delay: 0.3s;
transition-delay: 0.3s;
}
.nav-panel-content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 50px 0 0 0;
overflow: auto;
/* smooth scrolling on touch devices */
-webkit-overflow-scrolling: touch;
}
#nav-social-container {
bottom: 8%;
position: absolute;
text-align: center;
display: block;
width: 80%;
margin-left: 10%;
}
#nav-social-title {
font-size: .8em;
}
#nav-social-icons {
display: inline-block;
margin-top: 15px;
}
.nav-social-icon {
padding: 0 15px;
width: 100%;
}
.nav-social-icon:first-child {
padding-left: 0;
}
.nav-social-icon:last-child {
padding-right: 0;
}
<div class="nav-panel-container">
<div class="nav-panel-content">
<div id="nav-social-container">
<div id="nav-social-title">DON'T BE SHY, LET'S GET SOCIAL.</div>
<div id="nav-social-icons"><span class="nav-social-icon"><img src="http://optimumwebdesigns.com/icons/facebookBlack.png" alt="facebook" height="30px" width="30px"></span><span class="nav-social-icon"><img src="http://optimumwebdesigns.com/icons/twitterBlack.png" alt="twitter" height="30px" width="30px"></span>
<span
class="nav-social-icon">
<a href="http://linkedin.com" target="_blank">
<img src="http://optimumwebdesigns.com/icons/linkedInBlack.png" alt="linkedIn" height="30px" width="30px">
</a>
</span>
</div>
</div>

You're using <span> tags - these are display:inline - change them to block or inline-block.

Related

How can I make this div block transition the same way as this website example

I'm trying to find the CSS that makes the Div block underneath launch website animate on this website:https://district2.studio/project/dafi/ - but can't seem to replicate the animation
I find in the style sheet
<div class="text__mask-wrap" style="transform: matrix(1, 0, 0, 1, 0, 0);"<a class="post__title-launch d-inline-block" target="_blank" href="https://www.dafi.vn/">
<p class="mb-0">Launch Website</p>
<div class="launch__icon">
<span id="line-primary" class="line d-inline-block" style="width: 30px;"></span>
<span id="line-left" class="line d-block" style="opacity: 1; width: 0px;"></span>
<span id="line-right" class="line d-block" style="opacity: 1; width: 0px;"></span>
</div>
</a>
</div>
But can't find anything else in the html or css that relates back to this div block and animates it.
I was expecting some kind of transition but can't seem to find it.
I am building my first website and wanted to try out using this kind of div block animation.
<div class="text__mask-wrap" style="transform: matrix(1, 0, 0, 1, 0, 0);"><a class="post__title-launch d-inline-block" target="_blank" href="https://www.dafi.vn/">
<p class="mb-0">Launch Website</p>
<div class="launch__icon">
<span id="line-primary" class="line d-inline-block" style="width: 30px;"></span>
<span id="line-left" class="line d-block" style="opacity: 1; width: 0px;"></span>
<span id="line-right" class="line d-block" style="opacity: 1; width: 0px;"></span>
</div>
</a>
</div>
Whats expected is for the line to grow in width on mouse over, then mouse off it should grow from the middle and the 2 other lines should shrink to 0px in width
See the website launch website button for visual representation
you should use javascript code for this effect. if you jquery library added in your project, use this code:
$(".mb-0").hover(
function() {
var elWidth = $(this).width();
$(".launch__icon .line.d-inline-block").css({"width" : elWidth, "transition": "width 0.4s ease-out"});
$(".launch__icon .line.d-block").css({"width" : (elWidth/2), "opacity":"0"});
}, function() {
$(".launch__icon .line.d-inline-block").css({"width" : "30px", "transition": "width 0.4s ease-out", "transition-delay": "0.01s"});
$(".launch__icon .line.d-block").css({"width" : "0", "opacity":"1", "transition": "width 0.45s ease-out"});
});
and use below css:
.launch__icon {
width: 100%;
position: relative;
height: 2px;
text-align: center;
font-size: 0;
}
.launch__icon #line-primary {
display: inline-block;
width: 30px;
height: 2px;
background: #fff;
}
.launch__icon #line-left {
left: 0;
}
.launch__icon #line-left,
.launch__icon #line-right {
position: absolute;
width: 50%;
background: #fff;
height: 2px;
top: 0;
opacity: 0;
}
.launch__icon #line-right {
right: 0;
}
.mb-0,
.my-0 {
margin-bottom: 0!important
}
.d-inline-block {
display: inline-block!important;
}
They are using javascript, but you can use css for that, here is an illustration:
*{box-sizing: border-box}
/*
Since we want it to be centered i will use text-align center on the header which is just a wrapper
*/
header{
text-align: center
}
/*because the children will be absolute, we need to set the anchor's position to relative*/
a{
display: inline-block;
position: relative;
cursor: pointer;
}
.underline{
position: absolute;
bottom: 0;
height: 2px;
left: 50%;
width: 100%;
max-width: 32px;
margin-left: -16px;
background-color: black;
will-change: left,width;
/*We need an elastic ease here*/
transition: all .2s cubic-bezier(0.64, 0.57, 0.67, 1.53);
}
a:hover .underline{
left: 0;
margin-left: 0;
max-width: 100%;
transition: all .2s ease;
}
a:before,
a:after{
content: "";
position: absolute;
bottom: 0;
height: 2px;
width: 0;
background-color: black;
will-change: width;
transition: all .2s ease;
}
a:before{
left: 0;
}
a:after{
right: 0;
}
a:hover:before,
a:hover:after{
width: 50%;
transition: all .2s .2s ease;
}
<header>
<a>
<p>Launch Website</p>
<span class="underline"> </span>
</a>
<header>

How to add a mouse over scroll effect to an image within an image

Can anyone assist me with the below coding? I am trying to add an image of a monitor with another image within the monitor that has an auto scrolling effect on mouseover.
I have tried the following from this post:
How to make image scrolling effect inside other image?
I did post there too then only noticed I should have posted if I had a solution so I re-posted as a fresh post.
CSS Code I am using:
.computer-empty {
overflow: hidden;
position: relative;
width: 540px;
}
.computer-screen {
overflow: hidden;
position: relative;
height: 265px;
width: 480px;
left: 30px;
top: 20px;
}
.screen-landing {
left: 0;
line-height: 0;
position: absolute;
width: 100%;
transition: all 6s;
-o-transition: all 6s;
-ms-transition: all 6s;
-moz-transition: all 6s;
-webkit-transition: all 6s;
}
.screen-landing:hover {
cursor: pointer;
margin-top: -1036px;
}
img {
max-width: 100%;
width: auto;
height: auto;
vertical-align: middle;
border: 0;
-ms-interpolation-mode: bicubic;
}
.computer-empty img.computer {
width: 100%;
}
HTML Code im using:
<a target="_blank" href="http://www.safidrivingschool.co.uk" class="">
<div class="computer-screen">
<div class="screen-landing">
<img src="http://www.webnificent.co.uk/wp-content/uploads/graphics/safidrivingschool_capture.png" alt="Safi Driving School">
</div>
</div>
<img class="computer" src="http://www.webnificent.co.uk/wp-content/uploads/graphics/apple_montior.png" alt="computer">
</a>
</div>
If I set position to absolute on .computer-screen, both images line up correctly but then the scroll effect won't work. If I set it as relative, the scroll effect works but then the images sit on top of one another.
See this link: Example: https://webnificent.co.uk/web-design/
A solution would be greatly appreciated.
This was pretty fiddly, but hopefully this will help?
Let me know if you have issues with this at all!
.computer {
position: absolute;
top: 5px;
width: 540px;
z-index: -1;
}
.computer-empty {
overflow: hidden;
position: relative;
width: 540px;
}
.computer-screen {
overflow: hidden;
position: relative;
height: 260px;
width: 470px;
left: 35px;
top: 21px;
}
.screen-landing {
left: 0;
line-height: 0;
position: absolute;
width: 100%;
transition: all 6s;
-o-transition: all 6s;
-ms-transition: all 6s;
-moz-transition: all 6s;
-webkit-transition: all 6s;
}
.screen-landing:hover {
cursor: pointer;
margin-top: -1036px;
}
img {
max-width: 100%;
width: auto;
height: auto;
vertical-align: middle;
border: 0;
}
.computer-empty img.computer {
width: 100%;
}
<a target="_blank" href="http://www.safidrivingschool.co.uk" class="">
<div class="computer-screen">
<div class="screen-landing">
<img src="http://www.webnificent.co.uk/wp-content/uploads/graphics/safidrivingschool_capture.png" alt="Safi Driving School">
</div>
</div>
<img class="computer" src="http://www.webnificent.co.uk/wp-content/uploads/graphics/apple_montior.png" alt="computer">
</a>
See it on JSFiddle
Just a suggestion, it might be easier to use a computer screen with a totally black screen, such as this: Imac with Black Screen, just because in my example I had to fiddle with left, top, width and height just to make it fit into the white empty box of your computer screen. If you didn't have a specific box to fit into, you wouldn't have to worry about this & could just plonk your animated image scroll in the middle of the screen!
Just a thought!

Responsive Text Aligned Center on Image

I have created this layout for my blog posts and each post automatically gets posted there. I am quite happy with the setup I have, but I cannot for the life of me get the text centered (vertically) on the image (it already horizontally centered). Just wondering how others would approach this.
I have completely laid out the HTML and CSS here in a codepen. If you are interested in tweaking the code, I would appreciate if you based it off of the current css classes in the codepen. :)
Thanks in advance for your help and recommendations!
HTML:
<div id="blog-posts">
<div class="blog-post">
<a href="http://www.ericshio.com/2016/08/07/test-2/">
<img width="5472" height="3648" src="http://www.ericshio.com/wp-content/uploads/2016/08/IMG_0303.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="IMG_0303" srcset="http://www.ericshio.com/wp-content/uploads/2016/08/IMG_0303.png 5472w, http://www.ericshio.com/wp-content/uploads/2016/08/IMG_0303-300x200.png 300w, http://www.ericshio.com/wp-content/uploads/2016/08/IMG_0303-768x512.png 768w, http://www.ericshio.com/wp-content/uploads/2016/08/IMG_0303-1024x683.png 1024w" sizes="(max-width: 5472px) 100vw, 5472px" scale="0">
<h3>Test 2</h3>
</a>
</div>
<div class="blog-post">
<a href="http://www.ericshio.com/2016/08/07/hey-johnson/">
<img width="5472" height="3648" src="http://www.ericshio.com/wp-content/uploads/2016/08/macbook.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="macbook" srcset="http://www.ericshio.com/wp-content/uploads/2016/08/macbook.png 5472w, http://www.ericshio.com/wp-content/uploads/2016/08/macbook-300x200.png 300w, http://www.ericshio.com/wp-content/uploads/2016/08/macbook-768x512.png 768w, http://www.ericshio.com/wp-content/uploads/2016/08/macbook-1024x683.png 1024w" sizes="(max-width: 5472px) 100vw, 5472px">
<h3>Hey Johnson</h3>
</a>
</div>
</div>
CSS:
#blog-posts {
text-align: center;
display: inline-block;
max-width: 100%;
}
.blog-post {
width: 40%;
height: auto;
display: inline-block;
position: relative;
margin: 0.2em;
overflow: hidden;
}
.blog-post h3 {
font: 1em Cabin Sketch;
color: white;
width: 100%;
height: 100%;
line-height: 100%;
text-transform: uppercase;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: 0;
padding: 0;
font-size: 2em;
background-color: rgba(0,0,0,0.4);
opacity: 0;
-webkit-transition: opacity 0.6s;
-moz-transition: opacity 0.6s;
transition: opacity 0.6s;
vertical-align: middle !important;
}
.attachment-post-thumbnail {
position: relative;
width: 100%;
display: inline-block;
height: auto;
}
.blog-post:hover h3,
.blog-post h3:hover,
.blog-post .attachment-post-thumbnail:hover {
opacity: 1;
}
.blog-post:hover .attachment-post-thumbnail {
-webkit-filter: blur(1px);
opacity: 1;
}
I set padding-top to 30%. Check out the codepen:
http://codepen.io/anon/pen/mEQVZy

Custom CSS in Wordpress messing up

I'm managing the website of my company which is based on Wordpress and I try to figure out how to change my contact page.
I've made a codepen of what I want to do : http://codepen.io/EzhnoFR/pen/PNmdxm
html :
<img class="top" src="http://www.alabama-pub.com/wp-content/uploads/2016/03/Isa.png" />
<span>Hover</span>
</div>
<div id="cf">
<img class="bottom" src="http://www.alabama-pub.com/wp-content/uploads/2016/03/christine-chute.png" />
<img class="top" src="http://www.alabama-pub.com/wp-content/uploads/2016/03/christine-1.png" />
<span> Hover </span>
</div>
<div id="cf">
<img class="bottom" src="http://www.alabama-pub.com/wp-content/uploads/2016/03/cecile-chute.png" />
<img class="top" src="http://www.alabama-pub.com/wp-content/uploads/2016/03/cecile.png" />
<span> Hover </span>
</div>
</div>
css :
#cf img.top {
-webkit-filter: grayscale(80%);
filter: grayscale(80%);
}
#cf img.top:hover {
opacity:0;
}
span{
position: absolute;
bottom: -150px;
left: 0;
z-index: -1;
display: block;
width: 225px;
margin: 0;
padding: 0;
color: black;
font-size: 25px;
text-decoration: none;
text-align: center;
-webkit-transition: .7s ease-in-out;
transition: .7s ease-in-out;
opacity: 0;
}
#cf img.top:hover ~ span{
opacity: 1;
}
/*-----------------------------------------------------*/
.column {
margin: 15px 15px 0;
padding: 0;
}
.column:last-child {
padding-bottom: 90px;
}
.column::after {
content: '';
clear: both;
display: block;
}
.column div {
position: relative;
float: left;
width: 300px;
height: 200px;
margin: 0 0 0 50px;
padding: 0;
}
.column div:first-child {
margin-left: 0;
}
However, when I add this html to my page and the css in my wordpress custom css, it all mess up as you can see : http://www.alabama-pub.com/contact-new-test/
I've tried a lot of things but I can't get to fix it, does anyone has any idea ?
You have extra < br > under image tag which is causing the issue of height changes on hover.
According to other issue please remove z-index from span tag and you are done :)
see

Higher z-index does not change stacking order

What I am trying to do is, when the user hover on the image the image should reposition along the x-axis and it should reveal the .content. i have set z-index: 10 to image and z-index: 1 to .content to make .content to be underneath the image. but .content still remains on top of the image. Please help me..
Here is my code:
html
<div class="holder">
<img src="http://placehold.it/350x150" />
<div class="content">
<h3>hello there</h3>
view more
<div/>
</div>
css
.holder {
margin-top: 130px;
position: relative;
}
img {
display: block;
transition: -webkit-transform 0.5s;
transition: -moz-transform 0.5s;
z-index: 10;
}
.content {
background: blue;
height: 100%;
color: white;
z-index: 1;
position: absolute;
top: auto;
bottom: 0;
}
a {
color: white;
background: red;
padding: 10px;
}
.holder:hover img {
-webkit-transform: translateX(90px);
-moz-transform: translateX(90px);
}
Here I corrected issue of my code thanks to Jones G. Drange. As he pointed out in his comment
"z-index can only be modified in elements with a position other than static. Your img has position: static by default"
jsfiddle
img {
position: relative;
}