Text not disappearing properly - html

CSS
#articlebottom {
width: 980px;
height: 250px;
}
.products{
width:980px;
margin:0px auto;
padding-left:20px;
}
#articlebottom .imgWrap {
width:295px;
height:200px;
position:relative;
float:left;
margin:10px;
background:#333;
}
#articlebottom .imgWrap img {
position:absolute;
left:5px;
top:5px;
width:285px;
height:190px;
}
#articlebottom .imgDescription1 {
position: absolute;
left:0;
letter-spacing: 2px;
background-color: rgba(255, 250, 250, 0.2);
color: rgba(255, 250, 250, 0.2);
font-weight:bold;
font-size:18pt;
line-height: 50px;
width:100%;
height:50px;
opacity: 0;
text-align:center;
text-transform:uppercase;
transition:opacity 500ms ease-in-out, color 20ms ease-in-out,height 500ms ease-in-out;
}
#articlebottom .imgWrap:hover .imgDescription1 {
opacity: 1;
height:200px;
line-height:200px;
color: #1b9bff;
}
HTML
<article id="articlebottom">
<div class="products">
<div class="imgWrap">
<a href="Products/Camphor.aspx" target="_blank"><img src="Images/Camphor_b.JPG" alt="polaroid" />
<p class="imgDescription1">Camphor</p></a>
</div>
</div>
</article>
Fiddle
What I'm having:
The Text appears on the center when i hover and going to top after hover
What i need:
When i hover on the image the appropriate text shoould appear on the center and also need to disappear on center of the image itself

Updated Fiddle
The crucial part is moving
height:200px;
line-height:200px;
color: #1b9bff;
From:
#articlebottom .imgWrap:hover .imgDescription1
To:
#articlebottom .imgDescription1
Otherwise the position of the text is set to a default/inherited value and only set to centred on hover, hence why the hover state sees it jump.

Related

onclick Overlay effect

I just need to add a overlay effect on clicking the three dots. It should display a white background on top of that, transition should be from bottom.
I have attached the codepen link.
To preview your work...
Use this codepen link....
https://codepen.io/subin_s/pen/NVgLgx
HTML
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">
<div class="projects">
<div class="image">
</div>
<div class="words">
<h2>BlogSpire</h2>
<i class="fas fa-ellipsis-v" id="moreinfo"></i>
<div class="clearfix"></div>
<p>Blogging web app created for the Engineering team at WeSpire.</p>
</div>
</div>
CSS
* {
margin:0;
padding:0;
box-sizing:border-box;
}
body {
font-family:'Roboto';
}
.projects {
position:relative;
margin:2rem;
width: 335px;
height:400px;
background-color:#fff;
border-radius:5px;
box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16), 0 2px 10px 0 rgba(0,0,0,0.12);
}
.image {
position:absolute;
width:100%;
height:240px;
background-color:skyblue;
}
.words {
position:absolute;
top:240px;
padding:20px 20px 30px;
color:#333;
}
.words i {
position:absolute;
top:27px;
right:40px;
cursor:pointer;
}
.words h2 {
color:#008073;
}
.words p {
padding:13px 0 0;
}
JS
document.getElementById('moreinfo').addEventListener('click', projectInfo);
function projectInfo() {
}
You can add the overlay by adding a element commonly a div inside of your card, and setting its position to absolute. You can position it around using the top, left, bottom or right attributes.
To create the animation of the overlay comming from the bottom, you can create a simple css transition, changing the values of the top css attribute.
I've edited your code to create a small example on top of it. I hope it helps you.
const moreInfoElement = document.getElementById('moreinfo');
const overlay = document.getElementById('overlay');
moreInfoElement.addEventListener('click', projectInfo);
function projectInfo() {
overlay.classList.add('active-overlay');
setTimeout(() => {
overlay.classList.remove('active-overlay');
}, 3000);
}
* {
margin:0;
padding:0;
box-sizing:border-box;
}
body {
font-family:'Roboto';
}
.projects {
position:relative;
margin:2rem;
width: 335px;
height:400px;
background-color:#fff;
border-radius:5px;
box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16), 0 2px 10px 0 rgba(0,0,0,0.12);
overflow: hidden;
}
.image {
position:absolute;
width:100%;
height:240px;
background-color:skyblue;
}
.words {
position:absolute;
top:240px;
padding:20px 20px 30px;
color:#333;
}
.words i {
position:absolute;
top:27px;
right:40px;
cursor:pointer;
}
.words h2 {
color:#008073;
}
.words p {
padding:13px 0 0;
}
.overlay{
position: absolute;
width: 100%;
height: 100%;
top: 100%;
background-color: rgba(255, 255, 255, 0.9);
z-index: 1;
transition: all .6s;
}
.active-overlay{
top: 0;
}
<link href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" rel="stylesheet"/>
<div class="projects">
<div id="overlay" class="overlay">
Some text
</div>
<div class="image">
</div>
<div class="words">
<h2>BlogSpire</h2>
<i class="fas fa-ellipsis-v" id="moreinfo"></i>
<div class="clearfix"></div>
<p>Blogging web app created for the Engineering team at WeSpire.</p>
</div>
</div>

Div element to fade out and <p> element in DIV to fade in

I have image box that on hover, image goes to 0.5 opacity, and the text inside a DIV have to go from visibility:hidden to go to visibility:visible'. But I am struggling with figuring out how to do it.
#edno {
background-image:url(" ../../CONTENT/Images/a.png");
background-size:100%;
background-repeat:no-repeat;
background-position:center;
transition: 0.2s linear;
}
#edno:hover {
background-size:200%;
background-position:center;
opacity:0.5;
}
#edno .imee {
font-family:futuraat;
font-size:35px;
padding-top:204px;
visibility:hidden;
color:black;
}
#edno:hover .imee {
font-family:futuraat;
font-size:35px;
padding-top:204px;
visibility:visible;
color:black;
}
<a href="../../producti/sekcionni/1/index.html">
<div class="figure" id="edno">
<p class="imee">СТЪЛБИЧКА</p>
</div>
</a>
Everything that happens is that Everything goes on:
opacity:0.5
I want the text to pop in when hover the div.
I have image box that on hover, image goes to 0.5 opacity, and the text inside a DIV have to go from visibility:hidden to go to visibility:visible but I am struggling with figuring out how to do it.
Seems to work fine as is? The text IS doing that upon hover.
#edno {
background-image:url("https://placehold.it/300x150");
background-size:100%;
background-repeat:no-repeat;
background-position:center;
transition: 0.2s linear;
}
#edno:hover {
background-size:200%;
background-position:center;
opacity:0.5;
}
#edno .imee {
font-family:futuraat;
font-size:35px;
padding-top:204px;
visibility:hidden;
color:black;
}
#edno:hover .imee {
font-family:futuraat;
font-size:35px;
padding-top:204px;
visibility:visible;
color:black;
}
<a href="../../producti/sekcionni/1/index.html">
<div class="figure" id="edno">
<p class="imee">СТЪЛБИЧКА</p>
</div>
</a>
Here is some working code, just use a little jQuery to trigger a toggle and VOILA!
CSS:
#edno {
position: relative;
margin: auto;
background-color: red;
width:300px;
height: 200px;
transition: 0.2s linear;
}
#edno:hover {
background-size:200%;
background-position:center;
opacity:0.5;
}
.imee {
position: relative;
text-align: center;
top: -360px;
font-family:futuraat;
font-size:35px;
padding-top:204px;
display: none;
color:black;
}
.show
{
display: block;
}
HTML:
<a href="#">
<div class="figure" id="edno"></div>
<p id="fadeIn" class="imee">СТЪЛБИЧКА</p>
</a>
jQUERY:
$(document).ready(function()
{
$("#edno").hover(function()
{
$(".imee").toggleClass("show");
});
});

How can I place this div next to the other one?

I was wanting to make a website, just to see if I like doing it and how it would turn out, but I can't seem to get this part done. I want the "informatie" div to be next to the "vertmenu" div and make it fill up the white part and I want the "vertmenu" div to extend till the "voetregel" div. I have no idea how to get this done and I have already tried changing the width and height to percentages, changing the positions to absolute/relative and adding a float property, but I couldn't make it how I wanted it to be. So my question in short, how can I make the "informatie" div next to the "vertmenu" div and make it fill up the white part and get the "vertmenu" div to extend till the "voetregel" div.
body {
margin:0;
padding:0;
background-color:#ffffff;
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
}
#hormenu {
background-color: rgba(0, 0, 0, 0.5);
position:relative;
text-align: center;
width:100%;
height:15%;
line-height:50px;
font-size:100%;
}
#vertmenu {
background-color: rgba(255,0,0, 0.3);
position:relative;
height:100px;
top:15%;
width:15%;
margin:0px 0px 0px 0px;
padding:3px;
overflow:hidden;
}
#informatie {
background-color: rgba(0,0,255, 0.3);
position:relative;
float:left;
height:100%;
width:85%;
left: calc(15% + 6px);
margin:0px 0px 0px 0px;
padding:3px;
overflow:hidden;
}
#voetregel {
background-color: rgba(0,255,0, 0.3);
position:fixed;
width:100%;
height:100px;
top:auto;
right:0;
bottom:0;
margin-left:10px
}
a.hormenu_item {
margin: 10px;
transition: color 0.3s, text-shadow 0.3s, text-decoration-line 0.3s, font 0.3s ease-in-out;
}
a:link.hormenu_item {
color: white;
text-decoration: none;
}
a:visited.hormenu_item {
color: white;
text-decoration: none;
}
a:hover.hormenu_item {
color: gold;
text-decoration:none;
text-shadow: 0px 0px 7px gold;
font-size: 30px;
}
#informatie h1, #vertmenu h1, #voetregel h2 {
color:#FF0000;
font-size:20px;
}
<body>
<div id="hormenu">
Home
Biografie
Features
Contact
</div>
<div id="vertmenu">
<h1>vertmenu</h1>
</div>
<div id="informatie">
<h1>informatie</h1>
</div>
<div id="voetregel">
<h2>voetregel</h2>
</div>
</body>
apply float:left; css in #vertmenu and #informatie
and dont use position:fixed; in #voetregel use clear:both; it will clear the float effect of above 2 div tags
position:fixed; is used for creating menubar in web site so that even with the scrolling that menubar stays at same place
You can add display: inline-block to make them next to each other. Remove position:fixed from #voetregel too.
#vertmenu {
background-color: rgba(255,0,0, 0.3);
width:15%;
margin:0px 0px 0px 0px;
}
#informatie {
background-color: rgba(0,0,255, 0.3);
width:85%;
margin:0px 0px 0px 0px;
}
#voetregel {
background-color: rgba(0,255,0, 0.3);
width:100%;
height:200px;
}
#vertmenu,
#informatie {
display: inline-block;
float: left;
}
#informatie h1,
#vertmenu h1,
#voetregel h2 {
color:#FF0000;
font-size:20px;
}
<div id="vertmenu">
<h1>vertmenu</h1>
</div>
<div id="informatie">
<h1>informatie</h1>
</div>
<div id="voetregel">
<h2>voetregel</h2>
</div>

How do I set a partially transparent background on a div?

I want the divs to be partially transparent so that the background can be seen through, but want the other elements <p> not to be transparent as they are in the image. Currently I am using opacity: .4.
HTML
<!-- tarifas starts here-->
![<div class="tarifas">
<h1>Tarifas</h1>
<h3>Consigue la máxima experiencia sin preocuparte por el roaming</h3>
<div class="tarifas_left">
<div class="tarifas_left_top">
<p>5€<span>/día</span></p>
</div>
<div class="tarifas_left_bottom">
<p>hasta<span>1Gb</span>/día</p>
<p>router wifi movil</p><button>
<p>RESERVAR</p></button>
</div>
</div>
<div class="tarifas_right">
<div class="tarifas_right_top">
<p>30€<span>/mes</span></p>
</div>
<div class="tarifas_right_bottom">
<p>hasta<span>7Gb</span>/día</p>
<p>router wifi movil</p><button>
<p>RESERVAR</p></button>
</div>
</div>
</div>
CSS
tarifas {
background:url(image/air_image1.jpg) no-repeat scroll 0 -332px rgba(0,0,0,0);
height:460px;
position:relative;
width:100%
}
.tarifas h1 {
font-size:40px;
color:#fff;
margin-left:500px;
margin-top:28px;
position:absolute;
font-family:HelveticaNeue-Light
}
.tarifas h3 {
font-size:24px;
color:#fff;
margin-left:232px;
margin-top:100px;
position:absolute;
font-family:HelveticaNeue-Light
}
.tarifas_left_top {
position:absolute;
width:285px;
height:80px;
background-color:#AEABA1;
margin-top:150px;
margin-left:290px;
border-radius:10px 10px 0 0;
opacity:.4;
border:2px solid #fff
}
.tarifas_left_bottom {
position:absolute;
width:285px;
height:170px;
background-color:#AEABA1;
margin-top:237px;
margin-left:290px;
border-radius:0 0 10px 10px;
opacity:.4;
border:2px solid #fff
}
.tarifas_left_top p {
font-size:67.48px;
color:#fff;
text-align:center;
font-family:HelveticaNeue-Light;
opacity:1
}
.tarifas_left_top p span {
font-size:12px;
color:#fff;
font-family:HelveticaNeue-Light
}
.tarifas_left_bottom p:nth-child(1) {
font-size:12px;
color:#fff;
text-align:center;
font-family:HelveticaNeue-Light
}
.tarifas_left_bottom p:nth-child(1) span {
font-size:24px;
color:#fff;
font-family:HelveticaNeue-Light
}
.tarifas_left_bottom p:nth-child(2) {
font-size:24px;
color:#fff;
text-align:center;
font-family:HelveticaNeue-Light
}
.tarifas_left_bottom button {
border-radius:10px;
color:#fff;
font-size:20px;
height:39px;
margin-left:65px;
margin-top:55px;
width:155px;
font-family:HelveticaNeue-Light;
opacity:1
}
.tarifas_right_top {
position:absolute;
width:285px;
height:80px;
background-color:#AEABA1;
margin-top:150px;
margin-left:600px;
border-radius:10px 10px 0 0;
opacity:.4;
border:2px solid #fff
}
.tarifas_right_bottom {
position:absolute;
width:285px;
height:170px;
background-color:#AEABA1;
margin-top:237px;
margin-left:600px;
border-radius:0 0 10px 10px;
opacity:.4;
border:2px solid #fff
}
.tarifas_right_top p {
font-size:67.48px;
color:#fff;
text-align:center;
font-family:HelveticaNeue-Light
}
.tarifas_right_top p span {
font-size:12px;
color:#fff;
font-family:HelveticaNeue-Light
}
.tarifas_right_bottom p:nth-child(1) {
font-size:12px;
color:#fff;
text-align:center;
font-family:HelveticaNeue-Light
}
.tarifas_right_bottom p:nth-child(1) span {
font-size:24px;
color:#fff;
font-family:HelveticaNeue-Light
}
.tarifas_right_bottom p:nth-child(2) {
font-size:24px;
color:#fff;
text-align:center;
font-family:HelveticaNeue-Light
}
.tarifas_right_bottom button {
border-radius:10px;
color:#fff;
font-size:20px;
height:39px;
margin-left:65px;
margin-top:55px;
width:155px;
font-family:HelveticaNeue-Light;
opacity:1
}
and the screenshot:
Use rgba colors rather than opacity which affects the children of an element.
So for instance
background-color: #AEABA1
opacity: .4
would translate into:
background-color: rgba(174, 171, 161, 0.4)
You can find a HEX to RGBA convertor here
For the classes .tarifas_left_top and .tarifas_left_bottom, remove the opacity and instead use background-color: rgba(#,#,#,#). For the background color #AEABA1 with opacity 0.4, this translates to background-color: rgba(174,171,161,0.4).
For IE 8 and below, you'll need to override the background with a filter property.
.tarifas_left_top {
background-color: rgba(174,171,161,0.4);
background: transparent\9;
/* This '\9' is intentional. It's a CSS hack, but
it works, and it resets the background in IE 8
and below only. */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#66AEABA1,endColorstr=#66AEABA1);
zoom: 1;
}
Effectively, this gives you cross-browser semi-transparent backgrounds without affecting the opacity of the element's children. These properties can also be used for the border-color and color properties.

How to realize a fixed-width div with scrolling content on hover?

I am trying to create a div containing 2 divs: one for a cover img and the other div with some text.
I would love to show only the image and move it away on hover to show the text.
I wrote this code using absolute positioning and css transitions but there's something wrong.
It works great in Chrome but it doesn't in Firefox.
http://jsfiddle.net/5NHh2/4/
Could someone help me?
I think the problem is the overflow:hidden set to the main div.
Thank you very much
This is the html code:
<div class="container">
<div class="info-box">
<a href="#" title="">
<div class="cover">
<img src="http://placehold.it/180x267" />
</div>
<div class="info">
<h5>A Title</h5>
<p>Some text</p>
</div>
</a>
</div>
<div>​
And this is the css:
.container {
background:#000;
text-align:center;
padding:10px;
}
.info-box{
text-align:left;
overflow:hidden;
position:relative;
background:#ddd;
display:inline-table;
margin:0 10px 10px;
}
.info-box,
.info-box img,
.info-box .cover {
width:180px;
height:267px;
}
.info-box a {
text-decoration:none;
color:#333;
display:block;
position:absolute;
top:0;
left:0;
width:180px;
height:534px;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.info-box .info {
box-shadow:inset 0 0 2px #000;
}
.info-box a:hover{
top:-267px;
}
.info-box .info {
width:160px;
height:247px;
padding:10px;
position:relative;
}
.info {
text-shadow:0 1px 0 #fff;
}
.info-box .info h5 {
font-family:'Trebuchet MS',Arial,sans-serif;
overflow:hidden;
white-space:nowrap;
text-overflow:ellipsis;
margin-bottom:10px;
}
Added .container, .info-box {overflow:hidden;} to the end.
Works in firefox for me here: http://jsfiddle.net/5NHh2/5/