http://codedifferently.com/crest.html is the page that I am working on.
This is my CSS file:
#charset "UTF-8";
/* CSS Document */
/* Move down content because we have a fixed navbar that is 50px tall */
body {
padding-top: 0px;
padding-bottom: 0px;
margin: 0px;
}
div.jumbotron {
background-image: url('img/chicago2.jpg');
background-color: #CCC;
background-size: cover;
height: 450px;
background-repeat: no-repeat;
background-position: center center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
border: none;
margin-top: 0px;
padding: 0px;
}
div.navbar navbar-default navbar-static-top" role="navigation {
border: 0px;
}
/* Center align the text within the three columns below the carousel */
.marketing .col-lg-4 {
margin-bottom: 0px;
text-align: center;
}
.marketing h2 {
font-weight: normal;
}
.marketing .col-lg-4 p {
margin-right: 0px;
margin-left: 0px;
}
.featurette-divider {
margin: 80px 0; /* Space out the Bootstrap <hr> more */
}
/* Thin out the marketing headings */
.featurette-heading {
font-weight: 300;
line-height: 1;
letter-spacing: -1px;
}
/* RESPONSIVE CSS
-------------------------------------------------- */
#media (min-width: 768px) {
/* Navbar positioning foo */
.navbar-wrapper {
margin-top: 0px;
}
.navbar-wrapper .container {
padding-right: 15px;
padding-left: 15px;
}
.navbar-wrapper .navbar {
padding-right: 0;
padding-left: 0;
}
/* The navbar becomes detached from the top, so we round the corners */
.navbar-wrapper .navbar {
border-radius: 4px;
}
/* Bump up size of carousel content */
.carousel-caption p {
margin-bottom: 20px;
font-size: 21px;
line-height: 1.4;
}
.featurette-heading {
font-size: 50px;
}
}
#media (min-width: 992px) {
.featurette-heading {
margin-top: 120px;
}
}
I am using the Jumbotron preset on the Bootstrap framework.
How do I get rid of the borders on the background image and what should I do to add margins/padding on the featurettes to take them away from the edge? I've put my jumbotron.css file at the top of my source code but it does not have any effect. Is it because of the bootstrap css files interfering?
I dont see borders on your example, however, I see a padding which comes in bootstrap with the Jumbotron, so if you mean borders by the space you cant work in: Jumbotron uses a padding of 30px by standard. You can overwrite that with:
.jumbotron {padding: 0px;}
However, your css on that page is different on how you posted it. Your CSS given on your page as Jumbotron class is as followed.
div.jumbotron {
background-image: url('img/chicago2.jpg');
background-color: #3FF;
background-size: cover;
height: 500px;
background-repeat: no-repeat;
background-position: center center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
border: none;
}
So either you havent updated your stylesheet to what is up there, or you made a typo somewhere.
So i checked of in the image the padding 30px, plus the padding top and bottom from your media query, and it works completely fine. Also, because you have added a container to your text, you are bound by the size of the container too. Remind that, if you think it wont outline to the left side of your screen.
Also it has some media queries on certain sizes, you might have to alter those too.\
-- edit --
Dont wanna talk out of line btw, but youre getting a internal server error on your bootstrap.min.js and your viewport work arround for IE-10 .
Last but not least. you are calling the bootstrap min file prior to the jquery file, which is a no-no, bootstrap wont function if jquery isn't called before the bootstrap file. Remove the upper bootstrap in your head, else it will causes errors, which it does btw as first error, since you also put bootstrap in yoru scripts below the footer, you re good to go
Related
Trying to create this site and fairly new to html, trying to find ways of just adding a simple bar across or over
my background, without it repeating with the background image, i just want the thing at the top
like a background to the nav bar,
kinda tried just adding the enter code herecolor to the background img on photoshop, but of course it repeats that, which aint what im looking for
heres my stuff some helps appreciated.
.navbar {
width: 100%;
background-color: #555;
overflow: auto;
position:absolute;
}
/* Navbar links */
.navbar a {
float: left;
text-align: center;
padding: 12px;
color: white;
text-decoration: none;
font-size: 25px;
}
/* Navbar links on mouse-over */
.navbar a:hover {
background-color: #000;
}
#media screen and (max-width: 500px) {
.navbar a {
float: none;
display: block;
padding-top:50px;
}
}
<link href=CrimsonRainer Site/CrimsonRainer.css" rel="stylesheet" type=text/css>
* {
margin: 50;
padding-top: 50;
}
html,
body {
overflow:auto;
background-color: #021027;
background-image:url("sky.jpg");
background-repeat:repeat;
background-size:cover;
}
An element can have several background images, and they each can be set to repeat or not individually. One of the images could be a linear-gradient with your color in it.
The background images are 'drawn' in reverse order, that is, the one that is listed first will overwrite the next one listed and so on.
Not knowing exactly what you want here is a little example where the div has a repeating background image but at the top is a colored bar which is not repeated.
div {
width: 100vw;
height: 100vh;
background-image: linear-gradient(cyan, cyan), url(https://picsum.photos/id/1015/200/300);
background-size: 100% 20%, 20% auto;
background-repeat: no-repeat no-repeat, repeat repeat;
}
<div></div>
Currently trying to add an image to my section-'header'. Soon we have to make the site responsive, and I am currently struggling with getting the full picture to resize, when resizing the browser-window
when I use background-size: cover;, resizing will cut off a lot of the image. When using background-size: 100%;, it will leave a massive "chin", which just adds up empty-space under the page's buttons which is nothing more than just the background-color + it will get somewhat squeezed into the header (the header is fixed).
Do not mind the header-content itself. making that responsive will be done in the future
Is there a way I can combat this?
CSS
hero-image {
background-image: url(/img/header-background.jpeg);
background-size: cover;
background-repeat: no-repeat;
overflow:hidden;
width: 100%;
}
#page-header {
height: 100vh;
background-color: #1c1b39;
color: #ffffff;
}
#page-header h1 {
padding-top: 15%;
font-size: 3em;
letter-spacing: 0.1em;
text-transform: uppercase;
}
#page-header p {
padding-top: 1%;
font-size: 1.5em;
max-width: 780px;
margin: 0 auto;
opacity: 0.5;
}
button {
margin-top: 5%;
border-radius: 30px;
width: 300px;
height: 60px;
text-transform: uppercase;
font-size: 1.5em;
}
#button-reserve, #button-trailer:hover {
background-color: #ff4242;
}
#button-reserve:hover, #button-trailer{
background-color: inherit;
border: 5px solid #ff4242;
color: #ff4242;
}
#button-reserve:hover, #button-trailer:hover{
transition: 0.5s;
}
#button-reserve {
color: #ffffff;
border-style: none;
}
#button-trailer:hover {
color: #ffffff;
}
html
<section id="page-header" class="hero-image">
<h1>Buitenaards leuk: Coderen!</h1>
<p>Op een leuke en speelse manier de vaardigheden van de toekomst ontdekken. Ideaal voor het basisonderwijs</p>
<button id="button-reserve">Reserveer workshop</button>
<button id="button-trailer">Bekijk trailer</button>
</section>
Just quickly looking at this, have you considered using background-size: contain; rather than cover?
It will allow the background to be responsive but does have limitations.
Using background-size: cover; will resize the background image to make sure the element is fully covered. Stretching it to fit top-to-bottom. Depending on the image dimensions, this may display only a part of the image, and not all of it.
But using background-size: contain; resizes the background image to make sure it remains fully visible.
So the code below will make your image responsive, but it will not cover the full height of the viewport.
.hero-image {
background-image: url(/img/header-background.jpeg);
background-size: contain;
background-repeat: no-repeat;
overflow:hidden;
max-width: 100%;
}
But you can set the background-color the same as the image's background if you do not wish to use background-repeat: repeat-y;
EDIT: Don't for get to correct hero-image to .hero-image in your CSS.
I tried expressing my problem earlier in another thread, but the only way that could fix it, caused the website to not be compliant with different size devices. The method I have now tried to use is the vertical center method stated in this topic.
vertical-align with Bootstrap 3
What I'm wanting to happen is to have a full page background along with a horizontally / vertically aligned div tag that contains my name and occupation. But instead what's happened is that it aligns the text to the middle of the page, but then it just doesn't align it vertically.
<div class="container-fluid text-center">
<header role="banner" id="banner" class="vcenter">
<h1>name</h1>
<h2>occupation</h2>
<h3>location</h3>
</header>
</div>
CSS
header {
/*position:absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%); */
font-family: Roboto-thin ;
padding: 0px;
border-style: none;
color:#ffffff ;
}
header h1 {
font-family:;
font-size: 8rem; /* =28px */
letter-spacing: 0.05em;
padding: 0px ;
margin-top: 0px;
margin-bottom: 13px;
}
header h2 {
font-family: ;
font-size: 5rem;
padding: 0px;
margin: 0px;
}
header h3 {
font-family: ;
font-size: 3rem;
}
.container-fluid {
background-image: url(../../images/intro.jpg);
background-repeat:no-repeat;
background-attachment: scroll;
background-position: center center;
background-repeat: none;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
margin:0px;
padding:0px;
height:100%;
}
.vcenter {
display: inline-block;
vertical-align: middle;
float: none;
}
The old method I used can be found in the header tag commented out. This method works fine for some browsers, but it seems that most browsers don't support the transform function.
Thanks in advance.
Bootstrap typically uses percentages for cross-platform/cross-browser capabilities. Maybe you could try adding something like this to your css file (alongside your .vcenter class):
.vcenter::before {
content:'';
display:inline-block;
height: 100%;
vertical-align:middle;
width:0px;
}
This will retrieve the height of the screen based on percentages and format the text vertically before it is displayed, which in theory, should work on all devices and browsers(for the most part). In IE8 you've got to use :before instead of ::before and have a !DOCTYPE declared. Hope this helps!
I have a client that wants the same image style effect as WooTheme's Duo Theme. I can easily achieve this initial effect:
------HTML-------------
<div class="home-banner">
</div>
-------CSS-------------
.home-banner {
height: 500px;
background-image: url("CLIENT'S BG IMG");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
padding: 9.505em 1.618em 11.089em;
text-align: center;
box-sizing: border-box;
position: relative;
overflow: hidden;
}
.home-banner:after {
content: "";
display: block;
height: 10em;
width: 200%;
position: absolute;
bottom: -5em;
right: -20em;
background: none repeat scroll 0% 0% #46535D;
border-radius: 100%;
transform: rotate(2deg);
border-top: 0.327em solid #F97960;
}
But there is one requirement that is killing the whole thing. The client's photo is showing staff members of their company. When the browser window is resized to simulate a tablet/smartphone, most of the image cannot be seen due to the css rule:
background-size: cover;
If I change this rule, the banner effect no longer works properly. I need all staff members to be seen on a small display. Imagine a staff member's head being cut off on their mobile device. That means that my head would be next. Any suggestions?
You can use a CSS media query such as
#media (max-width: 480px){
/*Place mobile CSS here*/
}
This way whenever a user looks at this on a mobile device this CSS rule will override the normal browser one... just place it after the normal browser styling.
I have a photo background on my site using background-size:cover. It works for the most part but leaves a weird ~30px white space on my Galaxy S3 in portrait mode.
I've attached a screenshot. The 1px teal line is to illustrate the entire screen. Seems like the background stops right after the social media uls.
I tested this by removing the ul and the background attached it self to the bottom of the tagline text.
Also, here's my CSS pertaining mobile portait view:
#media only screen and (max-width: 480px) {
.logo {
position: relative;
background-size:70%;
-webkit-background-size: 70%;
-moz-background-size: 70%;
-o-background-size: 70%;
margin-top: 30px;
}
h1 {
margin-top: -25px;
font-size: 21px;
line-height: 21px;
margin-bottom: 15px;
}
h2 {
font-size: 35px;
line-height: 35px;
}
.footer_mobile {
display: block;
margin-top: 20px;
margin-bottom: 0px;
}
li {
display: block;
font-size: 1.3em;
}
This used to not happen, but I guess I accidentally bugged it while trying to solve another issue.
After hours of trying different things, adding min-height: 100%; to the bottom of html under the { background:... } worked for me.
This works on Android 4.1.2 and iOS 6.1.3 (iPhone 4) and switches for desktop. Written for responsive sites.
Just in case, in your HTML head, something like this:
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
HTML:
<div class="html-mobile-background"></div>
CSS:
html {
/* Whatever you want */
}
.html-mobile-background {
position: fixed;
z-index: -1;
top: 0;
left: 0;
width: 100%;
height: 125%; /* To compensate for mobile browser address bar space */
background: url(/images/bg.jpg) no-repeat;
background-size: 100% 100%;
}
#media (min-width: 600px) {
html {
background: url(/images/bg.jpg) no-repeat center center fixed;
background-size: cover;
}
.html-mobile-background {
display: none;
}
}
Galaxy S3 havs a width of greater than 480px in either portrait or landscape view so I don't think those CSS rules will apply. You will need to use 720px.
Try add:
* { background:transparent }
right at the end & move your html { background:... } CSS after that.
This way you can see if there is a mobile footer div or any other element you created that is getting in the way, blocking the view.
Also I would try applying the background CSS to body rather than HTML. Hope you get closer to the answer.
Current solution would be to use viewport height (vh) to indicate the desired height. 100% did not work for Mobile Chrome. CSS:
background-size: cover;
min-height: 100%;