Table: how to change pictures on mouseover on single rows? - html

I'm working on a website and I've to create a table with a mouse over effect the effect is only when you go with the mouse on the picture and only on the PDF icon.
What I need now is to apply this effect when you go with the mouse on the single table rows. How can I do it?
HTML:
<td class="thumbnail-item" data-th="PDF"><img src="http://salmenpark-test.nowcommu.myhostpoint.ch/wp-content/uploads/2015/07/pdf.png" alt="PDF" height="24" width="24">
<div class="tooltip">
<img src="qh_1.png" alt="" width="570" height="403" />
<span class="overlay"></span>
<span class="overlay"></span>
</div></td>
CSS :
.thumbnail-item {
/* position relative so that we can use position absolute for the tooltip */
display: inherit;
height: 10px;
max-width: 5px;
}
.thumbnail-item a {
display: block;
}
.tooltip {
/* by default, hide it */
display: none;
/* allow us to move the tooltip */
position: absolute;
/* align the image properly */
padding: 8px 0 0 8px;
z-index: 500;
top: 7px;
left: -8px !important;
max-width: 570px !important;
max-height: 403px !important;

Antionio:
CSS:
.thumbnail-item {
/* delete the line that was here for inheriting the display * /
height: 10px;
max-width: 5px;
}
HTML:
<tr class="thumbnail-item white">...</tr>
<tr class="thumbnail-item grey">...</tr>
etc, etc.
You were adding the "thumbnail-item" css reference to the <td>tag which represents a cell of data. You want the "thumbnail-item" css reference to be on the entire row, so it should be on each <tr> tag instead.

In your Jquery code, use the class of your td.hover function and try with the below code.
$(".thumbnail-item").hover(function() {
//Write your js code what you have written for hover pdf image
});
It would be better for us to understand if you post your jquery code as well.

Related

Is an iframe considered an empty element even if it is showing an internal page within it?

Another week, another question I'm afraid. I've searched but I can't find an appropriate fix for this. I have an svg image with a number of areas in and I want to show a new iframe, which I have wrapped in a div, on top of the existing content when the links in the svg image are clicked. The div will be the same each time but the content of the iframe will be sourced from a different internal page for each link clicked.
The link part of this seems to work as I have removed the 'display:none' from the '.ifallc:empty' and I can see the iframe in the div is being populated when I click the links.
The problem is that when I add '.ifallc:empty {display: none;}' the iframe disapears on page refresh but it does not come back when I click the link to populate the iframe.
My question is, is an iframe with content from another page loaded still considered empty?
And if it is is there a simple way around this?
There are going to be a lot of data in the links and I am trying to prevent all the data on the linked pages from loading before it needs to be.
I hope there is enough code here to see whats going on.
box-sizing: border-box;
position: absolute;
top: -.2rem;
left: -.1rem;
z-index: 2;
/*background-color:#93c6e2;*/
border: .15rem solid #222;
border-bottom-right-radius: 0.5rem;
background: rgb(85, 85, 85);
height: auto;
width: auto;
max-width: 70%;
/* display: auto; */
/* background: linear-gradient(rgb(85, 85, 85),rgb(255, 255, 255)); */
/* display: none; /* FOR USE WHEN REQUIRED */
}
.ifallc { /*the iframe*/
display: auto;
box-sizing: border-box;
margin: auto;
border: auto;
}
.ifallc:empty {
display: none;
}
<a href="peif.html" target="ifall">
<path id="pe" class="landxx pe" d="m 649.707,798.409 c 0.997,-2.059 1.546,-3.468 3.113,-5.222 0.7,-0.783 1.24,-1.722 2.086,-2.366 0.613,-0.467 1.945,-1.093 2.001,-1.993 0.994,0.284 2.042,4.348 1.178,4.856 -0.629,0.37 -1.347,0.04 -1.8,0.682 -0.517,0.735 -0.401,1.737 0.622,1.882 -0.845,1.126 -0.609,2.552 0.724,1.115 1.17,-1.261 1.759,-0.377 2.87,0.565 0.952,0.808 2.042,-0.417 2.792,0.799 0.77,1.25 0.795,3.32 2.582,3.657 1.509,0.285 1.604,0.206 2.036,-1.463 2.884,-11.149 5.237,-15.065 1.92,-2.984 -0.482,1.754 0.515,-3.174 1.261,-4.859 0.383,-0.866 0.687,-1.349 0.701,-2.345 0,-0.632 0.957,-2.523 1.315,-0.825 0.241,-0.39 0.288,-0.8 0.141,-1.229 -0.06,-0.553 0.75,-1.151 1.045,-1.542 0.768,-1.021 1.729,-1.778 2.888,-2.309 2.522,-1.156 5.474,-1.581 7.776,-3.179 4.842,-3.362 8.195,-8.395 9.248,-14.131 0.394,0.417 0.873,0.583 1.439,0.5 -0.713,-1.66 0.03,-3.129 -0.958,-4.546 -0.39,-0.558 -2.329,-2.255 -2.209,-2.944 0.817,0.139 1.77,0.418 2.544,-0.04 0.767,-0.454 0.524,-0.602 1.389,-0.281 1.492,0.553 2.596,1.145 3.626,2.386 1.339,1.615 2.096,2.211 2.737,4.276 0.268,0.861 -0.07,1.565 1.122,1.668 1.151,0.1 0.85,0.56 1.646,1.271 1.544,1.381 2.681,0.646 3.219,3.003 0.417,1.826 0.339,2.265 2.286,2.848 2.098,0.628 0.117,3.076 1.188,4.296 0.581,0.661 1.487,0.886 2.335,0.851 0.529,-0.07 1.061,-0.118 1.595,-0.142 0.708,0 1.535,0.418 2.163,0.396 1.443,-0.05 3.152,-1.094 3.778,-2.353 0.661,-1.329 2.487,1.212 3.277,1.273 1.191,0.09 3.102,-1.774 3.95,-1.153 0.677,0.496 1.202,1.391 1.854,1.838 0.626,0.43 2.098,0.313 2.483,0.722 1.574,1.67 1.598,2.272 0.368,4.22 -0.985,1.56 -2.899,4.229 -3.172,6.044 -0.327,2.171 2.174,0.471 3.113,1.291 0.758,0.661 1.318,1.568 1.885,2.39 0.273,0.395 0.584,0.579 0.447,0.907 -0.09,0.7 -0.704,0.938 -1.131,0.151 -0.193,0.24 -0.386,0.48 -0.58,0.72 -1.122,-1.524 -3.609,-2.516 -5.024,-0.729 -1.613,2.038 -5.125,1.5 -7.443,2.114 -1.214,0.322 -1.801,1.67 -3.004,2.045 -1.264,0.395 -0.853,0.902 -1.695,1.66 -2.018,1.819 -3.416,1.297 -3.446,4.415 -0.01,1.081 0.06,1.987 -0.578,2.928 -0.603,0.895 -1.323,1.792 -1.083,2.939 0.249,1.19 1.275,2.882 -0.06,3.8 -1.119,0.771 -2.177,1.165 -3.094,2.24 -0.669,0.784 -1.017,1.675 -0.803,2.708 0.115,0.5 0.289,0.981 0.521,1.44 -0.559,0.243 -1.14,0.548 -1.561,1.001 -1.624,1.748 3.168,3.265 1.201,4.468 1.003,0.655 1.697,1.851 1.909,3.015 0.124,0.681 0.593,0.918 1.085,1.315 0.616,0.496 0.558,1.252 0.965,1.87 0.715,1.083 2.093,1.593 2.595,2.847 0.599,1.495 -0.55,2.408 -1.371,3.483 1.777,0.93 4.389,0.09 6.154,1.267 1.146,0.761 2.204,2.739 1.766,4.133 2.387,0.3 5.447,0.817 7.57,-0.636 1.34,-0.917 3.087,-4.232 4.891,-4.254 -0.211,0.867 -0.885,0.911 -0.355,1.807 0.562,0.951 -0.378,1.9 -0.318,2.986 0.154,2.824 0.251,5.72 0.593,8.527 0.927,-0.813 1.554,0.849 2.52,0.755 1.332,-0.13 2.266,-1.179 3.635,-1.167 1.306,0.01 2.252,-0.139 2.632,1.152 0.578,1.961 1.963,3.579 2.957,5.368 1.001,1.801 1.998,3.604 3.028,5.39 0.896,1.552 1.69,2.53 0.221,3.63 -1.295,0.969 -1.448,2.719 -0.977,4.115 0.408,1.205 0.109,2.815 0.177,4.988 0.03,0.937 1.17,2.128 1.211,3.1 0,0.06 -0.833,2.366 -0.9,2.427 -0.876,0.792 -1.396,2.227 -1.803,3.332 -0.744,2.019 1.247,2.191 1.252,3.76 0,1.114 -0.73,1.573 -0.938,2.653 -1.168,-0.801 -3.788,-3.527 -4.288,-1.497 -0.345,1.4 0.301,0.92 0.45,2.673 0.08,0.2 -1.168,-1.154 -0.666,-0.728 -0.01,0.296 -1.669,1.773 1.288,2.819 0.105,-1.402 1.81,0.859 2.605,0.633 0.456,-0.13 0.218,0.509 0.128,1.573 0.91,0.263 2.526,0.709 2.673,0.135 0.121,0.02 0.846,0.116 1.051,0.271 -0.585,3.217 -0.181,2.501 0.257,2.863 -0.323,0.668 0.139,0.516 -0.322,1.114 -0.792,1.028 -1.505,2.592 -2.458,3.539 -0.415,0.412 -0.99,0.631 -1.318,1.134 -0.602,0.923 0.647,0.492 0.808,1.265 0.207,0.991 0.606,0.956 0.253,1.399 -5.734,7.2 -1.924,0.984 -2.163,1.487 -0.536,1.129 0.861,2.579 0.105,3.875 -0.651,1.116 -2.026,1.511 -3.241,1.511 -1.364,0 -2.414,-1.019 -3.339,-1.891 -1.091,-1.027 -2.285,-1.508 -3.465,-2.344 -2.094,-1.483 -1.937,-4.181 -4.447,-5.211 -2.971,-1.22 -4.973,-4.122 -8.118,-4.896 -1.472,-0.362 -2.984,-1.379 -4.263,-2.175 -1.531,-0.952 -3.187,-1.271 -4.747,-2.112 -1.527,-0.825 -2.823,-2.085 -4.354,-2.957 -1.722,-0.98 -3.437,-1.941 -5.176,-2.894 -1.469,-0.805 -2.354,-2.651 -3.51,-3.84 -1.532,-1.576 -3.691,-2.404 -4.762,-4.36 -0.604,-1.104 -1.373,-2.43 -2.433,-3.095 -0.927,-0.582 0.304,-2.806 -1.32,-2.526 0.02,-0.281 0.09,-0.548 0.216,-0.8 0.242,0.144 0.482,0.291 0.72,0.44 0.64,-3.198 -0.743,-4.856 -2.346,-7.476 -1.456,-2.38 -2.445,-4.897 -4.486,-6.832 -0.612,-0.581 -1.237,-0.887 -1.07,-1.682 0.192,-0.915 -0.344,-1.942 -0.781,-2.704 -0.429,-0.749 -0.948,-1.552 -1.613,-2.117 -0.612,-0.521 -1.657,-0.768 -2.046,-1.526 -0.05,-0.397 -0.01,-0.791 0.107,-1.18 -0.121,-0.863 -0.668,-1.851 -1.061,-2.615 -0.753,-1.465 -1.781,-2.763 -2.616,-4.179 -0.787,-1.334 -1.229,-2.932 -1.786,-4.369 -1.3,-3.356 -3.396,-5.94 -4.338,-9.185 -1.287,-4.429 -5.048,-7.125 -6.755,-11.5 -1.953,-5.004 -5.991,-8.57 -10.887,-10.634 -0.431,-0.182 -2.046,-0.57 -2.101,-1.167 -0.08,-0.832 -0.251,-2.22 0.944,-2.072 2.126,0.264 1.319,-1.746 0.631,-2.793 -0.971,-1.477 -1.937,-2.094 -1.988,-3.931 0.197,-0.236 0.389,-0.476 0.576,-0.72 -0.04,-0.28 -0.885,-1.054 -1.074,-1.268 -0.994,-1.12 -0.386,-1.78 -0.802,-3.047">
<title>First</title>
</path>
</a>
<div class="miscbar"><iframe name="ifall" class="ifallc"></iframe></div>```
As per the specification, the :empty pseudo-class matches elements that has no children. By children, it means it could either be an element or just text.
If you defined your iframe like this:
<iframe src="//example.com"></iframe>
It will be counted as empty. (see jsfiddle)
However, if you start adding texts inside:
<iframe src="//example.com">No iframe support</iframe>
It will not be considered empty. (see jsfiddle)
I managed it :) I put an empty header in the wrapper div (misc bar) which contains the iframe and removed the line height and visibility of the header. Then I sent some text to that header at the same time the iframe is populated. I can now add border and background to the contents of the html which will only appear when the link is clicked.
<a href="peif.html" target="ifall" onclick="document.getElementById('miscbartitle').innerHTML = 'Enjoy'">
.miscbar { /*the outer div*/
box-sizing: border-box;
position: absolute;
top: -.2rem;
left: -.1rem;
z-index: 2;
/*
border: .15rem solid #222;
border-bottom-right-radius: 0.5rem;
background: rgb(85, 85, 85);
height: auto;
width: auto;
max-width: 70%;
*/
margin: 0;
padding: 0;
border: none;
}
.ifallc { /*the iframe*/
display: auto;
box-sizing: border-box;
margin: auto;
border: auto;
border: none;
}
#miscbartitle {
visibility: hidden;
line-height: 0;
}

linkable image with a mouseover text

I wanted to make this linkable image to have a text in a pop up box (not the type of pop up that is on w3schools, I want a classic yellowish box) when I mouseover. I tried to do it like this
<div class="folder1">
<a href="yourlinkhere" target="_self" >
<img src="https://78.media.tumblr.com/c00202bad8ae39931e34a7efa861d18b/tumblr_p70bjja6xI1x5vw3ao1_500.png" height="46" width="57"
title="This is some text I want to display." </a>
</div>
Opening the page in the link works great but there is no pop up box when I hover on it. Any help?
Currently, you are setting the title attribute to get a tooltip type hint when the element is hovered over. If this is what you are looking to do but perhaps just style the textbox to be, say, yellow, I would suggest using the following:
a {
color: #900;
text-decoration: none;
}
a:hover {
color: red;
position: relative;
}
a[data]:hover:after {
content: attr(data);
padding: 4px 8px;
color: rgba(0,0,0,0.5);
position: absolute;
left: 0;
top: 100%;
white-space: nowrap;
z-index: 2;
border-radius: 5px ;
background: rgba(0,0,0,0.5); /*Change this to yellow, or whatever background color you desire*/
}
<a data="This is the CSS tooltip showing up when you mouse over the link"href="#" class="tip">Link</a>
The above code was provided by Peeyush Kushwaha in this post. Simply change the anchor tag to your image tag, and apply styles as you see fit.
If by 'popup' you are looking for an alert to the user that requires interaction to close, you can use window.alert('text') in javascript in conjunction with the onmouseover event handler.
<img src="some_image.png" height="46px" width="57px" onmouseover="window.alert('Some Message')"/>
Otherwise, if you are looking for another element to be displayed upon mouseover of the image, you can use a bit of javascript to display a div or paragraph (really anything) upon mouseover of the img.
function showDiv() {
document.getElementById('popupBox').style.display = 'block';
}
#popupBox {
display: none;
}
<img src="some_image.png" width="41px" height="57px" onmouseover="showDiv()"/>
<div id="popupBox">Some Popup Text</div>
You can do this simply with CSS, or you can use one of many simple 'tooltip' JavaScript options. Bootstrap for example has this tooltip functionality built-in, ready to use. If you want something basic, here's a simple CSS-only approach that you can customise to your needs:
<!-- padding added here so you can see the pop-up above the folder, not necessary in-page -->
<div class="folder1" style="padding: 200px;">
<a href="yourlinkhere" target="_self" class="popper">
<img src="https://78.media.tumblr.com/c00202bad8ae39931e34a7efa861d18b/tumblr_p70bjja6xI1x5vw3ao1_500.png" height="46" width="57" />
<span class="pop-up">This is some text I want to display.</span>
</a>
</div>
<style>
a.popper {
display: inline-block;
position: relative;
}
.pop-up {
display: none;
position: absolute;
left: 0;
bottom: 100%;
padding: 1rem 1.5rem;
background: yellow;
color: black;
}
a.popper:hover .pop-up,
a.popper:focus .pop-up {
display: block;
}
</style>
Basically, you position the a tag relatively so that it can have absolutely positioned children, then relying on a:hover you show / hide the child using the child element's display property.
You can equally try this using css pseudo-element
a{
position: relative;
}
a:hover:after{
display:block;
content: "This is some text I want to display";
width: 200px;
background: yellow;
position: absolute;
top:0;
padding: 20px;
}
<div class="folder1" style="margin: 70px">
<a href="yourlinkhere" target="_self" class="">
<img src="https://78.media.tumblr.com/c00202bad8ae39931e34a7efa861d18b/tumblr_p70bjja6xI1x5vw3ao1_500.png" height="46" width="57"
</a>
</div>

CSS notification style badge over image

I'm attempting to place a 'notification' style badge over an images. I am using Twitters Bootstrap as a base framework and creating a custom CSS class called notify-badge. But I cannot get anything to line up properly.
Through the magic of Photoshop, here is what I am trying to accomplish.
Here is my CSS code.
.notify-badge{
position: absolute;
background: rgba(0,0,255,1);
height:2rem;
top:1rem;
right:1.5rem;
width:2rem;
text-align: center;
line-height: 2rem;;
font-size: 1rem;
border-radius: 50%;
color:white;
border:1px solid blue;
}
I would like to be able to place any small about of text in the badge and it expand the red circle to fit.
Here is my HTML code.
<div class="col-sm-4">
<a href="#">
<span class="notify-badge">NEW</span>
<img src="myimage.png" alt="" width="64" height="64">
</a>
<p>Some text</p>
</div>
Bunch of different ways you can accomplish this. This should get you started:
.item {
position:relative;
padding-top:20px;
display:inline-block;
}
.notify-badge{
position: absolute;
right:-20px;
top:10px;
background:red;
text-align: center;
border-radius: 30px 30px 30px 30px;
color:white;
padding:5px 10px;
font-size:20px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-sm-4">
<div class="item">
<a href="#">
<span class="notify-badge">NEW</span>
<img src="https://picsum.photos/200" alt="" />
</a>
</div>
</div>
Addendum (from the Asker #user-44651)
(moved from the question)
Here is the result of applying this answer.
Adding margin-top:-20px; to .item fixed the alignment issue.
The idea here is to overlay an absolute container on top of a relative one. Here's a similar example:
<div class="image">
<img src="images/3754004820_91a5c238a0.jpg" alt="" />
<h2>A Movie in the Park:<br />Kung Fu Panda</h2>
</div>
The CSS:
.image {
position: relative;
width: 100%; /* for IE 6 */
}
h2 {
position: absolute;
top: 200px;
left: 0;
width: 100%;
}
This is going to put our text right up on top of the image nicely, but it doesn't accomplish the box we want to achieve behind the text. For that, we can't use the h2, because that is a block level element and we need an inline element without an specific width. So, wrap the h2 inside of a span.
<h2><span>A Movie in the Park:<br />Kung Fu Panda</span></h2>
Then use that span to style and text:
h2 span {
color: white;
font: bold 24px/45px Helvetica, Sans-Serif;
letter-spacing: -1px;
background: rgb(0, 0, 0); /* fallback color */
background: rgba(0, 0, 0, 0.7);
padding: 10px;
}
For ideas on how to ensure proper spacing or to use jQuery to cleanup the code a bit by allowing you to remove some of the tags from the code and jQuery them back in, check the source.
Here's a fiddle I made with the sample code:
https://jsfiddle.net/un2p8gow/
I changed the notify-badge span into a div. I saw no reason it had to be a span.
I changed the position to relative. Edit - you could actually keep the attribute position: absolute; provided you know what you're doing with it. Guy in the comments was right.
You had the attribute right: 1.5rem; and I simply changed it to left because it was being inset in the opposite direction of your example.
You can tweak it further but in a vacuum this is what you want.

Using position:absolute while keeping it inside the document flow

It's a screenshot from a page currently I'm building. I'm trying to make sure the green button is always on the bottom of the container. Here is a piece of the code:
HTML
<div class="list-product-pat">
<article>
<!-- title, image, spec ... -->
<div class="pricing-pat">
<!-- the button goes here -->
</div>
</article>
</div>
CSS
.list-product-pat article {
position: relative;
min-height: 260px;
}
.list-product-pat .pricing-pat {
position: absolute;
bottom: 0;
width: 100%;
}
So far there is no problem... until the product spec gets too long and it breaks into the green button.
I want to maintain the green button in the most bottom position, but in the same time I also want the height to extend if the product title/product spec gets too long.
In the ideal world, it should be something like this:
So my idea is to maintain the absolute positioning while still keeping it inside the document flow (so the product spec knows the green button is there and doesn't break through it).
I need it only to extend if the spec height gets too long. In other words, if the spec is in normal height, it wouldn't extent. I'd like to avoid a weird gap between the spec and the green button.
Is there any idea how to do it?
Here is a fiddle to see how I did it: http://jsfiddle.net/xaliber/xrb5U/
Adding position:absolute takes it out of the document flow, there's no way to keep it in it.
But you can add padding-bottom equivalent to height of the button to the article container instead, which will prevent long text overrunning the button.
.list-product-pat article {
position: relative;
min-height: 260px;
padding-bottom:80px;
-moz-box-sizing:border-box;
box-sizing:border-box;
}
http://jsfiddle.net/xrb5U/3/
A separate issue is that two containers with different amount of texts will be different sizes (if one is larger than the min-height set). There's no easy fix for this in CSS positioning, you have to resort to Javascript, Flexbox or display:table-cell to keep the height of all them the same but each of them has their own issues too.
As #mikel already pointed out, you can't keep an element with position: absolute inside the normal document flow, but you can workaround this problem by simulating it.
Considering the example below:
img {
position: absolute;
}
<img src="https://dummyimage.com/300x400/d9ca29/ffffff">
<span>Lorem Ipsum is simply dummy text of the printing and typesetting industry</span>
The <img> element is out of flow, this cause the <span> to be hidden behind it.
You can wrap the absolute element inside an empty container, then add height and width to container equal to height and width of the absolute element. By doing so, an invisible box is created around the absolute element, which makes it appear as part of the document normal flow.
If you already know the exact dimensions of the <img> element, you can simulate normal flow using just css:
div {
border: 2px dotted grey;
position: relative;
width: 300px;
height: 400px;
}
img {
position: absolute;
}
<div>
<img src="https://dummyimage.com/300x400/d9ca29/ffffff">
</div>
<span>Lorem Ipsum is simply dummy text of the printing and typesetting industry</span>
Else, if you don't know the dimensions of the absolute element upfront you have to simulate the normal flow dynamically with javascript:
window.addEventListener('load', function() {
var div = document.querySelector('div');
var img = document.querySelector('img');
var rect = img.getBoundingClientRect();
div.style.height = rect.height + 'px';
div.style.width = rect.width + 'px';
});
div {
border: 2px dotted grey;
position: relative;
max-width: 200px;
}
img {
position: absolute;
width: 100%;
}
<div>
<img src="https://dummyimage.com/300x400/d9ca29/ffffff">
</div>
<span>Lorem Ipsum is simply dummy text of the printing and typesetting industry</span>
At some point in the (hopefully near) future, you'll be able to use the subgrid feature of CSS Grids. Currently, only Firefox supports this, but other browsers should add support soon.
Subgrid enables you to use Grid features with a non-flat structure (eg, an unordered list). That is, you can line up children of one element with children of another element, or in this case, the image, title, description, and price button.
.list-product-pat {
/* Create a grid with 5 columns that are 175px wide,
each with 5 rows that are sized based on the smallest item in the row */
display: inline-grid;
grid-template-columns: repeat(5, 175px);
grid-template-rows: repeat(5, min-content);
/* Colors and spacing to match design */
background: #f4f4f4;
padding: 1em;
grid-column-gap: 1em;
border: 1px solid #ddd;
}
.list-product-pat li {
/* Ensure this item takes up the column */
grid-row: 1 / -1;
/* Make children grid items */
display: grid;
/* Use parent's grid for children */
grid-template-rows: subgrid;
/* Styles to match design */
text-align: center;
justify-items: center;
border: 1px solid #ddd;
background: #fff;
}
/* STYLES TO MATCH DESIGN BELOW */
.list-product-pat > li > img {
margin-top: 1em;
}
.list-product-pat > li > h1 {
margin: .8em 0;
font-size: 1em;
}
.list-product-pat > li > p {
margin: 0;
color: #bbb;
font-size: .8em;
margin: 0 .5em 1em;
}
.list-product-pat > li > a {
text-decoration: none;
color: white;
font-weight: bold;
background: linear-gradient(#60bb76, #48b161);
border-radius: .5em;
box-shadow: 1px 1px 2px rgba(0, 0, 0, .5);
padding: .5em;
min-width: calc(100% - 1em);
margin-bottom: .5em;
box-sizing: border-box;
}
.list-product-pat > li > a > small {
display: block;
font-weight: normal;
font-size: .7em;
margin-top: .2em;
}
<ul class="list-product-pat">
<li>
<img src="https://placehold.it/40x70/">
<h1>HTC Desire C</h1>
<p>GSM, GPS, WiFi, kamera 5MP, bluetooth, Android, touchscreen, 600MHz</p>
1.699.000 <small>6 Produk/4 Website</small>
</li>
<li>
<img src="https://placehold.it/40x70/">
<h1>Samsung 19300 Galaxy S III</h1>
<p>GSM, GPS, WiFi, kamera 8MP, bluetooth, Android, touchscreen, 1.4GHz</p>
5.300.000 <small>8 Produk/5 Website</small>
</li>
<li>
<img src="https://placehold.it/40x70/">
<h1>Samsung Galaxy Grand i9082</h1>
<p>GSM, GPS, WiFi, touchscreen, 1.2GHz</p>
3.499.000 <small>10 Produk/8 Website</small>
</li>
<li>
<img src="https://placehold.it/40x70/">
<h1>Apple iPhone 5 16GB</h1>
<p>GSM, GPS, WiFi, kamera 8MP, bluetooth, iOS 6, touchscreen, 1.2GHz</p>
7.599.000 <small>6 Produk/5 Website</small>
</li>
<li>
<img src="https://placehold.it/40x70/">
<h1>BlackBerry Curve 9360 (Apollo)</h1>
<p>GSM, GPS, WiFi, kamera 5MP, bluetooth, 800MHz</p>
225.000 <small>9 Produk/4 Website</small>
</li>
</ul>
The solution is actually quite simple. Duplicate the absolutely positioned footer with visibility hidden.
<div style="background: silver; position: relative; height: 100px">
Height is 100px
<div style="position: absolute; bottom: 0; left: 0">Footer</div>
<div style="visibility: hidden">Footer</div>
</div>
<br />
<div style="background: silver; position: relative">
No height specified
<div style="position: absolute; bottom: 0; left: 0">Footer</div>
<div style="visibility: hidden">Footer</div>
</div>

Creating a "disabled" look by using a mask

I'm trying to create the following:
Using two images: one as mask (the diagonal lines) and the other the image and text themselves (the mask and image+text are the same size):
..and I just can't get it done!
I've tried all combinations with divs and z-indeces, opacity and background-image.. (should mention I'm noob to html).
Here's one shot I got at it (with only the mask and an image):
div {
position: absolute;
top: 775px;
left: 0px;
height: 188px;
width: 272px;
background-image: url('grey-out.png');
}
img {
z-index: 1000;
}
<div></div>
<img src="41_large.png" />
Which just gives the diagonal lines themselves..
Can someone please help me out?
How do I make that "disabled" look combining the (semi-transparent) mask and the div?
Thanks!
This approach works:
<div id="pspThing" class="disabled">
<img class="disabled" src="http://i.stack.imgur.com/lCTVr.png" />
</div>
#pspThing {
background: transparent url(http://i.stack.imgur.com/WpgNy.jpg) 0 0 no-repeat;
height: 93px;
width: 273px;
border: 1px solid #000;
margin: 0 auto;
overflow: hidden;
}
#pspThing img {
display: none;
opacity: 0.5;
}
#pspThing img.disabled {
display: block;
}
JS Fiddle demo
Bearing in mind that there's no transparency in your striped png (so far as the imgur hosted image is concerned, anyway, so I'm using opacity instead). Also the JS Fiddle demo's a little more complicated than necessary, so's I could show the disabled/enabled states.
Pleass consider this simple snippet. Very universal solution. Acts and feels very much like the 'disable' attribute of input elements. See the snippet
function disable(elementId, enabling) {
el = document.getElementById(elementId);
if (enabling) {
el.classList.remove("masked");
} else
{
el.classList.add("masked");
}
}
.masked {
position: relative;
pointer-events: none;
display: inline-block;
//visibility:hidden; /* Uncomment this for complete disabling */
}
.masked::before {
position: absolute;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
visibility: visible;
opacity: 0.5;
background-color: black;
//background: url('http://i.imgur.com/lCTVr.png'); /* Uncomment this to use the image */
content: "";
}
<button onclick="alert('Now, click \'OK\' then \'Tab\' key to focus next button.\nThen click \'Enter\' to activate it.');">Test</button>
<div id="div1" style="display:inline-block" class="masked">
<button onclick="alert('Sample button was clicked.')">Maskakable</button>
<button onclick="alert('Sample button was clicked.')">Maskakable</button><br/>
<br/>
<button onclick="alert('Sample button was clicked.')">Maskakable</button>
<button onclick="alert('Sample button was clicked.')">Maskakable</button><br/>
<img src="http://i.stack.imgur.com/WpgNy.jpg">
</div>
<button>Dummy</button>
<br/>
<button id="enableBtn" onclick="disable('div1',true);disable('enableBtn',false);disable('disableBtn',true);">Enable</button>
<button id="disableBtn" onclick="disable('div1',false);disable('enableBtn',true);disable('disableBtn',false);" class="masked">Disable</button>
I built an example here.
I doubt that the position:absolute approach is the best way to handle this since you need to know the size of the image.
For doing it by z-index your both images should be in the container with img tag.