Why does my div disappear when i use position:relative in IE6? - html

I have no margins applied to this particular div, no floats and more annoyingly it works on a different page. Below is the code for the css rule:
#prizedraw-fliemore{
position: relative;
top: 164px;
left: -720px;
z-index: 3000;
}
The div shows up when i use position:absolute but that is useless to me. I have tried display, visibility and nothing i try works. Can someone help me out please? Thanks
The page code is:
<div id="column-left-content">
<p class="height"><strong>Learn more about CAREFREE® pantyliners and discover how they can help you feeling clean, fresh and protected all day long.</strong></p>
</div>
<div id="column-right-content">
<p><strong>Free to be me</strong> has been put together for you by the thoughtful makers of CAREFREE®, who design feminine hygiene products to give you all the protection you need.<br /><br />
Now that you've reached puberty, there are things you need to know that you might not know already. CAREFREE® has the answers to some of the questions you might just be asking...
</p>
</div>
<div id="car-boxes">
<div class="car-nav">
<div class="container">
<a class='example5' href="lb/why.html" style="border:none;" rel="group"><img src="images/carefree/pantyliners.png" class="bw" style="border:none;" /></a>
<img src="images/carefree/pantyliners-y.png" class="colour" alt="" />
</div>
</div>
<div class="car-nav">
<div class="container">
<a class='example5' href="lb/discharge.html" style="border:none;" rel="group"><img src="images/carefree/discharge.png" class="bw" style="border:none;" /></a>
<img src="images/carefree/discharge-y.png" class="colour" alt="" />
</div>
</div>
<br />
<div class="car-nav">
<div class="container">
<a class='example5' href="lb/difference.html" style="border:none;" rel="group"><img src="images/carefree/difference.png" class="bw" style="border:none;" /></a>
<img src="images/carefree/difference-y.png" class="colour" alt="" />
</div>
</div>
<div class="car-nav">
<div class="container">
<a class='example1' href="lb/right.html" style="border:none;" rel="group"><img src="images/carefree/right.png" class="bw" style="border:none;" /></a>
<img src="images/carefree/right-y.png" class="colour" alt="" />
</div>
</div>
</div>
<div id="prizedraw-car">
<img src="images/prizedraw.png" alt="Read More" />
</div>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-2268991-20");
pageTracker._trackPageview();
} catch(err) {}
</script>
</body>
</html>

My guess is that IE6 is positioning it off the screen, in other words the point you think you are relative to is not the point IE6 is using.
Are you able to make it appear by temporarily setting top/left to 0px and seeing where it shows up?
EDIT - Just looked up some code on one of my sites that does something similar.
I think you need to set position:relative on the parent div then use position:absolute and top/left on the child div.

Try to set position: relative on the parent div of the element you want to position.
It sounds wierd, because usually an absolute element needs a relative parent.
But I found that for older versions of IE, if you have a 'disappearing relative div', then making its' parent relative as well might solve you some problems.

try removing the {left: -720px;} and use a conditional stylesheet for IE. also try giving position relative to the parent of #prizedraw-fliemore

Related

How to add hyperlink to div?

I have put a banner at the top of my website and I have tried to add a hyperlink to the whole div as follows:
<div id="banner" onclick="location.href='http://www.heavenlygardens.org.uk/';" style="cursor: pointer;">
It doesn't work but you can see it here: http://www.heavenlygardens.org.uk/maps/6/index3_new.html
Any ideas?
To achieve expected result,use below option
1.Stack banner front using z-index:9999
<div id="banner" onclick="location.href='http://www.heavenlygardens.org.uk/';" style="cursor: pointer;z-index:9999">
This works for me:
<div onclick="location.href='http://www.google.com/';" style="cursor:pointer;">
<img src="//path-to-image.jpg" alt="description of image" />
</div>
However, unless you have a good reason for doing this in JavaScript, plain HTML would be a better option.
<a href="http://www.google.com">
<img src="//path-to-image" alt="description of image"/>
</a>

How to access child element of sibling of its parent in html by css

Can anyone tell how I can access a child element of an element which sibling of an element of parent of current attribute?
<div class="views-field views-field-field-mobile-service-new-image">
<div class="field-content">
<img typeof="foaf:Image" src="image1.png" width="55" height="55" alt="" />
</div>
</div>
<div class="views-field views-field-view-node">
<span class="field-content">
<a href="#" class="colorbox-node" data-inner-width="650" data-inner-height="450">
<img typeof="foaf:Image" src="image2.png" width="55" height="55" alt="" />
</a>
</span>
</div>
how I can access image in other div on hover of class field-content which is child of first div
Is it like, when you hover on image of one div at that time the second div image should be replaced by the first div's img?
If i understand you well, you can't do this with the CSS, but you can do it with JS, smth like that:
$('.views-field-view-node img').hover(function() {
var $yourImage = $(this).closest('.views-field-view-node')
.parent().find('.views-field-field-mobile-service-new-image img').addClass('hover');
}, function() {
var $yourImage = $(this).closest('.views-field-view-node')
.parent().find('.views-field-field-mobile-service-new-image img').removeClass('hover');
});
It's only example, you can improve my code and make it better, if you want.

Is there a way I can connect content with multiple divs?

I'm not sure how to ask this question so below is an visualization of what I want to achieve.
Please let me know if there is anything I can clarify!
Clarification:
At slide one, image 01 and image 02 are visible. Only when the person clicks on the images does the text and title div become visible. More importantly, the text box must be coherent with the page-wrapper. For example, if I were to set the text div to float:right, it will float on the right side of the page-wrapper.
Thank you in advance.
You need some javascript to get this behaviour i think. You can try something like this:
Everything in a little bit pseudo code.
HTML:
<img src="..." class="img1 clickImage">
<img src="..." class="img2 clickImage">
<div class="imageTitles">
<div class="img1 imgTitle">TITLETEXT</div>
<div class="img2 imgTitle">TITLETEXT</div>
</div>
<div class="imageInformations">
<div class="img1 imgInformation">INFORMATION img1</div>
<div class="img2 imgInformation">INFORMATION img2</div>
</div>
And some jQuery:
jQuery('.clickImage').on('click', function() {
var imgNumber = jQuery(this).getClass().replace('clickImage', '');
jQuery('imageTitles .imgTitle').hide(); //hide all image Titles
jQuery('imageTitles .imgTitle.' + imgNumber).show(); //show title for e.g. img1
//repeat this for imgInformation
});
Everything a little bit rough, but i hope it gives you an idea what you need to do.
EDIT:
Code now looks like this:
HTML:
<img src="http://media.tumblr.com/tumblr_mcepyv1Qfv1ru82ue.jpg" class="img1 clickImage">
<img src="http://media.tumblr.com/tumblr_mcf11pk4nj1ru82ue.jpg" class="img2 clickImage">
<div id="page-wrap">
<div class="imageTitles">
<div class="img1 imgTitle">TITLETEXT</div>
<div class="img2 imgTitle">TITLETEXT</div>
</div>
<div class="imageInformations">
<div class="img1 imgInformation">INFORMATION img1</div>
<div class="img2 imgInformation">INFORMATION img2</div>
</div>
</div>
JS:
jQuery('.imageTitles .imgTitle').hide();
jQuery('.imageInformations .imgInformation').hide();
jQuery('.clickImage').on('click', function () {
var imgNumber = jQuery(this).attr("class").replace('clickImage', '');
jQuery('.imageTitles .imgTitle').hide(); //hide all image Titles
jQuery('.imageTitles .imgTitle.' + imgNumber).show(); //show title for e.g. img1
jQuery('.imageInformations .imgInformation').hide();
jQuery('.imageInformations .imgInformation.' + imgNumber).show();
});
There are many ways to achieve this.
1) with every thing static, ie info about image is already available in the page in different div's.
ex: working
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.switch').hide();
});
function myInfo(myId)
{
$('.switch').hide();
$('#title'+myId).show();
$('#description'+myId).show();
}
</script>
<table>
<tr>
<td>
<!-- Images -->
<img onclick="return myInfo('1')" id='image1' height="60" width="60" src="http://static3.businessinsider.com/image/52cddfb169beddee2a6c2246/the-29-coolest-us-air-force-images-of-the-year.jpg" alt="Image1"><br/>
<img onclick="return myInfo('2')" id='image1' height="60" width="60" src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcR6I83EILo3XKIsqZ-0Q5JAEw38xGzsy1g_iKImqjBrMVaOHYb4Zg" alt="Image2">
</td>
<td>
<div id="title1" class="switch"> Image 1</div>
<div id="title2" class="switch"> Image 2</div>
</td>
<td>
<div id="description1" class="switch"> Information about Image 1 </div>
<div id="description2" class="switch"> Information about Image 2 </div>
</td>
</tr>
</table>
2) You can achieve this using AJAX calls for image information, in this case only 1 div for title and 1 for info is enough i you want to use else 1 div is enough. On click of image make an AJAX call to get the image info and display it in the div.
These are 2 ways and there are many more.

changing the content of div by click and change back another click

I want to change the contents of a div using a button click and in another click I want to bring back the old contenns to div I am using a image for button...
My div code is below
<div class="pic-container" style="position:absolute; left: 3px; top: 102px;">
<div class="pic-row" >
<img src="images/A.Png" />
<img src="images/B.Png" />
<img src="images/C.Png" />
<img src="images/D.Png" />
<img src="images/E.Png" />
<img src="images/F.Png" />
<img src="images/G.Png" />
<img src="images/H.Png" />
<img src="images/I.Png" />
<img src="images/J.Png" />
<img src="images/K.Png" />
<img src="images/L.Png" />
<img src="images/M.Png" />
<img src="images/N.Png" />
<img src="images/O.Png" />
<img src="images/P.Png" />
<img src="images/Q.Png" />
<img src="images/R.Png" />
<img src="images/S.Png" />
<img src="images/T.Png" />
<img src="images/U.Png" />
<img src="images/V.Png" />
<img src="images/W.Png" />
<img src="images/X.Png" />
<img src="images/Y.Png" />
<img src="images/Z.Png" />
</div>
</div>
<img style="position:absolute; left: 272.5px; top: 647px; width: 171px; height: 122.5px;" src="images/Btn_Lower.png" id="image1" />
Please help me to solve this issue
I don't want to confuse you by solving your problem, instead I would like to give you a short and simple example.
You can't achieve it by only using HTML you need javascript. So here is a way.
1) When you say content, it is referred as innerHTML in javascript.
2) I think you know about onclick, it is called click event. Similar to that you have a lots of different events in javascript for keypress, doubleclick, etc.,
3) Hope you know ID, called as unique selector. Other selector like class and you can HTML5 data-attributes.
4) To select an element, in JS you can use different methods like,
document.getElementById // select element based on Unique ID
document.getElementsByClassName // select element based on class
document.getElementsByTagName // select element based on Tag name
If you're insterested to learn more about javascript refers Mozilla Developers Network
Here is the shot example I would like to present to you.
HTML:
<div id="divd">First</div>
<button onclick='changeMe()'>Click It</button>
JS:
function changeMe() {
var div = document.getElementById('divd').innerHTML;
if (div === 'First') {
document.getElementById('divd').innerHTML = "Second";
} else {
document.getElementById('divd').innerHTML = "First";
}
}
Demo

Some links are not clickable in Internet Explorer 6, why?

I'm having problem with IE 6 (what a surprise : D)
On this site, in the content, I cannot click on the first few links. But after a few items, the links are working fine.
This problem appears if I load a page with ajax from the menu.
I couldn't figure out the problem, has anybody seen something like this before?
The HTML code is:
<div id="cont" style="display: block;">
<div class="localHeader">
<span> Szállás > Magánszállás </span>
</div>
<div class="subList">
<div class="productContainer">
<div class="img">
<img style="width: 200px;" src="/up/21/480_98_szarka2_255.jpg">
</div>
<div class="text">
<div class="productName">
<a title="Szarka család" href="/cats/showItem/21" rel="history"> Szarka család </a>
</div>
<div class="productDatas">
kato55#freemail.hu
<br>
<a title="Szarka család" href=""></a>
<br>
+36 84 314 062
</div>
<div class="productText"></div>
<a title="Szarka család" href="/cats/showItem/21" rel="history" class="moreButton"> Részletek </a>
</div>
</div>
</div>
</div>
Of course the .productContainer is repeating in the .subList.
Thanks.
Make sure that you have explicitly set overflow:auto on .productContainer. If that doesn't work, try Googling "clearfix" and see if that doesn't fix your problem.
You should ensure that your HTML validates against the DocType you're using, at the moment it doesn't and this can effect how browsers render parts of the page.
http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fbalatonnet.com%2Fcats%2FlstSubCat%2F13