This question already has answers here:
Stretch and scale a CSS image in the background - with CSS only
(22 answers)
Closed 8 years ago.
So my problem is i need my navbar background-image to go the entire distance of the page width wise. here is a fiddle: http://jsfiddle.net/faytAlvein/FDVby/4/
the black under the nav is fine ignore that. that's not there in the original because it's a different background image. just the width is the problem. it needs to scale 100% of the page no matter the window size. real background image is 1145x144 if that helps.
<div id="navbar" >
<div id="links" >
<a href="thisindexpage.php" class="navLink" >Home</a>
<a href="aboutUs.html" class="navLink" >About Us</a>
</div>
</div>
navbar.css
#navbar
{
background-image: url('../images/nav.png');
background-repeat: no-repeat;
background-color: black;
}
#links
{
font-size: 20px;
font-family: helvetica;
padding-top: 25px;
padding-bottom: 94px;
margin-left: 150px;
}
You could "stretch" your background image to 100%, using the background-size property.
background-size: 100%;
Your CSS:
#navbar {
background-image: url('../images/nav.png');
background-repeat: no-repeat;
background-color: black;
background-size: 100%;
}
http://jsfiddle.net/FDVby/7/
Use the background-size property
Here's the documentation: https://developer.mozilla.org/en-US/docs/CSS/background-size
Related
This question already has an answer here:
How to have both position fixed and background-attachment fixed?
(1 answer)
Closed 2 years ago.
I have a parent div which is holding links called #linkHolder. I have its position:fixed. The links have a background which have a background-attachment: fixed to give it that nice background effect. Those two things seem to cancel each other out. Is there a way around this issue?
#linkHolder {
display: block;
position: fixed;
top: 0;
width: 100%;
}
ul {
list-style-type: none;
overflow: hidden;
background-color: #1b242f;
text-align: right;
font-size: 22px;
width: 100%;
font-family: "Sansita Swashed";
}
ul li {
display: inline-block;
padding-right: 6%;
}
#homeLink {
background-image: url("/static/portfolioBackground/linkBackA.png");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
background-attachment: fixed;
}
<div id="linkHolder">
<ul>
<li><a id="homeLink" href="/">Home</a></li>
<li><a id="aboutLink" href="/about">About</a></li>
<li><a id="serviceLink" href="service">Services</a></li>
</ul>
</div>
Here's the issue on codepen I am having.
https://codepen.io/webdev154676/pen/VwjNoRN
Here's what I would like to have with the background image, but with the #linkHolder as position fixed, it will not work. Please help, and thank you for your time.
https://codepen.io/webdev154676/pen/rNLgBVv
From your question I'm understanding that the issue is that the background image is a little more blurred than what you would like to have.
For that i sudjest you to try using the background-size attribute and play around with it giving some sizes in % like
#homeLink{
background-size:90% 100%;
}
This question already has answers here:
How to apply a CSS filter to a background image
(22 answers)
Closed 3 years ago.
Hi I have <div class="jumbotron text-center"><nav>something</nav></div> this line of code and the jumbotron has some CSS effects something like
.jumbotron{
background: url("image-url") no-repeat center center;
-webkit-background-size: 100% 100%;
-moz-background-size: 100% 100%;
-o-background-size: 100% 100%;
background-size: 100% 100%;
background-size: cover;
height: 78vh;
filter: brightness(50%);
}
but all I want is only the jumbotron's background image gets the CSS effects, not the nav tag. currently, the nav tag inherits thefilter: brigtness (50%), is there anyway only the background-image gets the effect?
No, it's not possible. A filter will affect current element with all its contents (including children).
Therefore the way to go here is to move <nav> outside of .jumbotron, wrap them in a common relative parent and render <nav> above .jumbotron.
Proof of concept:
.relative {
position: relative;
}
.relative > .absolute {
position: absolute;
width: 100%;
top: 0;
/* making it visible */
background-color: rgba(255,255,255,.25);
border-bottom: 1px solid white;
color: white;
padding: 1rem;
box-sizing: border-box;
}
.jumbotron{
background: url("https://picsum.photos/id/237/1024/540") no-repeat center center /cover;
height: 78vh;
filter: brightness(50%);
}
<div class="relative">
<div class="jumbotron"></div>
<nav class="absolute">something</nav>
</div>
Feel free to rename the classes and adjust to your particular needs.
I'm trying to create a bootstrap jumbotron with a responsive background image because my first approach was static (and I have to fill the empty space with background-color: white !important;):
https://jsfiddle.net/ety0atsm/2/
And now I'm using this CSS but the height is not properly configured. How can I configure my background image to cover the entire screen all the time no matter what screen size uses the device?
https://jsfiddle.net/b40Lyep1/6/
Please check the example code at CODEPEN.
I hope this resolves your issue.. enjoy :)
HTML:
<div class="jumbotron"></div>
CSS:
body {
margin:0;
padding:0;
}
.jumbotron {
height: 600px;
background-repeat: no-repeat;
background-image: url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD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FTq5DqFYekprtSTVqo8oi66ZJTvbinF8zJO8o0p5EajMiHTe1PvGTUoNQfuutSJ8A1HEkvVB1bkc1FhXVqNRmnJcDwKR9TrxiM09pi662y1T89xobqLySjZLB9WRK8DgZlwxzMdRu97jadJ1FfqiHCknNJaZrhH3QZYN7O97/B43ueO0dKdXalVIkOLMqEqXFhpNEZh95S0MJM8mSEmeEkZ8cEOkAD/9k=');
background-size: contain;
}
Nice Question , deserves Upvote, Try This
<div class="jumbotron">
<p>Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web.</p>
</div>
.jumbotron {
margin-bottom: 0px;
background-image: url(../img/jumbotronbackground.jpg);
background-position: 0% 25%;
background-size: cover;
background-repeat: no-repeat;
color: white;
text-shadow: black 0.3em 0.3em 0.3em;
}
You can use height: 100vh property to do that. Here is the update fiddle
This question already has answers here:
How do I vertically center text with CSS? [duplicate]
(37 answers)
Closed 8 years ago.
i waited for 7 days to ask this question because i can't ask more question,
i want to keep the wrapper in the middle when people re-size the page
header {
background-image: url("http://lorempixel.com/400/200");
background-size: 100% 100%;
height: 100px;
}
#home {
position:absolute;
top:10px;
left:400px;
}
<header>
<img id="home" src="https://cdn2.iconfinder.com/data/icons/snipicons/5000/home-128.png" alt="home" style="width:75px;height:67px">
</header>
thnx
You could simply add text-align: center to the parent element. The img will respect this because it is inline by default.
Updated Example
header {
background-image: url("http://lorempixel.com/400/200");
background-size: 100% 100%;
height: 100px;
text-align: center;
}
See this answer for alternative approaches.
That should do it, if all you need is keeping the icon centred all the time you don't really need to absolute position it.
header {
background-image: url("http://lorempixel.com/400/200");
background-size: 100% 100%;
height: 100px;
text-align: center;
}
#home {
margin-top: 10px;
}
try this,
#home {
position:absolute;
top:10px;
left:48%;
}
So I have a couple of elements on a page that are sharing a background image.
My page is using bootstrap, and both elements are a 3 column width container. Each has a background and is contained via background-size.
On the 2nd element, I have made the background 90% in width so it is slightly smaller then the other background.
In Firefox this causes the 1st elements background to flicker constantly. If I change the CSS so both backgrounds are the same size, the problem goes away.
It works fine in Chrome and IE, it's just a Firefox issue.
Is this a bug, anyone had similar experience?
Tried switching the image out for an SVG and it stops the flickering. However it's not possibly to use an SVG in my case as the background image has heaps of grungy dirt, so the SVG is like 2MB.
Here is the jist of HTML and CSS:
<section id="content-panel">
<div class="container">
<div class="row-fluid">
<div id="thankyou-1" class="span3 bubble-bg-2">
</div>
<div id="thankyou-2" class="span3 bubble-bg-2">
</div>
</div>
</div>
</section>
.bubble-bg-2 {
background: url('/Content/Images/bg-bubble-2.png') no-repeat;
background-size: contain;
}
#thankyou-1 {
padding-top: 15px;
text-align: center;
}
#thankyou-2 {
background-position: center 25px;
background-size: 90% auto;
padding-top: 15px;
}
What happens if you move the background-size declaration off the shared class and set it on the #thankyou-1 id?
.bubble-bg-2 {
background: url('/Content/Images/bg-bubble-2.png') no-repeat;
}
#thankyou-1 {
background-size: contain;
padding-top: 15px;
text-align: center;
}
#thankyou-2 {
background-position: center 25px;
background-size: 90% auto;
padding-top: 15px;
}