Text over image, without affecting other texts on image - html

I have an image where 3 words are on, but I can't get the 3rd on it because it will not go in the position I want it. Here's the picture with words.
#clubname {
position: absolute;
margin-left: 26%;
color: #FFF;
line-height: 0px;
font-family: 'Knul-Bold';
}
#pacoins {
position: relative;
line-height: 84px;
margin-left: 13%;
max-width:5%;
max-height:5%;
color: #FFF;
font-family: 'Knul-Bold';
font-size: 17px;
}
#myclub {
position: relative;
margin-left: 30%;
line-height: 0px;
color: #FFF;
font-family: 'Knul-Bold';
font-size: 17px;
color: black;
}
<img src="http://packsimulator.nl/img/PAClubCover.png" style="position:absolute;">
<p id="clubname">Julan FC</p>
<p id="pacoins">97.000</p>
<p id="myclub">My Club</p>
As you can see 'My Club' isn't after the blue icon. Where it should be.

wrap these with a container/wrap div then use position:relative/absolute
.wrap {
position: relative;
width:400px /* width of image */
}
img {
position: absolute
}
p {
position: absolute;
color: #FFF;
line-height: 0;
font-family: 'Knul-Bold';
z-index: 1;
font-size: 17px
}
#clubname {
left: 40%;
}
#pacoins{
left: 25%;
top:22px;
}
#myclub {
left: 55%;
top:22px;
}
<div class="wrap">
<img src="http://packsimulator.nl/img/PAClubCover.png" />
<a href="#profile">
<p id="clubname">Julan FC</p>
</a>
<a href="#pacoins">
<p id="pacoins">97.000</p>
</a>
<a href="#club">
<p id="myclub">My Club</p>
</a>
</div>

You have to use float:left;.
Change your css to be like this
#pacoins {
position: relative;
line-height: 48px;
margin-left: 20%;
max-width: 5%;
max-height: 5%;
color: #FFF;
font-family: 'Knul-Bold';
font-size: 17px;
float:left;
}
#myclub {
position: relative;
margin-left: 42%;
line-height: 84px;
font-family: 'Knul-Bold';
font-size: 17px;
color: black;
}
Working JSFiddle here https://jsfiddle.net/dotcgtuc/1/
Hope this helps.

You will need to position it with position: absolute;. For example
#clubname {
position: absolute;
margin-left: 26%;
color: #FFF;
line-height: 0px;
font-family: 'Knul-Bold';
}
#pacoins {
position: relative;
line-height: 84px;
margin-left: 13%;
max-width:5%;
max-height:5%;
color: #FFF;
font-family: 'Knul-Bold';
font-size: 17px;
}
#myclub {
position: absolute;
left: 40%;
top: 45px;
line-height: 0px;
color: #FFF;
font-family: 'Knul-Bold';
font-size: 17px;
color: black;
}
<img src="http://packsimulator.nl/img/PAClubCover.png" style="position:absolute;">
<p id="clubname">Julan FC</p>
<p id="pacoins">97.000</p>
<p id="myclub">My Club</p>

OK, you have a couple things going on here that aren't quite recommended, but with reworking your html & css I believe I've produced the result you're looking for.
First, you're embedding paragraph tags <p> in anchor tags <a> - this is only HTML5 compatible because the p is a block element while anchor is inline. I'd suggest using span tags how you have it.
Secondly, your CSS uses percentages to place these elements - so once a browser resize takes place, your elements will all be thrown off. Putting this information together, I believe we can achieve the results you are looking for:
CSS
#clubname {
position: absolute;
top: 15px;
left: 255px;
color: #FFF;
font-family: 'Knul-Bold';
}
#pacoins {
position: relative;
top: 30px;
left: 100px;
max-width:5%;
max-height:5%;
color: #FFF;
font-family: 'Knul-Bold';
font-size: 17px;
}
#myclub {
position: relative;
left: 200px;
top: 32px;
color: #FFF;
font-family: 'Knul-Bold';
font-size: 17px;
color: white;
}
HTML
<img src="http://packsimulator.nl/img/PAClubCover.png" style="position:absolute;">
<span id="clubname">Julan FC</span>
<span id="pacoins">97.000</span>
<span id="myclub">My Club</span>
Fiddle

Related

White space at the end of my HTML / CSS site

So I just started making the site and there is a lot of white space at the bottom of my site...
I've been removing div but than on Inspect Element shows that the white space is because of <ul></ul> when I removed that tag it showed it is because of <body>
They say add margin: 0; padding:0 html,body { height:100%;} but nothing worked.
#font-face {
font-family: 'RobotoR';
src: url("/Roboto-Regular.ttf");
}
#font-face {
font-family: 'RobotoM';
src: url("/Roboto-Medium.ttf");
}
#font-face {
font-family: 'RobotoB';
src: url("/Roboto-Bold.ttf");
}
#font-face {
font-family: 'RobotoLi';
src: url("/Roboto-LightItalic.ttf");
}
html,body {height:100%;}
body{
overflow-x: hidden;
min-height: 100vh;
margin:0;
}
.navigacija a{
font-size: 21px;
font-family: 'RobotoR', sans-serif;
text-decoration: none;
z-index: 1;
}
nav ul li a {
color: black;
background-color: inherit;
padding: 0.5em 0.5em;
}
.navigacija a:hover {
color:#202020;
font-weight: bold;
}
.navigacija a:visited{
color: #202020;
font-weight: bold;
}
nav ul {
position: relative;
width: auto;
background: none;
height: auto;
bottom: 10em;
right: 5em;
display: flex;
float: right;
list-style-type: none;
z-index: 1;
}
.logo{
position: relative;
width: 20%;
left: 5.1em;
top: -2.5em;
}
.kontakttelmail {
position: relative;
top: -11.5em;
left: 83.9em;
font-family: 'RobotoLi', sans-serif;
word-spacing: 1em;
font-size: 15px;
opacity: 0.5;
}
.button {
background-color: white;
border: none;
color: #00A651;
padding: 20px 30px;
position: relative;
bottom: 85em;
left: 57.5em;
text-align: center;
border-radius: 35px;
text-decoration: none;
display: inline-block;
font-size: 21px;
font-family: 'RobotoB', sans-serif;
}
.zelenakrivina{
position: relative;
width: 90%;
right: -15em;
bottom: 8em;
padding: 0%;
margin: 0%;
}
.auto{
position: relative;
width: 49%;
right: -24.5em;
bottom: 44em;
padding: 0%;
margin: 0%;
}
.zelenisvg ul li{
position: relative;
bottom: 95em;
left: 80em;
text-decoration: none;
list-style-type: none;
}
.zelenisvg {
}
.Renault{
position: relative;
top: -0em;
right: 0.1em;
color: white;
font-size: 30px;
font-family: 'RobotoM', sans-serif;
padding: 0%;
margin: 0%;
}
.Megane{
position: relative;
top: -1.3em;
right: 1.1em;
color: white;
font-size: 40px;
font-family: 'RobotoB', sans-serif;
}
.lajna{
position: relative;
bottom: 124em;
left: 63.7em;
width: 11%;
}
.a30e{
position: relative;
top: -1.58em;
right: 0.7em;
color: white;
font-size: 100px;
font-family: 'RobotoB', sans-serif;
}
.nadan{
position: relative;
top: -11em;
right: -0.6em;
color: white;
font-size: 25px;
font-family: 'RobotoR', sans-serif;
}
.sivitext{
position: relative;
bottom: 22em;
font-family: 'RobotoB', sans-serif;
font-size: 60px;
left: 2.5em;
color: #212121;
}
.zelenitext{
position: relative;
bottom: 23.2em;
font-family: 'RobotoB', sans-serif;
font-size: 60px;
left: 2.5em;
color: #00A651;
}
.ispodnaslova{
position: relative;
bottom: 61.2em;
font-family: 'RobotoR', sans-serif;
font-size: 23.8px;
left: 6.3em;
color: #585858;
}
.scroll{
position: relative;
bottom: 110.9em;
/* left: 15em; */
width: 8%;
display: block;
margin-left: auto;
margin-right: auto;
}
.strelica{
position: relative;
bottom: 115.9em;
/* left: 15em; */
width: 4.2%;
display: block;
margin-left: auto;
margin-right: auto;
}
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>S T A R T - Rent-a-Car</title>
<link rel = "stylesheet"
type = "text/css"
href = "style.css" />
</head>
<header>
<img src="images/logo.png" alt="logo" class="logo">
<nav>
<ul class="navigacija" id="nav">
<li>Početna</li>
<li>Sva vozila</li>
<li>O nama</li>
<li>Kontkat</li>
</ul>
</nav>
<p class="kontakttelmail">email#gmail.com +382-68-222-333</p>
</header>
<body>
<div class="zelenisvg">
<img src="images/Path 1.svg" alt="zelenakrivina" class="zelenakrivina">
<img src="images/renault-migan-e1541771231987.svg" alt="renault" class="auto">
<p class="sivitext">Uz naša vozila ste</p>
<p class="zelenitext"> korak bliže cilju!</p>
<p class="ispodnaslova">Na vaš poziv dovodimo željeno<br>
vozilo na vašu adresu!</p>
<ul>
<li><p class="Renault">Renault</p></li>
<li><p class="Megane">Megane</p></li>
<li><p class="a30e">30€</p></li>
<li><p class="nadan">/na dan</p></li>
</ul>
<button onclick="location.href= 'Svavozila.html'" class="button">Rezervisi odmah!</button>
<img src="/images/Line 1.png" alt="linija" class="lajna">
<img src="images/Path 9.svg" alt="scroll" class="scroll">
<img src="/images/Path 2.png" alt="strelica" class="strelica">
</div>
</body>
<footer>
</footer>
Just like someone said in the comments section:
</body>
<footer>
</footer>
You can't have the footer outside the body element.
Take a look at this link:
https://css-tricks.com/snippets/html/html5-page-structure/
You'll understand how the HTML markup should look like :)
EDIT:
Your HTML seems to look better now but your CSS is breaking everything up. Why do you apply the position: relative to every single CSS rule you create ? Look https://jsfiddle.net/t23mkxz4/
I've removed position: relative and everything looks much better. Please - do some research on how to use the position: relative property :)
take a look at this link -> https://developer.mozilla.org/en-US/docs/Web/CSS/position
it's a great source of knowledge and examples. Good luch mate !

Div position pusing content

I am having trouble aligning my div so it doesn't push content below down, somehow if the asset name is more than one row, it will push down the metadata description down one row, I have tried positioning and flow and it seems now working, could some one please take a look to see what I have done wrong?
CSS
.port-container {
width: 490px;
height: 166px;
margin: 0px 0px 20px 0px;
float: left;
}
.port-container .port-image-link {
position: relative;
left: 10px;
}
.port-container .port-metadata-text {
padding: 50px 12px 10px 50px;
font-family: Arial, Helvetica, sans-serif;
color: #000;
font-size: 12px;
position: absolute;
margin-top: -180px;
margin-left: 173px;
z-index: 8;
line-height: 17px;
}
.port-container .port-image-link .port-text-link {
cursor: pointer;
width: 220px;
top: 138px;
position: relative;
text-decoration: none;
z-index: 9;
}
.port-container .port-image-link a {
text-decoration: none;
}
.port-container .port-image-link a span.port-text-link {
color: #fff;
font-family: Arial, Helvetica, sans-serif;
line-height: 17px;
position: relative;
top: -170px;
font-size: 12px;
text-decoration: none;
padding: 9px 50px 0px 0px;
font-weight: bold;
cursor: pointer;
left: 220px;
display: block;
}
.port-container .port-image-link a:hover span.port-text-link {
cursor: pointer;
text-decoration: underline;
}
HTML
<div class="port-container">
<div class="port-image-link">
%asset_thumbnail%<span class="port-text-link">%asset_name%</span>
<div class="port-metadata-text">%asset_metadata_DC.Description%</div>
</div>
</div>

Why won't the z-index on my elements work?

I have my code set up so I have the hero image at the bottom and the overlay on top with the text and button in overlay. I also have the navigation bar with a z-index but for some reason the button for my resume in overlay isn't working.
HTML
<div id="header">
<a href="index.html"><div id="leftHeader">
<img src="assets/logo2.jpg" alt="Logo" style="width:65px;height:65px">
<h1>Amanda Farrington</h1>
</div>
<div id="nav">
<ul>
<li>About</li>
<li>Work</li>
<li>Contact</li>
<li>Notes</li>
</ul>
</div>
</div>
<div id="hero">
<div id="heroImage">
<img src="assets/trees.jpg" alt="trees" style="width:100%;height:10%">
</div>
<div id="overlay">
<h2>Amanda Farrington</h2>
<h3>Graphic Artist | Web Designer</h3>
View Resume
</div>
</div>
CSS
#header {
color: #D7DADB;
font-family: 'Roboto', sans-serif;
font-weight: 300;
font-size : 15px;
text-align: left;
width: 100%;
padding-left: 3em;
position: relative;
height: 15%;
box-sizing: border-box;
padding-top: 1em;
}
#header img
{
float: left;
padding-left: 3em;
}
h1{
width: 9em;
float: left;
padding-left: 0.5em;
color: #45CCCC;
padding-bottom: 1px;
}
#nav {
width: 50%;
margin:0;
padding:0;
text-align: right;
color: red;
font-size:20px;
float: right;
padding-right: 2em;
z-index: 99;
}
#nav ul {
padding: 1px;
}
#nav li {
display: inline;
padding: 38px;
}
#nav li a {
color: #2C3E50;
text-decoration: none;
}
#nav li a:hover {
color: #45CCCC;
}
/*----------hero image styles-------------*/
#hero{
padding-top: 25em;
width: 100%;
height: 30em;
position: relative;
z-index: -1;
}
#heroImage
{
top: 9%;
width: 100%;
z-index: 1;
position: absolute;
}
#overlay{
width: 34em;
top: -15%;
margin-left: 30%;
z-index: 2;
position: relative;
clear: left;
}
h2{
width: 100%;
position: relative;
font-family: 'Roboto', sans-serif;
font-weight: 300;
font-size: 60px;
float: center;
color: white;
opacity: 1.0;
text-shadow: 2px 2px 3px #000000;
text-align: center;
}
h3{
width: 100%;
position: relative;
font-family: 'Roboto', sans-serif;
font-weight: 300;
font-size: 30px;
color: #e5e5e5;
opacity: 1.0;
text-shadow: 2px 3px 2px #000000;
text-align: center;
}
a.down{
z-index: 100;
font-family: 'Roboto', sans-serif;
font-weight: 400;
text-decoration: none;
color: #181b1e;
background: #45CCCC;
position: relative;
padding: 0.6em 0.2em;
font-size: 1.2em;
-webkit-border-radius: 6px;
width: 30%;
position: relative;
display: block;
margin-left: auto;
margin-right: auto;
text-align: center;
}
a.down:hover{
text-decoration: underline;
color: white;
}
Because z-index works only on elements which are NOT set asposition: static. Bear in mind that every element is set as default to position:static.
Try set to position:absolute; or relative your element.
Also all other types of positioning, like position:fixed, position:sticky.
So I've taken a look at your code and the reason your button doesn’t work is because the div with the ID of #hero (which contains the button) is below the body because it has a z-index of -1.
Set the z-index for #hero to 0 or higher and the button will work.
#hero {
padding-top: 25em;
width: 100%;
height: 30em;
position: relative;
z-index: 0;
}
Check out this JS Fiddle I've created for you:
https://jsfiddle.net/8fqwr6ca/
Edit: Oh, and I forgot to mention–since you want the image to be below, set the #hero 's z-index to 1, set #heroImage to 0, and overlay to 2. That should do the trick (if what I think you want is correct).

Explanation why Height=100% breaks design

I have a problem with the Height Tag in CSS. I want the page to be displayed without any scrollbars and just can't figure out why when i change "height" in the body tag from 99% to 100% suddenly scrollingbars appear and break the design.
I want to know why this happens and what's the reason for it.
thanks!
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html {
height:100%;
}
body {
height: 99%;
margin-left: 20px;
margin-top:0px;
}
.gallerytitle {
position: absolute;
top: 20px;
font-family: serif;
font-size: 20px;
text-align: left;
}
.fullgallerytitle {
text-align: left;
font-family: sans-serif;
font-size: 12px;}
.events{
position: absolute;
font-family: sans-serif;
font-size: 12px;
top: 20px;
right: 20px;}
/* Center Text Section */
.area {
width: 100%;
height: 100%;
position: relative;
}
.middlespace {
position: absolute;
left: 50%;
top: 50%;
display: table;
}
.middlespace p {
display: table-cell;
vertical-align: middle;
text-align: center;
}
.bottom-left {
position: absolute;
font:sans-serif;
bottom: 15px;
left: 15px;
}
.contact {
font-size: 11px;
font-family: sans-serif;
border-bottom: 1px black dotted;
}
.exhibitiontitle {
color: #d4d4d4;
font-style: italic;
font-family: sans-serif;
font-size: 10px;
text-align: center;
}
.contact {
font-size: 11px;
font-family: sans-serif;
border-bottom: 1px black dotted;
}
.bold {
font-family: serif;
}
.about {
font-size: 11px;
font-family: sans-serif;
}
.address {
font-size: 11px;
border-bottom: 1px grey dotted;
}
.bottom-right {
position: absolute;
bottom: 15px;
right:15px;
font-style: italic;
color: #8e8e8e;
font-size: 11px;
}
.openinghours {
font-style: italic;
color: #8e8e8e;
font-size: 11px;
}
.subscribebutton
{
height:10px;
font-size: 9px;
}
.subscribebox
{
height:10px;
font-size: 9px;
}
</style>
<title>XYZ</title>
</head>
<body>
<div class="gallerytitle">XYZ<br /></div>
<div class="events">LOREM</div>
<div class="bottom-left">
<span class="about">
<span class="bold">XYZ</span> is a project by XZY. |
<span="address">Website Information</span> — info#info.com
</span>
</div>
<div class="bottom-right">
<span class="openinghours">Open by Appointment</span><span class=""> sponsored by XYZ</span>
</div>
</body>
</html>
There is also bottom margin on the body.
body {
height: 100%;
margin: 0 0 0 20px;
}
Though you should consider using a css reset such as eric meyers reset or normalize
Replacing your body style with this should solve the issue :
body {
height: 100%;
margin-left: 20px;
margin:0px;
}
It breaks the page because you use 99% of the page, then you move everything to the right of 20px. it moves the 99% outside and use more. here is the solution, i think both of them work :
body {
height: 100%;
margin-left: 20px;
margin-right: -20px;
margin-top:0px;
}
or
body {
height: 100%;
padding-left: 20px;
padding-right: -20px;
margin-top:0px;
}

Text over an image in Internet Explorer

I currently have a problem with my z-index with IE.
I have a div, an image in this div and some text over this image.
Here is my HTML code:
<section id="content_right">
<div class="mini_bloc_image">
<img alt="Camionnette VCI" src="img/mini_reparation_site_nb.png" />
<span>Réparation sur site</span>
<span>Nous nous déplaçons</span>
</div>
and the CSS:
#content_right {
width: 230px;
height: 484px;
float: right;
}
.mini_bloc_image {
height: 148px;
margin-bottom: 20px;
position: relative;
}
.mini_bloc_image > img {
position: absolute;
}
.mini_bloc_image > span:first-of-type {
display: block;
position: absolute;
top: 95px;
left: 0px;
font-size: 1.1em;
background-color: #ffffff;
padding: 4px 5px 4px 5px;
}
.mini_bloc_image > span:last-of-type {
display: block;
top: 95px;
left: 0px;
position: absolute;
left: 50px;
top: 125px;
color: #ffffff;
font-size: 1.1em;
font-family: 'Marck Script', cursive;
}
IE don't understand my text must be OVER the image...
I found some solutions like this http://www.adrenatie.com/z-index-et-ie6/ or this http://systembash.com/content/css-z-index-internet-explorer/ but it don't works.
Can someone help me please?
Problem is you're dealing with spans, which are rendered inline by default. If you use display:block, the z-index will be used:
.mini_bloc_image > span:first-of-type {
display: block;
position: absolute;
z-index: 10;
font-size: 1.1em;
background-color: #ffffff;
padding: 4px 5px 4px 5px;
margin-top: 95px;
}
.mini_bloc_image > span:last-of-type {
display: block;
position: absolute;
z-index: 10;
color: #ffffff;
font-size: 1.1em;
font-family: 'Marck Script', cursive;
margin-left: 30%;
margin-top: 125px;
}
For more about inline elements and positioning, see this article.