Reputation: 67
I have an image on my website and there is about 50px of extra white space at the top. I have tried padding none and margin none, display block but none of them work. Here is a working jsfiddle of it. Here's my HTML
h1 {
font-size: 100px;
color: white;
text-align: center;
opacity: none;
font-family: 'Noto Sans', sans-serif;
}
p {
font-family: 'Roboto Condensed', sans-serif;
font-size: 70px;
color: black;
text-align: center;
}
.rotate {
float: left;
-webkit-transform: rotate(180deg) 2s;
transform: rotate(180deg) 2s;
transition: all 2s ease;
transition-delay: 0.4s;
}
.rotate:hover {
-webkit-transform: rotateZ(-360deg);
-ms-transform: rotateZ(-360deg);
transform: rotateZ(-360deg);
}
.container {
overflow: hidden;
font-family: 'Roboto Condensed', sans-serif;
position: static;
z-index: 150;
margin-bottom: -80px;
}
.container a {
float: right;
font-size: 20px;
color: black;
text-align: center;
padding: 40px 70px;
text-decoration: none;
transition: background 1s;
}
.dropdown {
float: right;
overflow: hidden;
}
.dropdown .dropbtn {
font-size: 20px;
border: none;
outline: white;
color: black;
padding: 40px 70px;
background-color: inherit;
font-family: 'Roboto Condensed', sans-serif;
transition: background 1s;
}
.container a:hover, .dropdown:hover .dropbtn {
background-color: lightgreen;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
border-right: 1px solid #bbb;
}
.dropdown-content a {
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
font-size: 18px;
}
.dropdown-content a:hover {
background-color: #ddd;
border-right: 1px solid #bbb;
}
.dropdown:hover .dropdown-content {
display: block;
}
<body>
<div class="active">
<div id="background">
<div class="opacity">
<div class="container">
<div class="rotate">
<img class="chiz" src="kkk.png" alt="Vortex Games">
</div>
<a href="index.html">Home</a>
<a href="about.html">About</a>
<a href="FAQ.html">FAQ</a>
<a href="games.html">Games</a>
<div class="dropdown">
<button class="dropbtn"
onclick="window.location.href='store.html'">Store</button>
<div class="dropdown-content">
<a href="wall.html">Powerups</a>
<a href="store.html">Coins</a>
</div>
</div>
</div>
</div>
<p class="title">
We're a top-of-the-line high tech <br>game company
<br>
<span style="color:white;font-size:20px;padding:none;display:inline-
block;">
<span style="color:red;font-size:100px;padding-top:none;">
–<br></span>Driven by passion. Always at our best.</span>
</p>
<!--the background div-->
</div>
<div class="creative">
<img src="cree.jpg" align="abstop">
</div>
CSS
Any help would be appreciated.
Thanks
Upvotes: 0
Views: 2497
Reputation: 7122
You need to add *{margin:0;padding: 0;}
this in your css. Because its not only about your image property. You have more element which has some default css property, which is and can affect your html. * make a universal tag
*{
margin:0;padding: 0;
}
.creative {
padding-top: none;
}
img {
display: block;
}
body {
/*body:0;*/
}
#background {
background: url('https://sellorelse.ogilvy.com/wp-content/uploads/2016/06/creativity_technology.png');
background-position:center top;
}
h1 {
font-size: 100px;
color: white;
text-align: center;
opacity: none;
font-family: 'Noto Sans', sans-serif;
}
p {
font-family: 'Roboto Condensed', sans-serif;
font-size: 70px;
color: black;
text-align: center;
}
.rotate {
float: left;
-webkit-transform: rotate(180deg) 2s;
transform: rotate(180deg) 2s;
transition: all 2s ease;
transition-delay: 0.4s;
}
.rotate:hover {
-webkit-transform: rotateZ(-360deg);
-ms-transform: rotateZ(-360deg);
transform: rotateZ(-360deg);
}
.container {
overflow: hidden;
font-family: 'Roboto Condensed', sans-serif;
position: static;
z-index: 150;
margin-bottom: -80px;
}
.container a {
float: right;
font-size: 20px;
color: black;
text-align: center;
padding: 40px 70px;
text-decoration: none;
transition: background 1s;
}
.dropdown {
float: right;
overflow: hidden;
}
.dropdown .dropbtn {
font-size: 20px;
border: none;
outline: white;
color: black;
padding: 40px 70px;
background-color: inherit;
font-family: 'Roboto Condensed', sans-serif;
transition: background 1s;
}
.container a:hover, .dropdown:hover .dropbtn {
background-color: lightgreen;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
border-right: 1px solid #bbb;
}
.dropdown-content a {
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
font-size: 18px;
}
.dropdown-content a:hover {
background-color: #ddd;
border-right: 1px solid #bbb;
}
.dropdown:hover .dropdown-content {
display: block;
}
<div class="active">
<div id="background">
<div class="opacity">
<div class="container">
<div class="rotate">
<img class="chiz" src="kkk.png" alt="Vortex Games">
</div>
<a href="index.html">Home</a>
<a href="about.html">About</a>
<a href="FAQ.html">FAQ</a>
<a href="games.html">Games</a>
<div class="dropdown">
<button class="dropbtn" onclick="window.location.href='store.html'">Store</button>
<div class="dropdown-content">
<a href="wall.html">Powerups</a>
<a href="store.html">Coins</a>
</div>
</div>
</div>
</div>
<p class="title">
We're a top-of-the-line high tech <br>game company
<br>
<span style="color:white;font-size:20px;padding:none;display:inline-block;">
<span style="color:red;font-size:100px;padding-top:none;">
–<br></span>Driven by passion. Always at our best.</span>
</p>
<!--the background div-->
</div>
<div class="creative">
<img src="http://drwillsparks.com/wp-content/uploads/2017/02/creativity.jpg" align="abstop">
</div>
Upvotes: 3
Reputation: 795
By default html page has margin values. Add this to avoid those spaces
* {
margin: 0;
padding: 0;
}
Upvotes: 0
Reputation: 1231
It occurs because of some browser preset margin on the p element. You can remove it with this:
p.title {
margin-bottom: 0px;
}
Upvotes: 0