CSS Persistant info popup, with usable HTML in popup - html

I am attempting to create a CSS popup, when hovering over an object. This will be an "info" popup, but I want to interact with HTML inside this popup window.
My idea is to create a DIV, and on hover, have a style that grows the div, showing the relevant HTML to interact with. Upon exit of the resized DIV, normal style to shrink the div back to original size. I don't want to use jQuery or equivalent popups, as I need to have the interaction as quick as possible. I don't want to create a popup, that disappears when leaving the item that popped it, before being able to enter and interact with the HTML in the popup.
My concerns are, having multiple of these objects (divs), I am not sure how they would interact with each other when they are resized, as I will probably need to absolute position the divs in an irregular layout.
Are there better ways to go about this?
A good example of what I am attempting to do, is the Netflix web interface, when hovering over a title, and interacting with the popup.

Ok, my Div layout idea, as above, seems to be doing the trick.
I am changing the z index on hover and normal style's ( of 0 for normal, and z of 1 for hover), for each div, and absolutely positioning the div's.
This way, each "hover" hovers on top of all the other collapsed div's. Its doing the trick for me, for now.
I am leaving this as unanswered, if someone can suggest a better way of achieving this, that might be more efficient than my current solution, please add your solution.
<div id="Container" style="position: relative" >
<%--1st div - Blue--%>
</div>
</td>
<td style="padding: 5px; width: 120px; background-color: #0099FF; color: #FFFFFF;" >
This is my Unit<br />
<br />
Unit details<br />
Unit Details 2<br />
<br />
Book Now</td>
</tr>
</table>
</div>
<%--2nd div - Red--%>
<div class="unit2">
<table cellpadding="0" cellspacing="0">
<tr>
<td style="width: 20px" valign="top">
<div style="width: 20px; height: 20px; background-color: #FF3300">
</div>
</td>
<td style="padding: 5px; width: 120px; background-color: #FF3300; color: #FFFFFF;" >
This is my Unit<br />
<br />
Unit details<br />
Unit Details 2<br />
<br />
Book Now</td>
</tr>
</table>
</div>
<%--3rd div - Green--%>
<div class="unit3">
<table cellpadding="0" cellspacing="0">
<tr>
<td style="width: 20px" valign="top">
<div style="width: 20px; height: 20px; background-color: #009933">
</div>
</td>
<td style="padding: 5px; width: 120px; background-color: #009933; color: #FFFFFF;" >
This is my Unit<br />
<br />
Unit details<br />
Unit Details 2<br />
<br />
Book Now</td>
</tr>
</table>
</div>
</div>
CSS >>
.unit1
{
width: 20px;
height: 20px;
overflow: hidden;
position: absolute;
top: 0px;
left: 0px;
z-index: 0;
}
.unit1:hover
{
width: 140px;
height: auto;
z-index: 1;
}
.unit2
{
width: 20px;
height: 20px;
overflow: hidden;
position: absolute;
top: 5px;
left: 35px;
z-index: 0;
}
.unit2:hover
{
width: 140px;
height: auto;
z-index: 1;
}
.unit3
{
width: 20px;
height: 20px;
overflow: hidden;
position: absolute;
top: 35px;
left: 20px;
z-index: 0;
}
.unit3:hover
{
width: 140px;
height: auto;
z-index: 1;
}

Related

How to get text to display over images in a table?

I'm trying to get the text to display over each individual image, I can't figure out why it's not displaying at all. From what I can tell I don't have the text hidden or anything, it's just not displaying on top of the corrisponding images.
I'm very new to html/css so i'm proberly missing someting quite obvious.
<html>
<body>
<table class="index">
<tr>
<td>
<img src="C:\Users\44074\Desktop\Learnnig\Website\Art\Care-Guide.jpg">
Care guides
</td>
<td>
<img src="C:\Users\44074\Desktop\Learnnig\Website\Art\Prop.jpg">
Propagation
</td>
<td>
<img src="C:\Users\44074\Desktop\Learnnig\Website\Art\Trouble.jpg">
Troubleshooting
</td>
</tr>
<tr>
<td>
<img src="C:\Users\44074\Desktop\Learnnig\Website\Art\Easy.jpg">
Easy plants
</td>
<td>
<img src="C:\Users\44074\Desktop\Learnnig\Website\Art\Pilea.jpg">
Pilea
</td>
<td>
<img src="C:\Users\44074\Desktop\Learnnig\Website\Art\Pets.jpg">
Pets & plants
</td>
</tr>
</table>
</body>
</html>
table.index{
table-layout: fixed;
border-spacing: 25px 35px;
font-size: 20px;
color: #575151;
padding-left: 180px;
padding-right: 180px;
}
table.index td {
height: 220px;
width: 360px;
min-width: 200px;
position: relative;
border: 1px solid black;
background-color: #575151;
vertical-align: middle;
text-align: center;
}
table.index td img {
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
}
div.index {
width: 100%;
}
You should put your text in an HTML element for example p tag: <p>Easy plants</p>
Give the p element a relative position: position: relative;
This will position it over the absolutely positioned image.
If you happen to change the order of the images and the text elements later, you should give the text elements a higher z-index value than the images.

making images links not working

I am trying to make my images a link but it is not working as the #flare div is conflicting with the rest of the layout could anyone tell me how to fix this?
I want the "flare set how it is at www.industrygaming.co.uk/newindex.php
please help. :)
HTML
<div id="content">
<br /><br />
<div id="flare"></div>
<table class="default" style="width: 1000px" align="center">
<tr>
<td class="content" width="33%"><img src="NewImages/Home/Ghosts.png" height="190px" height="190px" border="0"></td>
<td class="content" width="33%"><img src="NewImages/Home/Clan.png" width="200px" height="80px"></td>
<td class="content" width="33%"><img src="NewImages/Home/Fifa.png" width="200px" height="200px"></td>
</tr>
</table>
</div>
CSS
#content
{
float: left;
width: 998px;
margin: 0;
color: #fff;
font-size: 17px;
font-family: Times, serif;
min-height: 150px;
}
#flare
{
position: absolute;
display: block;
background-image: url("NewImages/Home/Optical-Flare.png");
background-repeat: no-repeat;
background-size:990px 700px;
min-width: 998px;
margin-left: 0px;
margin-top: -155px;
min-height: 700px;
}
I don't know about your design, but it is happening due to "position:absolute" to "div#flare."
So just put below code in your css and it will work. Then modify it as per your requirement.
table.default{position: absolute; top: 550px}

What is the best way to create this table layout? (image attached) [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I want to create an html table that is best supported on all browsers,
and that is w3c compliant.
The table shall consist 3-4 elements in it:
Text in the blue area - the text might be (a) shown as an image (so I can use nicer fonts, and I'll know for sure that all browsers display it the same way), or (b) might be real text (which would load faster), I haven't decided it.
Background image - according to the above decision, either (a) one background image that would cover both blue and pink parts, or (b) just the pink area, while the blue area would just use css background, and I'll write the text inside.
Text that would be positioned exactly where the yellow area is.
An image that would be positioned exactly where the green area is.
Are the following codes for each of the a/b options are good enough?
Option A:
<table width="700" align="center" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="680" style="background-image: url(bgimg.jpg)";>
<div style="width: 150px; height: 70px; margin-top: 280px; margin-left: 520px; text-align: center; background-color: #FF0;" >
text
</div>
<div style="width: 400px; height:40px; margin-top:242px; margin-left:18px; background-color:#063;">image</div>
</td>
</tr>
Option B:
<table width="700" align="center" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="500" height="680" bgcolor="#C6F3F9">
<div style="width: 400px; height:40px; margin-top:590px; margin-left:18px; background-color:#063;">image</div>
</td>
<td width="200" style="background-image: url(right-cell-bg.jpg)";>
<div style="width: 150px; height: 70px; margin-top: 80px; margin-left: 20px; text-align: center; background-color: #FF0;" >
text
</div></td>
for example:
a. Shall I position the yellow and green areas with DIVs?
b. Should I use additional DIVs (maybe for the cells)?
c. Is style-margin is the best way to acheive the positioning?
d. should I define cell widths with html or with style-width?
e. any other comments.
Thanks!
Don't use tables, use CSS. Something like this:
HTML
<div id="container">
<div id="blue">
<div id="image">
Image
</div>
</div>
<div id="pink">
<div id="text">
Text
</div>
</div>
</div>
CSS
#container {
border: 2px solid red;
width: 700px;
min-height: 680px;
position: relative;
}
#blue {
position: absolute;
left: 0;
background: #C6F3F9;
width: 500px;
min-height: 680px;
}
#blue #image {
position: absolute;
left: 18px;
bottom: 10px;
background: green;
width: 400px;
height: 40px;
}
#pink {
position: absolute;
right: 0;
background: #FAAEAE;
width: 200px;
min-height: 680px;
}
#pink #text {
position: absolute;
left: 25px;
top: 305px;
background: yellow;
width: 150px;
height: 70px;
}
http://jsfiddle.net/mr_mayers/jHT3Z/

How can I use this table design with valid markup?

I want to keep the tables but use css to achieve the same positioning result with a strict doctype. This is the design that does exactly what I need.
Notice the <br> tags in the last (bottom) <td> cell. As this area grows, the position of the data within two other <td> cells above it do not change position.
<table cellpadding="0" cellspacing="0" border="1" width="400" height="100%">
<tr>
<td valign="top">
<table cellpadding="0" cellspacing="0" border="0" height="100%">
<tr>
<td valign="top">ds</td> <----- The position here is important
</tr>
<tr>
<td valign="bottom">ds</td> <----- The position here is important
</tr>
</table>
</td>
<td valign="top">ada adf ad<br><br><br><br><br><br><br><br><br></td>
</tr>
</table>
I made an example for you here to show you how easy it is to duplicate that table with Divs and CSS:
HTML:
<div id="main-div-wrap">
<div class="left-content">
<span class="top">ds</span>
<span class="bottom">ds</span>
</div>
<div class="right-content">
ada adf ad
</div>
</div>
CSS:
#main-div-wrap
{
position: absolute;
width: 400px;
height: 200px;
border: 1px solid #000;
}
.left-content
{
width: 18%;
float: left;
height: 100%;
}
.right-content
{
margin-left; 18%;
width: auto;
float: left;
height: 100%;
border-left: 1px solid #000;
}
.top
{
position: absolute;
display: block;
top: 0;
}
.bottom
{
position: absolute;
display: block;
bottom: 0;
}
All semantic, no hacks, will validate and if you need to change it for browsers, theres more than enough tools out there to help you.
I'm not sure what you mean with "keep the tables for the structure", but I guess you what something like this, however if the content is too short, then the "top" and "bottom" texts will overlap.
http://jsfiddle.net/HsmKA/
Variant with CSS styled tables:
http://jsfiddle.net/JmQ55/
You can find all you want here.
Coming from a tables word myself I've always found the DIV layout a pain in the a$$.
Check out blue print css its a very easy to use CSS framework. Might sort you out

div popup inside td

I have a table with a bunch of cells. (No way! Amazing! :P) Some of the cells have a small div that when you put your mouse over, it gets bigger so you can read all the text. This works well and all. However, since html elements that come later in the document have a higher z-index, when the div gets bigger it is underneath the other divs in the other cells.
Some html code:
<table>
<tr>
<td>
limited info
<div style="position: relative;">
<div style="position: absolute; top: 0; left: 0; width: 1em; height: 1em;" onmouseover="tooltipshow(this)" onmouseout="tooltiphide(this)">
informative long text is here
</div>
</div>
</td>
<td>
some short info
<div style="position: relative;">
<div style="position: absolute; top: 0; left: 0; width: 1em; height: 1em;" onmouseover="tooltipshow(this)" onmouseout="tooltiphide(this)">
longer explanation about what is really going on that covers the div up there ^^^. darn!
</div>
</div>
</td>
</tr>
</table>
Some js code:
function tooltipshow(obj)
{
obj.style.width = '30em';
obj.style.zIndex = '100';
}
function tooltiphide(obj)
{
obj.style.width = '1em';
obj.style.zIndex = '20';
}
It doesn't matter if I set z-index dynamically to something higher onmouseover. It's like z-index has no affect. I think it has something to do with the table.
I've tested this in FireFox3. When I'm feeling particularly macho, I'll test it in IE.
Have you tried a CSS-based solution?
HTML:
<table>
<tr>
<td>
limited info
<div class="details">
<div>
informative long text is here
</div>
</div>
</td>
<td>
some short info
<div class="details">
<div>
longer explanation about what is really going on that covers the div up there ^^^. darn!
</div>
</div>
</td>
</tr>
</table>
CSS:
.details {
position: relative;
}
.details div {
position: absolute;
top: 0;
left: 0;
width: 1em;
height: 1em;
}
.details div:hover {
width: 30em;
z-index: 100;
}
If Javascript is necessary, you can change the .details div:hover { line to .show-details { and apply the class to the element using element.className = 'show-details';
Use the same HTML/CSS from #Kevin answer, but change the z-index of the relative div .details as well. This will work better on IE.
It turns out that setting z-index and opacity were messing things up. Check this out:
<html>
<head>
<style>
td {
background-color: #aaf;
padding: 1em;
}
.relative {
position: relative;
width: 100%;
}
div.highlight {
position: absolute;
background-color: green;
bottom: -1em;
left: 0;
width: 100%;
height: 0.2em;
/* the offenders */
z-index: 10;
opacity: 0.8;
}
div.tag {
background-color: red;
position: absolute;
top: -5em;
left: 0;
width: 1em;
height: 1.5em;
overflow: hidden;
z-index: 20;
font-size: 0.6em;
text-align: left;
border: solid 0.1em #000;
padding-left: 0.3em;
}
div.tag:hover {
width: 30em;
z-index: 100;
}
</style>
</head>
<body>
<table>
<tr>
<td>
limited info
<div class="relative">
<div class="highlight">
<div class="tag">
informative long text is here
</div>
</div>
</div>
</td>
<td>
some short info
<div class="relative">
<div class="highlight">
<div class="tag">
aaaaaaaaaalolkjlkjnger explanation about what is really going on that covers the div up there ^^^. darn!
</div>
</div>
</div>
</td>
</tr>
</table>
</body>
</html>