Class is not being right using relative property - html

I have declared a class and positioned it absolute and when I declare another class and position another as relative and it's not working.
Here is 1st class:
<p class="slidshow">
<img class="mySlides" src="1.jpg" width="1000px" height="500px">
<img class="mySlides" src="2.jpg" width="1000px" height="500px">
<img class="mySlides" src="3.jpg" width="1000px" height="500px">
<img class="mySlides" src="4.jpg" width="1000px" height="500px">
<script type="text/javascript">
var slideIndex = 0;
carousel();
function carousel() {
var i;
var x = document.getElementsByClassName("mySlides");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
slideIndex++;
if (slideIndex > x.length) {slideIndex = 1}
x[slideIndex-1].style.display = "block";
setTimeout(carousel, 4000); // Change image every 2 seconds
}
Here it's css:
.slidshow{
position: absolute;
top: 130px;
right: 150px;
}
Here is second class:(it's just a sample)
<div class="cont">
<a id="contact">PHONE</a>
</div>
Here is it's css:
.cont{
position: relative;
top: 10px;
right: 10px;
}
The second class appears left to to first class.

I think you should read it first so you can better understand the css positions.
It's not about the exact solution it's about getting the basics that will lead you to build better layouts in future so please go through this article:
https://medium.freecodecamp.org/how-to-use-the-position-property-in-css-to-align-elements-d8f49c403a26

Related

How to order pictures in an HTML file

I am currently doing some plots with plotly in Javascript and HTML. I need to add next to the plotly graph 7 pictures.
So far I managed to add the fist picture on the RHS. This picture is 600x400 pixels. But now I want to display the same picture six times below the current one (obviously the picture should be 6 times scaled in order to fit in there).
Unfortunately I don't have any idea how to do it as I don't have any experience with HTML or CSS. I have tried already to create a grid which would contain the images and the graph but everything gets misaligned.
I add the code I have so far:
<!DOCTYPE html>
<html>
<head>
<!-- Plotly.js -->
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<style>
img{
position: relative;
float: right;
border : none;
height: 50vh;
align: "middle";
}
div.myDiv{
position: relative;
border : none;
height: 50vh;
align: "middle";
}
#hoverinfo{
position: relative;
border : none;
background-color: white;
}
</style>
</head>
<body bgcolor="white">
<div>
<img id="image_part" src="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg">
<div id="myDiv"></div>
<div id="hoverinfo"></div>
</div>
<script>
var point_x = [1,2,3,4,5,6];
var point_y = [1,2,3,4,5,6];
var colors = [1,1,1,0,0,0];
var i;
var traces = [];
var max_x = Math.max(...point_x.map(Math.abs));
var max_y = Math.max(...point_y.map(Math.abs));
var max_range = Math.max(max_x,max_y);
max_range = max_range + 0.05*max_range;
for (i = 0; i < point_x.length; i++) {
var trace = {
x: [point_x[i]],
y: [point_y[i]],
mode: 'markers',
marker: {color:[colors[i]]},
type: 'scatter'
}
traces.push(trace);
}
var myPlot = document.getElementById('myDiv'),
hoverInfo = document.getElementById('hoverinfo')
data = traces;
layout = {
hovermode:'closest',
showlegend:true,
title:'Hover on Points',
xaxis: {
range: [-max_range,max_range]
},
yaxis: {
range: [-max_range,max_range],
scaleanchor: 'x'
},
aspectratio: {
x: 1,
y: 1
},
height: 1000,
width: 1000
};
Plotly.plot('myDiv', data, layout);
</script>
</body>
</html>
I am also adding a picture explaining what I expect to get.
Thanks in advance!
Description of what I expect to get
EDIT 26/08/2019:
I managed to create the grid as Azzam Asghar suggested, but I am still unable to place the grid in the lower right corner as showed in the sketch I uploaded. I would really appreciate some help, this is my code now:
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<style>
div.gallery-row {
width: 50%;
display: flex;
}
div.gallery img {
width: 50%;
height: auto;
}
div.desc {
padding: 15px;
text-align: right;
}
* {
box-sizing: border-box;
}
.responsive {
padding: 0 3px;
width: 24.99999%;
}
#media only screen and (max-width: 700px) {
.responsive {
width: 49.99999%;
margin: 6px 0;
}
}
#media only screen and (max-width: 500px) {
.responsive {
width: 100%;
}
}
.clearfix:after {
content: "";
display: table;
clear: both;
}
div.myDiv{
position: relative;
border : none;
height: 50vh;
float: left;
}
img{
position: relative;
float: right;
border : none;
height: 50vh;
}
</style>
</head>
<body bgcolor="white">
<img id="image_part" src="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg">
<div class="gallery-row">
<div class="responsive">
<div class="gallery">
<a target="_blank" href="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg">
<img src="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg" alt="Forest" width="150" height="100">
</a>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg">
<img src="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg" alt="Northern Lights" width="150" height="100">
</a>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg">
<img src="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg" alt="Mountains" width="150" height="100">
</a>
</div>
</div>
</div>
<div class="gallery-row">
<div class="responsive">
<div class="gallery">
<a target="_blank" href="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg">
<img src="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg" alt="Forest" width="150" height="100">
</a>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg">
<img src="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg" alt="Northern Lights" width="150" height="100">
</a>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg">
<img src="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg" alt="Mountains" width="150" height="100">
</a>
</div>
</div>
</div>
<div id="myDiv"></div>
<script>
var point_x = [1,2,3,4,5,6];
var point_y = [1,2,3,4,5,6];
var colors = [1,1,1,0,0,0];
var i;
var traces = [];
var max_x = Math.max(...point_x.map(Math.abs));
var max_y = Math.max(...point_y.map(Math.abs));
var max_range = Math.max(max_x,max_y);
max_range = max_range + 0.05*max_range;
for (i = 0; i < point_x.length; i++) {
var trace = {
x: [point_x[i]],
y: [point_y[i]],
mode: 'markers',
marker: {color:[colors[i]]},
type: 'scatter'
}
traces.push(trace);
}
var myPlot = document.getElementById('myDiv'),
hoverInfo = document.getElementById('hoverinfo');
var data = traces;
var layout = {
hovermode:'closest',
showlegend:true,
title:'Hover on Points',
xaxis: {
range: [-max_range,max_range]
},
yaxis: {
range: [-max_range,max_range],
scaleanchor: 'x'
},
aspectratio: {
x: 1,
y: 1
},
height: 1000,
width: 1000
};
Plotly.plot('myDiv', data, layout);
</script>
</body>
</html>
How about modifying w3 example of responsive example according to your needs.
Here is a blitz.
So what you need to do is fix height and width of the image(although there are ways you won't have to do this). Than simply do control the width for smaller screens using css media queries.

I have some issues while making an slideshow

I'm trying to make an slideshow, but when it moves to the next (or previous) image, there is nothing on the background.
I would like the image you're going to see appearing behind the one you are seeing, something like when you are shuffling cards.
Aditionally, I would like to have different animations when you click on the right or on the left arrow, to match it's movement.
Here is the code I'm using right now:
Code
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.min.css">
<style>
.mySlides {display: none}
img {vertical-align: middle;}
/* Slideshow container */
.slideshow-container {
overflow: hidden;
max-width: 300px;
position: relative;
margin: auto;
}
/* Next & previous buttons */
.prev, .next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
padding: 16px;
margin-top: -22px;
color: white;
font-weight: bold;
font-size: 18px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
user-select: none;
}
/* Position the "next button" to the right */
.next {
right: 0;
border-radius: 3px 0 0 3px;
}
/* On hover, add a black background color with a little bit see-through */
.prev:hover, .next:hover {
background-color: rgba(0,0,0,0.8);
}
</style>
</head>
<body>
<div class="slideshow-container">
<div class="mySlides animated slideInLeft">
<img src="https://pruebas20.webcindario.com/img_snow_wide.jpg" style="width:100%">
</div>
<div class="mySlides animated slideInRight">
<img src="https://pruebas20.webcindario.com/img_nature_wide.jpg" style="width:100%">
</div>
<div class="mySlides slideInRight">
<img src="https://pruebas20.webcindario.com/img_mountains_wide.jpg" style="width:100%">
</div>
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
</div>
<script>
var slideIndex = 1;
showSlides(slideIndex);
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("dot");
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " active";
}
</script>
</body>
</html>
Thank you!
The problem is that you are hiding all but the current slide, both with javascript and css.
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
.mySlides {display: none}
You would need to remove this, but change the z-index of the slides instead so that the current slide is on top, and at the same time add the slideInRight/slideInLeft classes. You would also need to absolutely position the slides within the container, so that they occupy the same position.
Yes, Mark Fisher is correct. You need to play around with the z-index of the slides. To be honest it would probably be easier to use a plugin such as Slick Slider if you want to have cool transitions etc.
I have created a codepen based on your code. It is not perfect, but perhaps you can get an idea of how to do this. Your slides need to be positioned absolutely within the slide wrapper in order to be "revealed" behind each other when you move between slides. I have used a CSS transition on the position to animate the slide.
.mySlides {position: absolute; left: 0; z-index: 0;transition: left 1s linear; width: 300px; height: 105px;}
https://codepen.io/moorehannah/pen/eqdXby

Why do my items with javascript go in front of my Nav

My nav keeps going behind any items I have that contain javascript.
I've tried changing the z-index of both items but I'm not sure how else to fix it
http://flavorsbyj.site/#Reviews
View this site and scroll down... This also happens if you scroll up a bit with the pictures slideshow. Both which contain Javascript
var slideIndex = 0;
showSlides();
function showSlides() {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("dot");
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
slideIndex++;
if (slideIndex > slides.length) {
slideIndex = 1
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex - 1].style.display = "block";
dots[slideIndex - 1].className += " active";
setTimeout(showSlides, 5000);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="slideshow-container col-6 col-m-12" style="background-color:#E7E7E7; border-radius: 1vh;">
<div class="mySlides fade">
<img alt="Event2" src="Images/E2.1.jpg" style=" border-radius: 1vh;" class="col-20 col-m-0">
<img alt="Event2" src="Images/E2.1.jpg" style=" border-radius: 1vh;" class="col-0 col-m-20">
</div>
<div class="row" id="navbar" style="position: fixed; width: 100%;">
<div class="col-m-4 col-4 dropdown-right">
<span id="bar" style="font-size:9vh;cursor:pointer; color: #232323; margin-left: 10px; padding: 10px; text-shadow: 1px 2px white" onclick="openNav()">☰</span>
</div>
<div class="col-5 col-m-4"> </div>
<div class="col-4 col-m-4"><img alt="Logo" src="Images/Logo.jpg" class="col-9 col-m-20" style="height: 13vh;"></div>
<div class="col-2 col-m-0"> </div>
<div class="col-m-0 col-5">
<a href="Home.html" style=" text-align: right; margin-top: -1vh;">
<img alt="RampCert" src="Images/Ramp.png" class="col-20 col-m-20" style="height: 10vh;">
</a>
</div>
<div class="col-m-7 col-0">
<a href="#Home" style="text-align: right; margin-top: -1vh;">
<img alt="RampCert" src="Images/Ramp.png" class="col-20 col-m-20" style="height: 10vh;">
</a>
</div>
</div>
You just need to add a z-index to your #navbar then it will be front of your content.
Example:
#navbar {
z-index: 999 //or any value bigger than 0
}
This is happening because of the z-index value. Just replace your #navbar inline-css with following css and it will work as expected
#navbar {
z-index:9999; /*Change this value accordingly */
}
OR
<div class="row" id="navbar" style="position: fixed;width: 100%; z-index: 9999; ">
Hope it helps.
Solution is z-index for sure as there is already answer by couple of other people.
I would say while using the z-index you must have to make sure which element you want on the top on based on that only you can provide the z-index not just the random number to bring up like 999. z-index work like layers.
In your problem z-index:2 will resolve the issue too.
#navbar {
z-index: 2;
}

change picture size in slideshow in CSS and HTML

I am currently making a website and when I view the slideshow its too big is there any way of changing the size of it? I am using HTML and CSS made in visual studio and here is an image of the site 50% zoomed out slideshow
var slideIndex = 1;
showDivs(slideIndex);
function plusDivs(n) {
showDivs(slideIndex += n);
}
function currentDiv(n) {
showDivs(slideIndex = n);
}
function showDivs(n) {
var i;
var x = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("demo");
if (n > x.length) {
slideIndex = 1
}
if (n < 1) {
slideIndex = x.length
}
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" w3-opacity-off", "");
}
x[slideIndex - 1].style.display = "block";
dots[slideIndex - 1].className += " w3-opacity-off";
}
.mySlides {
display: none
}
.demo {
cursor: pointer
}
<link href="https://www.w3schools.com/w3css/4/w3.css" rel="stylesheet"/>
<div class="w3-content" style="max-width:1200px">
<img class="mySlides" src="https://cdn.pixabay.com/photo/2018/09/07/17/50/fruit-3661159_960_720.jpg" style="width:100%">
<img class="mySlides" src="https://cdn.pixabay.com/photo/2016/10/11/12/37/piano-keys-1731467_960_720.jpg" style="width:100%">
<img class="mySlides" src="https://cdn.pixabay.com/photo/2017/11/14/18/31/mushroom-2949539_960_720.jpg" style="width:100%">
<div class="w3-row-padding w3-section">
<div class="w3-col s4">
<img class="demo w3-opacity w3-hover-opacity-off" src="https://cdn.pixabay.com/photo/2018/09/07/17/50/fruit-3661159_960_720.jpg" style="width:100%" onclick="currentDiv(1)">
</div>
<div class="w3-col s4">
<img class="demo w3-opacity w3-hover-opacity-off" src="https://cdn.pixabay.com/photo/2016/10/11/12/37/piano-keys-1731467_960_720.jpg" style="width:100%" onclick="currentDiv(2)">
</div>
<div class="w3-col s4">
<img class="demo w3-opacity w3-hover-opacity-off" src="https://cdn.pixabay.com/photo/2017/11/14/18/31/mushroom-2949539_960_720.jpg" style="width:100%" onclick="currentDiv(3)">
</div>
</div>
</div>
Looking for something like this? I dropped the W3.css Library. This example is on W3schools.com. From my current location I cannot access the photos you posted so I had to use different example photos.
var slideIndex = 1;
showSlides(slideIndex);
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("demo");
if (n > slides.length) {
slideIndex = 1
}
if (n < 1) {
slideIndex = slides.length
}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex - 1].style.display = "block";
dots[slideIndex - 1].className += " active";
}
body {
font-family: Arial;
margin: 0;
}
* {
box-sizing: border-box;
}
img {
vertical-align: middle;
}
/* Position the image container (needed to position the left and right arrows) */
.container {
position: relative;
max-width: 1280px;
margin: 0 auto;
}
/* Hide the images by default */
.mySlides {
display: none;
}
/* Add a pointer when hovering over the thumbnail images */
.cursor {
cursor: pointer;
}
.row:after {
content: "";
display: table;
clear: both;
}
/* Six columns side by side */
.column {
float: left;
width: 33.33%;
padding: 1%;
}
/* Add a transparency effect for thumnbail images */
.demo {
opacity: 0.6;
}
.active,
.demo:hover {
opacity: 1;
}
<meta name="viewport" content="width=device-width, initial-scale=1">
<h2 style="text-align:center">Slideshow Gallery</h2>
<div class="container" >
<div class="mySlides">
<img src="https://www.w3schools.com/howto/img_woods_wide.jpg" style="width:100%">
</div>
<div class="mySlides">
<img src="https://www.w3schools.com/howto/img_5terre_wide.jpg" style="width:100%">
</div>
<div class="mySlides">
<img src="https://www.w3schools.com/howto/img_mountains_wide.jpg" style="width:100%">
</div>
<br>
<div class="row">
<div class="column">
<img class="demo cursor" src="https://www.w3schools.com/howto/img_woods.jpg" style="width:100%" onclick="currentSlide(1)" alt="The Woods">
</div>
<div class="column">
<img class="demo cursor" src="https://www.w3schools.com/howto/img_5terre.jpg" style="width:100%" onclick="currentSlide(2)" alt="Cinque Terre">
</div>
<div class="column">
<img class="demo cursor" src="https://www.w3schools.com/howto/img_mountains.jpg" style="width:100%" onclick="currentSlide(3)" alt="Mountains and fjords">
</div>
</div>
</div>
You can set a fixed height /width for your images however you risk the images becoming skewed. I set a fixed height below, and the images will display within the window, and the thumbs will all be of the same height, however you'd be better off starting with images that are of similar dimensions and using % or vertical height (vh) to size the images smaller as appropriate to what you want.
Hope this helps
var slideIndex = 1;
showDivs(slideIndex);
function plusDivs(n) {
showDivs(slideIndex += n);
}
function currentDiv(n) {
showDivs(slideIndex = n);
}
function showDivs(n) {
var i;
var x = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("demo");
if (n > x.length) {
slideIndex = 1
}
if (n < 1) {
slideIndex = x.length
}
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" w3-opacity-off", "");
}
x[slideIndex - 1].style.display = "block";
dots[slideIndex - 1].className += " w3-opacity-off";
}
body {
padding: 0;
width:900px;
max-height:100%;
overflow-y:hidden;
}
.w3-content {
max-width:600px;
max-height: 50vh!important;
margin:0 auto;
}
.mySlides {
display: none;
width: 100%;
height:450px;
}
.demo {
cursor: pointer;
height:150px;
}
<link href="https://www.w3schools.com/w3css/4/w3.css" rel="stylesheet" />
<body>
<div class="w3-content">
<img class="mySlides" src="https://cdn.pixabay.com/photo/2018/09/07/17/50/fruit-3661159_960_720.jpg">
<img class="mySlides" src="https://cdn.pixabay.com/photo/2016/10/11/12/37/piano-keys-1731467_960_720.jpg">
<img class="mySlides" src="https://cdn.pixabay.com/photo/2017/11/14/18/31/mushroom-2949539_960_720.jpg">
<div class="w3-row-padding w3-section">
<div class="w3-col s4">
<img class="demo w3-opacity w3-hover-opacity-off" src="https://cdn.pixabay.com/photo/2018/09/07/17/50/fruit-3661159_960_720.jpg" style="width:100%" onclick="currentDiv(1)">
</div>
<div class="w3-col s4">
<img class="demo w3-opacity w3-hover-opacity-off" src="https://cdn.pixabay.com/photo/2016/10/11/12/37/piano-keys-1731467_960_720.jpg" style="width:100%" onclick="currentDiv(2)">
</div>
<div class="w3-col s4">
<img class="demo w3-opacity w3-hover-opacity-off" src="https://cdn.pixabay.com/photo/2017/11/14/18/31/mushroom-2949539_960_720.jpg" style="width:100%" onclick="currentDiv(3)">
</div>
</div>
</div>
</body>

full screen width slideshow

I have problem making a slideshow to full screen. In my home.html.erb i have this code:
<div class="containerfull">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.mySlides {display:none; background-size: cover;}
</style>
<div class="containerfull" style="background-size: cover;">
<img class="mySlides" src="https://imagejournal.org/wp-content/uploads/bb-
plugin/cache/23466317216_b99485ba14_o-panorama.jpg" style="width:100%">
</div>
<script>
var myIndex = 0;
carousel();
function carousel() {
var i;
var x = document.getElementsByClassName("mySlides");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
myIndex++;
if (myIndex > x.length) {myIndex = 1}
x[myIndex-1].style.display = "block";
setTimeout(carousel, 2000); // Change image every 2 seconds
}
</script>
</div>
i set the image to width: 100% and also made a div containerfull with width: 100%.
But when i reload the browser and inspect my site my home.html.erb code is placed inside a div container with width: 80%. But i don't have this div container in my home.html.erb code.
I can't figure out where this div comes from and therefore can't change anything about the 80%.
Any ideas?
You might want to put your style stuff is a .css file.. But here is what I did and it worked..
<img class="mySlides" src="https://imagejournal.org/wp-content/uploads/bb-plugin/cache/23466317216_b99485ba14_o-panorama.jpg" style="min-width:100%; height:50%; position:fixed; top: 0; left: 0;"/>
Instead of width, I did min-width:100%;..
Added height:50%; (Not sure what you wanted for that)..
Added position:fixed;
Added top:0;
Added left:0;