I am trying to set a background image for a header. This is what I want it to look like:
This is what I am getting:
So, a tiny weird strip at the bottom end. Here is my code:
html
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>title</title>
<link rel="stylesheet" type="text/css" href="styles.css">
<script type="text/javascript" src="jquery-3.1.0.min.js"></script>
<script type="text/javascript" src="JavaScript2.js"></script>
</head>
<body>
<div id="header">
<nav class="cf" id="menu">
<ul>
<li>ABOUT</li>
<li>FOLK</li>
<li>JAZZ</li>
<li>SIGNATURE</li>
<li>NYLON</li>
<li>CONTACT</li>
</ul>
</nav>
</div>
<div id="container">
<div id="logo">
<img id="rays" src="Images/PNGs/rayons.png">
<img id="base" src="Images/PNGs/baseLogo.png">
<img id="roue" src="Images/PNGs/roue.png">
<img id="letters" src="Images/PNGs/title.png">
</div>
</div>
<div id="footer">
</div>
<script type="text/javascript" src="JavaScript2.js"></script>
</body>
</html>
css
html, body {
margin: 0px;
padding: 0px;
height: 100vh;
}
#header {
position: absolute;
background-image: url("Images/menu.jpg");
width: 100vw;
height: 10vh;
opacity: 1;
z-index: 6;
background-size: 100% 100px;
}
I have tried adding a size property to the background, like so:
background-size: 100% 100px;
And that's how I am getting the tiny strip at the bottom. Without that property I get nothing at all. Also, the header is not as long as the page although I have set the width at 100vw. Thanks of your time.
I made some changes to your header:
#header {
/*position: absolute;*/
background-image: url("Images/menu.jpg");
/*width: 100vw;
height: 10vh;
opacity: 1;
z-index: 6;*/
background-size:cover;/*added this*/
padding: 5px;/*added this*/
}
JSfiddle: https://jsfiddle.net/sg7dfpzj/
Hope that helps, cheerio!
Remove height for #header Class
#header {
position: absolute;
background-image: url("Images/menu.jpg");
width: 100vw;
/*height: 10vh;*//*Remove this*/
opacity: 1;
z-index: 6;
background-size: 100% 100px;
}
Add a padding top and bottom for the header until you have all the image showing, the problem with empty spaces, you dont tell the browser how to show the image,
add some more content or add a padding top and bottom.
Where is your code for the class="cf" and id="menu" for the line <nav class="cf" id="menu"> in the body section of the HTML code?
There might be an error there. Check it out.
Related
I'm trying to display an html webpage that has an image that covers the entire page. Text that is centered at the top of image, but obviously in front so it can be seen.
Example : https://gyazo.com/8f7015a61a296f71c02e2b4030710074
This is what I'm getting :https://gyazo.com/0a2f9ad37eaf05cd1cb5a623f75d6bca
My text is displaying at the bottom, nor is it over the image.
Here is my CSS:
body {
background-color:brown;
}
.container {
position: relative;
text-align: center;
}
.title {
position: absolute;
top: 50%;
left: 50%;
text-align:top;
}
Here is my HTML:
<!doctype HTML>
<html>
<body>
<div class="container">
<img src="images/image.jpg" alt="Loading Image.." style="width:100%;">
<div class="title">Oregon Trail:Marist Edition</div>
</div>
<link rel="stylesheet" type="text/css" href="/css/index.css">
</body>
</html>
Can someone show me what I'm doing wrong?
Check this. You have given the style for .title instead of .Title. Please check that. Everything else works as expected.
body {
margin: 0;
}
.container {
position: relative;
text-align: center;
}
.title {
position: absolute;
top: 10px;
left: 0;
right: 0;
}
<html>
<body>
<div class="container">
<img src="https://www.dike.lib.ia.us/images/sample-1.jpg/image" alt="Loading Image.." style="width:100%;">
<div class="title">Oregon Trail:Marist Edition</div>
</div>
<link rel="stylesheet" type="text/css" href="/css/index.css">
</body>
</html>
Hey guys i have been trying to make this header or nav bar full screen without padding, but not able to. Tried making padding 0 but couldnt. Please help me guys as i have been trying this since a long time. Cheers
Here is my code:-
<!DOCTYPE html>
<html>
<head>
<title>Shopifter</title>
<link rel="stylesheet" type="text/css" href="style1.css">
</head>
<body>
<header>
<nav>
<div> Home </div>
<div align="center"> <h2>Welcome to Shopifter</h2></div>
<div align="right">
<button> Sign in</button>
<button> Sign up</button>
</div>
</nav>
</header>
</body>
</html>
body {
background-color: grey;
}
header {
margin: 0 auto;
width: 100%;
height: 100px;
background-color: #fff;
padding: 0;
}
header nav {
margin: 0px;
width: 100%;
height: 100px;
background-color: #fff;
}
Set to your body margin to 0: body {margin: 0;}.
If you would like to keep this margin for the body, add the negative margin to the header nav {margin: -8px;}, but also remove from there width: 100%;.
add margin: 0; to the body
enter image description here
I am trying to figure out how to test how my code works but I cant seem to figure out why they wont link. They are in the same folder. I am also trying to add a facebook pixel and analytics to this page. Would I embed that code into my HTML file?
Thanks in Advance
Here is my code
Html
<!DOCTYPE html>
<head>
<title>Full Screen Landing Page</title>
<link href rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<section class="intro">
<div class="inner">
<div class="content">
<h1>Welcome To The Tribe</h1>
<a class="btn" href="#">Get Started</a>
</div>
</div>
</section>
</body>
</html>
#import url('https//fonts.googleapis.com/css?family=Raleway');
#import url('https//fonts.googleapis.com/css?family=Oswald');
html, body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
.intro{
height: 100%;
width: 100%;
margin: auto;
background: url() no-repeat 50% 50%;
display: table;
top: 0;
background-size: cover;
}
.intro .inner{
display: table-cell;
vertical-align: middle;
width: 100%;
max-width:none;
}
it not <link href rel="stylesheet" href="style.css">
its
<link rel="stylesheet" href="style.css">
it read the initial href value as it is empty its not reading any css file
You shouldn't need to have href before rel when you link your stylesheet. Also, you have a closing html tag but no opening html tag.
Either put your custom css classes into the style.css file, or use style tag to include them, also you have duplicate href attribute inside link tag
<head>
<title>Full Screen Landing Page</title>
<link rel="stylesheet" type="text/css" href="style.css">
<style>
html, body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
.intro{
height: 100%;
width: 100%;
margin: auto;
background: url() no-repeat 50% 50%;
display: table;
top: 0;
background-size: cover;
}
.intro .inner{
display: table-cell;
vertical-align: middle;
width: 100%;
max-width:none;
}
</style>
</head>
<body>
<section class="intro">
<div class="inner">
<div class="content">
<h1>Welcome To The Tribe</h1>
<a class="btn" href="#">Get Started</a>
</div>
</div>
</section>
</body>
I'm trying to add an image to my "welcome" ID but the image wont display.
Here is my CSS and HTML:
body {
margin: 0;
width: 100%;
height: 100%;
font-family: Helvetica;
}
.header {
width: 100%;
height: 35px;
background-color: rgba(0, 0, 0, 0.3);
}
#welcome {
background-image: url(../images/Welcome.jpg);
width: 100%;
height: 100%;
}
<!DOCTYPE html>
<html>
<head>
<title>Template</title>
<link rel="stylesheet" href="design.css">
<link rel="stylesheet" type="text/css" href="simplegrid.css">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<div class="header">
<div class="grid grid-pad">
<div class="col-1-3">
<h1>Logo</h1>
</div>
<div class="col-2-3">
About
What we do
Who we are
Our Work
Contact Us
</div>
</div>
</div>
<section id="welcome">
</section>
</body>
</html>
I've tried both single and double quotes inside the url box. I have also added the image to the body using tags and it displayed that way, but for some reason it wont display through the style sheet. I have also tried embedded and inline css, neither has worked.
Any help would be appreciated.
The section will just take a 0px width and height since it doesnt have any content. Either add come content, which will then force it to expand to its height, or gives fixed heights, like below. That should ideally work.
body {
margin: 0;
width: 100%;
height: 100%;
font-family: Helvetica;
}
.header {
width: 100%;
height: 35px;
background-color: rgba(0, 0, 0, 0.3);
}
#welcome {
background-image: url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxITEhUTExMWFhUXFxUVGBgYGBcYFxgYGBUXFxgWFhcYHSggGBolHRUYITEiJSkrLi4uGh8zODMtNygtLisBCgoKDg0OGhAQGi8lHx0tLS0tLS0tLS0tLS0tLS0tLSstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLf/AABEIAHsBmgMBIgACEQEDEQH/xAAcAAACAwEBAQEAAAAAAAAAAAADBAECBQAGBwj/xAA5EAABAwIEAwYEBQMEAwAAAAABAAIRAyEEEjFBUWFxBSKBkaHwBhOx0TJCUsHhByPxFDNichUWkv/EABkBAAMBAQEAAAAAAAAAAAAAAAABAgMEBf/EACMRAAICAgMAAwADAQAAAAAAAAABAhEDIRIxQQQTUSIyYRT/2gAMAwEAAhEDEQA/APlbQrQqgqZldxkSrAqoRA1NCZLUXLZUa1FDh4qkQwc7I4pGAfNCY26eaw2VITYGm0TcFXIF4bHXoj5ANb9PopDZA+nVBFnYZ0eqaLTlaRpHj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VVyrN1zhBQM4lVUlc5ICFSFaFVIZ/9k=);
width: 400px;
height: 100px;
}
<!DOCTYPE html>
<html>
<head>
<title>Template</title>
<link rel="stylesheet" href="design.css">
<link rel="stylesheet" type="text/css" href="simplegrid.css">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<div class="header">
<div class="grid grid-pad">
<div class="col-1-3">
<h1>Logo</h1>
</div>
<div class="col-2-3">
About
What we do
Who we are
Our Work
Contact Us
</div>
</div>
</div>
<section id="welcome">
</section>
</body>
</html>
The reason it won't display is because you applied height: 100% to #welcome, however, the browser doesn't actually know what that size is because percentage values are relative to the immediate parent. In this case the immediate parent is the body tag which you've also set to height: 100%, but yet again the browser can't calculate that either. This time it's because you have not defined the height of the body tag's parent, which is the html tag. So because the html tag's height is undefined and it is the parent of the body tag, the browser has no reference value to calculate 100% height from. So both the body tag and #welcome's heights are 0.
You can set your CSS like so.
html {
min-height: 100%; // this will reference the viewport but could become bigger than viewport depending on your content
}
body {
height: 100%;
}
#welcome {
height: 100%;
}
Another option would be to set #welcome to be 100% of the viewport like so:
#welcome {
height: 100vh;
}
Hope this helps.
I created a print style sheet which links to my html page. Changes to the font, colors etc. work in the print version, but I can not change the size of my divs in the print version. For example, if I have a content div that is 300px X 300px on my page, it won't change it if I change the dimensions in the print version.
To figure out the root of the problem, I used inspect element to see if an css was overriding that in my print page. I found that the content div width is controlled by the body width. So I tried changing the content height and the body div in the print stylesheet. That did not work. I also tried creating a separate style sheet for both the main css and the print css. That did not work. Is there another way I can troubleshoot this issue...something similar to breakpoints maybe, but for html?
HTML:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--- TITLE - FROM SPECIFIC TO GENERAL --->
<title>Page</title>
<cfinclude template="/assets2011/webfonts/comment.htm" />
<link rel="stylesheet" type="text/css" href="/assets2011/MyFontsWebfontsOrderM2845569_css.css" />
<link rel="stylesheet" type="text/css" href="/assets2011/css/global.css" />
<link href="print.css" type="text/css" rel="stylesheet" media="print"/>
<style>
body{
width: 8700px;
height:2000px;
overflow: hidden;
}
#section{
width: 8000px;
float: left;
height: 1000;
z-index: 1;
}
#content{
width: 1000px; height:300px; margin-top: 10px; margin-left: 50px; overflow: auto;
}
.navbarLeft{
height: 700px;
width: 40px;
top:0;
z-index: 2;
position:absolute;
background-position: 50% 30%;
background-image: url(navL.png);
background-repeat: no-repeat;
opacity: 0.05;
}
.navbarLeft:hover{
opacity: 0.5;
}
.navbarRight{
height: 700px;
width: 40px;
top: 0;
z-index: 2;
position: absolute;
background-position: 50% 30%;
background-image: url(navR.png);
background-repeat: no-repeat;
opacity: 0.05;
left: 2013px;
}
.navbarRight:hover{
opacity: 0.5;
}
table,tr,td {
border:1px solid black;
}
</style>
</head>
<body>
<!--Factor 1-->
<div class="section" id="factor1">
<div id="content">
<!--Begin Content-->
<p>textiyiuypilkhjkujp;mjl;juipoupoj;hikhiyuiuj</p>
</div>
<!--End Content-->
<!-- Navigation -->
<ul class="nav">
<div class= "navbarLeft" id="menu" style="left: 755px;"></div>
</ul>
</div>
<!--End Factor 1-->
<!--Factor 2-->
<div class="section" id="factor2">
<div id="content">
<p>text2khlikhlkj;ljlji0piomloj;lkjoippm,klikp</p>
</div>
<ul class="nav">
<a href="#factor1"><div class= "navbarRight" id="menu" style="left: 2005px;"></div>
</a>
<div class= "navbarLeft" id="menu" style="left: 2755px;"></div>
</ul>
</div>
<!--End Factor 2-->
<!--JavaScript-->
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="../newUI/jquery.easing.1.3.js"></script>
<script type="text/javascript">
$(function() {
$('ul.nav a').bind('click',function(event){
var $anchor = $(this);
$('html, body').stop().animate({
scrollLeft: $($anchor.attr('href')).offset().left
}, 1000);
event.preventDefault();
});
});
</script>
</body>
</html>
CSS Print Style Sheet:
body{
width: 1000px;
}
#section, .navbarLeft, .navbarRight{
display:none;
}
#content{
font-size: 110px;
overflow:visible;
height: 1000px;
page-break-after: always;
margin-top:10px;
margin-left:50px;
}
p a:after {
content: " (" attr(href) ")";
font-size: 50%;
}
I have found that the Chrome browser developer tools are fantastic for debugging CSS issues.
Open the page in Chrome and hit F12
Look to the right on the elements tab and you'll see all the CSS that is being applied to the HTML element selected on the left.
You can edit the CSS in place in the toolbox and it will immediately update the browser window with your changes.
More information about the tools can be found here: https://developers.google.com/chrome-developer-tools/