I want to fix this page (http://l2topserver.com/l2topserver) just to have a right banner link. I made this code
but when the screen's resolution the page is broken in the right side. What settings can I use that the page won't break?
First snippet
.header11 a {
display: block;
background-image: url("http://www.l2topserver.com/test/1.jpg");
padding-left: 395px;
padding-top: 1000px;
width: 100px;
left: 5px;
top: 10px;
position: fixed;
}
<div class="header11">
<div align="left">
<a href="https://www.google.com" target="_blank">
</a>
</div>
</div>
Second snippet
.header111 a {
display: block;
background-image: url("http://www.l2topserver.com/test/2.jpg");
padding-left:395px;
padding-top:1000px;
width:100px;
left: 1410px; top: 10px;
position: fixed;
overflow: auto;
}
<div class="header111">
<div align="right">
<a href="https://www.google.com" target="_blank">
</a>
</div>
</div>
You can use right: 0; in the second image.
.header11 a {
display: block;
background-image: url("http://www.l2topserver.com/test/1.jpg");
padding-left:395px;
padding-top:1000px;
width:5%;
left: 5px; top: 10px;
position: fixed;
}
.header111 a {
display: block;
background-image: url("http://www.l2topserver.com/test/2.jpg");
padding-left:395px;
padding-top:1000px;
width:5%;
right: 0;
top: 10px;
position: fixed;
overflow: auto;
}
Related
I have this image currently. The circle, the close image, and get your quotes image. (see below)
Correct image layout
I can't get all elements to be fixed together so when I change the size of the screen the elements move together instead of separately across the page. (see below)
Incorrect image layout
I have looked into the positioning of each element, but I maybe misunderstanding something, or my code is messy. Please see below:
HTML:
<body>
<!--Thanks for visiting image-->
<div id="thanks-for-visiting-img-bg" class="thanks-for-visiting-bg">
<div id="thanks-for-visiting-img-container" class="thanks-for-visiting-img-container">
<img src="../images/thanks_for_visiting_img.png" alt="Thanks for visiting" id="thanks-for-visiting-img" class="thanks-for-visiting-img">
</div>
</div>
<!--Get Quotes button-->
<div>
<img src="../images/btn.png" alt="Get Your Quotes" id="get-quotes-btn" class="get-quotes-btn">
</div>
<!--Close button-->
<div>
<img src="../images/close_green.png" alt="Close Thanks For Visiting image" id="close-btn" class="close-btn">
</div>
</body>
</html>
CSS:
/*CONTAINER*/
.thanks-for-visiting-img-container {
width: 550px;
height: 550px;
z-index: 2147483647;
left: 0px;
right: 0px;
margin: auto;
top: 0px;
bottom: 0px;
display: block;
outline: none;
max-width: none;
max-height: none;
position: fixed !important;
cursor: default !important;
}
/*IMAGE BACKGROUND*/
.thanks-for-visiting-bg {
display: block;
position: fixed;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
/*z-index: 2147483647;*/
overflow: auto;
background-color: rgb(0, 0, 0);
opacity: 0.83;
}
/*-- GET QUOTES BUTTON --*/
.get-quotes-btn {
cursor: pointer;
position: absolute;
background-color: rgba(0, 0, 0, 0);
background-repeat: no-repeat;
background-size: cover;
width: 288px;
height: 49px;
border-radius: 0px;
z-index: 2;
right: 0px;
bottom: auto;
left: -20px;
top: 425px;
margin: auto;
display: block;
}
.close-btn {
cursor: pointer;
position: absolute;
right: 50%;
bottom: 100px;
left: 65%;
top: 80px;
}
.thanks-for-visiting-img-container and .thanks-for-visiting-bg has to be fixed because the bg class' CSS doesn't work without it and the img container has to be fixed because the page will need to scroll underneath it. Can anyone help?
You can put all the div tags (Get Quotes, the image and the close button) in another div tag and then, add this CSS class to that new div tag:
.mainClass {
display: flex;
flex-direction: column;
}
before css div background image not be cover in background means background image broken the div and go to another div. Please help me to fix this.
Please Check this codepen link:-
https://codepen.io/anon/pen/wyyJKB
This is my code
.learn-more {
background: #063047;
padding-bottom: 2em;
}
.learn-more:before {
content: "";
background-image: url(https://wallpapers.walldevil.com/wallpapers/a78/preview/breath-
taking-nature-online-definition-high-background.jpg);
display: block;
width: 100%;
height: 100%;
padding-bottom: inherit;
position: absolute;
opacity: 0.15;
left: 0;
background-repeat: no-repeat;
background-size: 100% 100%;
}
<style>
/* css */
</style>
<div class="section learn-more">
<div class="inner">
<h2 class="" style="color:#fff;">I help you for this</h2>
<p class="" style="color:#fff;">Do you want call</p>
<p>
<a href="#">
<span class="" style="color:#fff;">CLICK HERE</span>
</a>
</p>
</div>
</div>
You can try this code.
HTML:
<div class="section learn-more">
<div class="inner">
<h2 class="" style="color:#fff;">I help you for this</h2>
<p class="" style="color:#fff;">Do you want call</p>
<p>
<a href="#">
<span class="" style="color:#fff;">CLICK HERE</span>
</a>
</p>
</div>
</div>
CSS:
.learn-more {
background: #063047;
padding-bottom: 2em;
position: relative;
}
.learn-more:before {
content: "";
background-image: url(https://wallpapers.walldevil.com/wallpapers/a78/preview/breath-taking-nature-online-definition-high-background.jpg);
display: inline-block;
width: 100%;
height: 100%;
padding-bottom: inherit;
position: absolute;
opacity: 0.15;
left: 0;
top: 0;
background-repeat: no-repeat;
background-size: 100% 100%;
}
.inner h2{
margin: 0;
}
.learn-more {
background: #063047;
padding-bottom: 2em;
position:relative;
}
If you positioning any div or element to Absolute. Make sure the parent element should be positon:relative;
Use position: inherit; instead of position: absolute; in class .learn-more::before
.learn-more::before {
content: "";
background-image: url(https://wallpapers.walldevil.com/wallpapers/a78/preview/breath-taking-nature-online-definition-high-background.jpg);
display: block;
width: 100%;
height: 100%;
padding-bottom: inherit;
position: inherit;
opacity: 0.15;
left: 0;
background-repeat: no-repeat;
background-size: 100% 100%;
}
I have a navbar with a certain height and a logo that overflows. This logo is, of course, clickable, but it means that the part that overflows, is also clickable.
Is it possible to make the logo overflow, but not the clickable area?
HTML
<nav>
<a href="#">
<div class="logo">
<img src="http://i.imgur.com/h4bUdrZ.png" />
</div>
</a>
</nav>
CSS
body, html {
padding: 0;
margin: 0;
}
nav {
height: 100px;
background: blue;
position: relative;
}
.logo {
position: absolute;
top: -36px;
left: -39px;
}
JSFIDDLE
Something like this?
body,
html {
padding: 0;
margin: 0;
}
nav {
height: 100px;
background: blue;
position: relative;
}
a {
display: inline-block;
height: 100%;
width: 100%;
}
.logo {
position: absolute;
top: -36px;
left: -39px;
pointer-events: none;
}
<nav>
<a href="#">
<div class="logo">
<img src="http://i.imgur.com/h4bUdrZ.png" />
</div>
</a>
</nav>
Just move logo outside of your link and put that link on rest of header:
body,
html {
padding: 0;
margin: 0;
}
nav {
height: 100px;
background: blue;
position: relative;
}
.logo {
position: absolute;
top: -36px;
left: -39px;
}
a {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 10;
display: inline-block;
}
<nav>
<a href="#">
</a>
<div class="logo">
<img src="http://i.imgur.com/h4bUdrZ.png" />
</div>
</nav>
Change little bit of you structure.
Put <a> independent and pass link in it with following css.
HTML
<nav>
<div class="logo">
<img src="http://i.imgur.com/h4bUdrZ.png" />
</div>
</nav>
CSS
body, html {
padding: 0;
margin: 0;
}
nav {
height: 100px;
background: blue;
position: relative;
}
nav a{
position: relative;
display: block;
height: 100%;
z-index: 1;
}
.logo {
position: absolute;
top: -36px;
left: -39px;
}
Example : https://jsfiddle.net/67s4ajqf/3/
Don't place the whole div inside the a.
Place the link after the image, give it absolute positioning and carefully set the position and size.
The other answers make the whole header clickable. If it is not desired, use this solution. You may have to adjust the width of the clickable area.
See the example below:
body, html {
padding: 0;
margin: 0;
}
nav {
height: 100px;
background: blue;
position: relative;
}
.logo {
position: absolute;
top: -36px;
left: -39px;
}
a.clickable-logo {
position: absolute;
display: inline-block;
left: 36px;
top: 36px;
width: 600px;
height: 100px;
}
<nav>
<div class="logo">
<img src="http://i.imgur.com/h4bUdrZ.png" />
<a href="#" class="clickable-logo">
</a>
</div>
</nav>
What about something like this?
HTML
<a href="#">
<div class="clear">
</div>
</a>
<nav>
<div class="logo">
<img src="http://i.imgur.com/h4bUdrZ.png" />
</div>
</nav>
CSS
body, html {
padding: 0;
margin: 0;
}
nav {
height: 100px;
background: blue;
position: relative;
}
.clear {
height: 100px;
background: 0;
position: absolute;
width: 100%;
z-index: 2;
}
.logo {
position: absolute;
top: -36px;
left: -39px;
}
I want all of the anchor images in different corners , eg , top left , top right , bottom right , bottom right , and one in the centre thank you
How do I make all my anchor links / images go to specific sides I want the teams one on top left I want store top right sponsors bottom left and about us bottom right I thought I did all the right code but they don't how up in those specific spots
If anyone can help it will be greatly appreciates
CSS
.icon1.jpg {
position: absolute;
top: 0px;
left: 0px;
height: auto;
width: 50%;
}
.icon2.jpg {
position: relative;
top: 0px;
right: 0px;
height: auto;
width: 50%;
}
.icon4.jpg {
position: relative;
left: 0px;
height: auto;
width: 50%;
}
.icon3.jpg {
position: relative;
right: 0px;
height: auto;
width: 50%;
}
.DelUZens {
display: block;
margin-left: auto;
margin-right: auto;
}
body {
background: url("icon6.jpg") repeat;
}
#banner {
position: absolute;
top: 0px;
left: 0px;
right: 0px;
width: 100%;
height: 175px;
z-index: -1;
}
<html>
<head>
<title>DelUZens</title>
<link href="main.css" rel="stlesheet" type="text/css">
</head>
<body bgcolor="#000">
<div z-index:1;>
<p>
<a href="teams.html" target="_blank">
<img src="icon1.jpg" style='width:50%;' border="0" alt="Null" class="top" z-index:2>
</a>
</p>
<p>
<a href="store.html" target="_blank">
<img src="icon2.jpg" style='width:50%;' border="0" alt="Null" class="right" z-index:3>
</a>
</p>
<p>
<a href="sponsors.html" target="_blank">
<img src="icon4.jpg" style='width:50%;' border="0" alt="Null" class="left" z-index:4>
</a>
</p>
<p>
<a href="aboutus.html" target="_blank">
<img src="icon3.jpg" style='width:50%;' border="0" alt="Null" class="bottom" z-index:5>
</a>
</p>
</div>
<div id="myDiv" style="position:absolute; top:230px; left:591px; right: 591px; bottom: 230px; width:0px; height:0px; z-index:8;">
<img src="icon5.png" class="DelUZens">
</div>
</body>
</html>
Thank you in advance.
I would NEVER personally layout a page this way, however it will fix your problem with the current layout, see fiddle https://jsfiddle.net/5pre17op/1/
Note: this .icon1.jpg is targeting a class called icon and jpg either of these classes do not exist in your page, however you do have classes named top left right and bottom, you need to target them like this:
.top {
position: absolute;
top: 0px;
left: 0px;
height: auto;
width: 50%;
}
.right {
position: absolute;
top: 0px;
right: 0px;
height: auto;
width: 50%;
}
.left {
position: absolute;
left: 0px;
bottom: 0px;
height: auto;
width: 50%;
}
.bottom {
position: absolute;
right: 0px;
bottom: 0px;
height: auto;
width: 50%;
}
try to refer to each image by using their class name but not src of image, e.g. for the first link:
CSS
.top {
position: absolute;
top: 0px;
left: 0px;
height: auto;
width: 50%;
}
You must have relative wrapper and in this holder put anchors.
<div class="section-links">
See enter link description here
.top {
position: absolute;
top: 0px;
left: 0px;
height: auto;
width: 50%;
}
.right {
position: absolute;
top: 0px;
right: 0px;
height: auto;
width: 50%;
}
.left {
position: absolute;
bottom:0px;
left: 0px;
height: auto;
width: 50%;
}
.bottom {
position: absolute;
bottom:0px;
right: 0px;
height: auto;
width: 50%;
}
.DelUZens {
display: block;
margin-left: auto;
margin-right: auto;
}
body {
background: url("icon6.jpg") repeat;
}
#banner {
position: absolute;
top: 0px;
left: 0px;
right: 0px;
width: 100%;
height: 175px;
z-index: -1;
}
Use position absolute instead of relative.
Look at the following JSFiddle
.container {
width: 100%;
background-color: yellow;
}
.classic {
display: block;
position: relative;
margin-left: auto;
margin-right: auto;
background-position: center center;
background-image: url("http://www.pulsarwallpapers.com/data/media/3/Alien%20Ink%202560X1600%20Abstract%20Background.jpg");
background-size: contain;
background-repeat: no-repeat;
}
.classic-img {
display: block;
position: absolute;
overflow: hidden;
width: 100%;
height: 100%;
top: 0%;
left: 0%;
}
.classic-img img {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.top-menu {
width: 100%;
height: 50px;
position: relative;
background-color: red;
}
.top-menu-buttons {
position: absolute;
margin-left: auto;
margin-right: auto;
bottom: 0;
left: 0;
right: 0;
width: 50%;
text-align: center;
}
.top-menu-buttons .button {
display: inline-block;
vertical-align: middle;
font-size: 25px;
color: white;
}
.top-menu-buttons span {
display: inline-block;
vertical-align: middle;
font-size: 25px;
color: white;
}
.bottom-menu {
width: 100%;
height: 50px;
position: relative;
background-color: green;
}
.bottom-menu-buttons {
position: absolute;
margin-left: auto;
margin-right: auto;
bottom: 0;
left: 0;
right: 0;
width: 80%;
text-align: center;
}
.bottom-menu-buttons .button {
display: inline-block;
vertical-align: middle;
font-size: 35px;
color: white;
padding-left: 10px;
padding-right: 10px;
}
<div class="list">
<a class="item">
<div id="container" class="container">
<div class="top-menu">
<div class="top-menu-buttons">
<button>-</button>
<span>20</span>
<button>+</button>
</div>
</div>
<div id="classic" class="classic">
<div id="classic-img" class="classic-img">
<img src="http://bc03.rp-online.de/polopoly_fs/1.4643662.1415087612!httpImage/2100575733.JPG_gen/derivatives/d540x303/2100575733.JPG" />
</div>
</div>
<div class="bottom-menu">
<div class="bottom-menu-buttons">
<button class="button button-icon ion-eye">1</button>
<button class="button button-icon ion-refresh">2</button>
<button class="button button-icon ion-crop">3</button>
<button class="button button-icon ion-android-options">4</button>
<button class="button button-icon ion-social-tumblr">5</button>
</div>
</div>
</a>
</div>
CSS:
What i want to achieve is something like the following:
The red area should be a top menu. It should not be a fixed top position it should just always be on top of the image.
As you can see the image has a white background and a black forground. It should look like a polaroid.
The green area should be a menu at the bottom but also not fixed to the bottom it should just always be underneath the image. If there is not enough space it should simply scroll not clinch or esize any of the divs. I guess the main problem is the div in the middle where the image with the background image is.
I try for ages now to get the correct css but unfortunately im very unexperienced and all i can do at the moment is try and error but i cant get it working.
remove position: absolute from .classic-img and .classic-img img
add margin: 100px auto; adjust 100px as per your need, also you have set background-size: contain and the aspect ratio of bg image is almost equal to the image, therefore you would see only small portion of bg image here in the fiddle - jsfiddle.net/18vg13dt/3
additionally if you want gap from left and right also the use - margin: 100px 50px; similarly according to your needs.
jsfiddle
I guess this is what you want?
.classic {
background: url("http://www.pulsarwallpapers.com/data/media/3/Alien%20Ink%202560X1600%20Abstract%20Background.jpg")no-repeat center center;
background-repeat: no-repeat;
background-size: cover;
}
.classic-img {
padding: 10px;
box-sizing: border-box;
}
.classic-img img {
display:block;
width:100%;
height:100%;
}
You need to set the height for the class .classic-img
Try this :
.classic-img {
display: block;
position: relative; /*---absolute to relative*/
overflow: hidden;
width: 100%;
height: 100px; /*----Adjust the height---*/
top: 0%;
left: 0%;
}
If you still face the issue, do come back and let us know.