I apologize in advance for this somewhat lengthy explanation. I am trying to create a website such as http://melaniedaveid.com/ to improve my coding abilities. I created the first section page and it turned out great. But when I added another section, the previous section didn't fill up the whole page anymore (picture: http://imgur.com/a/EbUKn).
In order to solve this I gave full height to the first sections ID:
#header {
height: 100%;}
This fixed the problem(http://imgur.com/a/BlckC) but now when I resize my browser the second section over flows into my first, covering the text(http://imgur.com/a/C1jED). Any suggestions/leads would be greatly appreciated!
body {
background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('/img/roses.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
font-size: 20px;
height: 100vh;
}
/*------------------------------------------------ HOME PAGE ------------------------------------------------------------------*/
/*------------------------------
HEADING TEXT
-------------------------------*/
.name h1 {
font-family: 'Muli', sans-serif;
font-size: 500%;
font-weight: 300;
text-align: center;
padding-top: 10%;
color: #ecf0f1;
font-family: 'Cormorant Garamond', serif;
}
.name p {
font-family: 'Play', sans-serif;
font-size: 130%;
text-align: center;
padding-top: 5%;
color: #ecf0f1;
font-family: 'Merriweather', serif;
font-weight: 300;
padding-right: 10%;
padding-left: 10%;
}
/*------------------------------
Nav Bar
-------------------------------*/
.navigation p {
display: inline;
font-family: 'Play', sans-serif;
color: #ecf0f1;
}
.navigation {
text-align: center;
padding-top: 15%;
}
.contents,
.contents:hover {
text-decoration: none;
color: #ecf0f1;
font-family: 'Delius Unicase', cursive;
}
/*------------------------------------------------ ABOUT PAGE ------------------------------------------------------------------*/
/*------------------------------
About Heading
-------------------------------*/
#about {
background-color: black;
background-size: cover;
height: 100%;
}
#header {
height: 100%;
}
<section id="header"> <!------------------------- HOME PAGE -------------------------->
<div class="container">
<div class="row">
<div class="col-xs-12 name">
<h1>Temple Naylor</h1>
</div>
</div>
<div class="row">
<div class="col-xs-12 name">
<p>I create Web-designs with a sense of Feng-Shui in mind; resulting for a intuitive, responsive, harmonious, experience for users across the world.</p>
</div>
</div>
<div class="row">
<div class="col-xs-12 navigation hidden-sm-down">
<p><a class="contents" href="#">ABOUT</a> / </p>
<p><a class="contents" href="#">WORK</a> / </p>
<p><a class="contents" href="#">CONTACT</a> / </p>
<p><a class="contents" href="#">PHOTOGRAPHY</a></p>
</div>
</div>
</div>
</section>
<section id="about"> <!------------------------- ABOUT PAGE -------------------------->
<div class="container">
<div class="row about">
<div class="col-md-6">
<p class="big-text"></p>
</div>
</div>
<div class="row">
<div class="col-md-6 about-text">
<p >Yup</p>
</div>
</div>
</div>
</section>
You can use css vh property for this.
#header {
height: 100vh;
}
here is more info about css units. Hope this helps you.
change #header height to min-height:
#header {
min-height: 100%;
}
Related
So I have this small webpage I am trying to build. Everything looks good til I try to scale-in and out the browser windows to check it's responsiveness.
It looks good with 320x568 as below.
But when it scaled in (reduce the browser window, it shows like this, which I don't want that black box (`.transbox) to go down beyond the photo.)
I am using bootstrap framework and I DON'T NEED TO USE css media queries to make it responsive.
How can I do it with css instead?
This is my current html and css
.masthead {
height: 20vh;
min-height: 370px;
background-image: url("http://lorempixel.com/1920/1080");
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
div.transbox {
margin: 30px;
background-color: rgba(0, 0, 0, 0.6);
min-height: 300px;
}
div.transbox p {
font-weight: bold;
color: white;
}
.transbox h1 {
color: white;
}
<header className="masthead">
<div className="container">
<div className="row align-items-center">
<div className="col-12 text-center">
<div class="transbox">
<h1 className="font-weight-light">
All your Escort needs within a single place!
</h1>
<p className="lead">
Find the best set of escort services in Sri Lanka
</p>
</div>
</div>
</div>
</div>
</header>
Can someone please help me? Is there a bootstrap class or pure css way to do this?
Here is the working example:
body {
margin: 0;
padding: 0;
}
.masthead {
width: 100%;
height: 100%;
min-height: 100vh;
background-image: url("http://lorempixel.com/1920/1080");
background-size: cover;
background-position: center;
background-repeat: no-repeat;
display: flex;
align-items: center;
}
div.transbox {
margin: 30px;
background-color: rgba(0, 0, 0, 0.6);
min-height: 300px;
}
div.transbox p {
font-weight: bold;
color: white;
}
.transbox h1 {
color: white;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<header class="masthead">
<div class="container">
<div class="row align-items-center">
<div class="col-12 text-center">
<div class="transbox">
<h1 class="font-weight-light">
All your Escort needs within a single place!
</h1>
<p class="lead">
Find the best set of escort services in Sri Lanka
</p>
</div>
</div>
</div>
</div>
</header>
.masthead {
height: 20vh;
min-height: 400px;
background-image: url("http://lorempixel.com/1920/1080");
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
div.transbox {
margin: 30px;
background-color: rgba(0, 0, 0, 0.6);
min-height: 300px;
}
div.transbox p {
font-weight: bold;
color: white;
}
.transbox h1 {
color: white;
}
<header className="masthead">
<div className="container">
<div className="row align-items-center">
<div className="col-12 text-center">
<div class="transbox">
<h1 className="font-weight-light">
All your Escort needs within a single place!
</h1>
<p className="lead">
Find the best set of escort services in Sri Lanka
</p>
</div>
</div>
</div>
</div>
</header>
Your content is more as compare to width of background image. So, just increase the height of your background image or just reduce the font-size via media query.
I'm building the website and I want to reach the section like on my psd (img attached):
You can see that there's 100% width section and .col-md-9 and .col-md-3 inside this section.
But when .col-md-3 ends its background should continue and pave the background of the main section.
How can I make the column's background continue? I've spent hours solving this problem but I didn't find the correct way. Thanks!
.single__content {
width: 100%;
max-width: 743px;
padding-top: 57px;
}
.single__content p {
color: #707070;
font-size: 15px;
font-weight: 400;
line-height: 23px;
}
.single__meta {
background: #3c73ba;
height: 70px;
}
.single__meta h2 {
font-size: 38px;
font-weight: 300;
line-height: 42px;
color: #fff;
margin: 0;
padding-top: 14px;
}
.col-sidebar {
background: #4285db;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<div class="single__meta">
<div class="container">
<div class="row ">
<div class="col-md-9">
<h2 class="page-title">Lorem ipsum dolor</h2>
</div>
<div class="col-sidebar col-md-3">
Second column content
</div>
</div>
</div>
</div>
You can split the background of your top with background: linear-gradient.
Demo with bootstrap 4
.top-bar {
background: linear-gradient(
to right,
#3c73ba 0%,
#3c73ba 50%,
#4285db 50%,
#4285db 100%
);
width: 100%;
padding: 0;
margin: 0;
color: #fff;
}
.col-left{
background: #3c73ba;
}
.col-right {
background: #4285db;
}
<div class="top-bar" style="padding: 0">
<div class="container">
<div class="row">
<div class="col-left col-md-9">
<h2>left</h2>
</div>
<div class="col-right col-md-3">
<h2>right</h2>
</div>
</div>
</div>
</div>
"make this changes in your code" hope this u want
<div class="row col_bg">
<div class="col-md-9 ">
<h2 class="page-title">Lorem ipsum dolor</h2>
</div>
<div class="col-sidebar col-md-3">
Second column content
</div>
<div class="clear">
</div>
</div>
"for css"
.row.col_bg {
background-color: #4285db;
clear: both;
}
.col-md-9 {
float: left;
width: 70%;
}
.single__meta h2 {
color: #000;
font-size: 38px;
font-weight: 300;
line-height: 42px;
margin: 0;
}
.col-sidebar.col-md-3 {
float: right;
width: 30%;
}
.clear {
clear: both;
}
I am trying to get a background image on some text that heads to the left of the screen whilst the text is on the right. I want it to be a background image so I can do:
background-position: left center;
I have done the same thing just above within the same CSS file, however, this time it doesn't want to work and I cannot work out why for the life of me.
HTML:
<section class="skillset">
<div class="spaceage">
<h1>-filler-</h1>
<p>-filler-</p>
</div>
<div class="ability">
<h3>-filler-</h3>
<p>-filler-</p>
<img src="img/xdlogo.svg" alt="Adobe Experience Design Logo">
<img src="img/pslogo.png" alt="Adobe Photoshop Logo">
<img src="img/html5logo.png" alt="HTML 5 Logo">
<img src="img/css3logo.svg" alt="CSS 3 Logo">
</div>
</section>
<section class="aboutMe">
<div class="aboutMeText">
<h1>-filler-</h1>
<p>-filler-</p>
<p>-filler-</p>
</div>
</section>
I did the same thing in the in the 'skillset' section but cannot achieve it in the about me section. Here is my CSS for both:
.skillset {
font-family: 'Montserrat', sans-serif;
position: relative;
margin-top: 50px;
background-image: url(img/asteroid.gif);
background-repeat: no-repeat;
background-position: right center;
background-size: 40%;
}
.aboutMe {
margin-top: 150px;
margin-right: 5%;
font-family: 'Montserrat', sans-serif;
position: relative;
background-image: url(img/asteroid.gif);
background-repeat: no-repeat;
background-position: left center;
background-size: 40%;
}
I cannot see why the background image isn't displaying next to the text. Does anyone else know why?
EDIT:
I have now discovered that if I add an image using the tag underneath the text in the HTML, the background image miraculously appears!?!?!
Is this what you want?
I used text-align:right; on .aboutMe
.skillset {
font-family: 'Montserrat', sans-serif;
position: relative;
margin-top: 50px;
background-image: url(https://placehold.it/250x150);
background-repeat: no-repeat;
background-position: right center;
background-size: 40%;
}
.aboutMe {
text-align:right;
margin-top: 150px;
margin-right: 5%;
font-family: 'Montserrat', sans-serif;
position: relative;
background-image: url(https://placehold.it/250x150);
background-repeat: no-repeat;
background-position: left center;
background-size: 40%;
}
<section class="skillset">
<div class="spaceage">
<h1>-filler-</h1>
<p>-filler-</p>
</div>
<div class="ability">
<h3>-filler-</h3>
<p>-filler-</p>
<img src="img/xdlogo.svg" alt="Adobe Experience Design Logo">
<img src="img/pslogo.png" alt="Adobe Photoshop Logo">
<img src="img/html5logo.png" alt="HTML 5 Logo">
<img src="img/css3logo.svg" alt="CSS 3 Logo">
</div>
</section>
<section class="aboutMe">
<div class="aboutMeText">
<h1>-filler-</h1>
<p>-filler-</p>
<p>-filler-</p>
</div>
</section>
Updated html structure
.a {
text-align: right;
background-image: url(https://placehold.it/250x150);
background-repeat: no-repeat;
background-position: left center;
padding-left: 50%;
}
body {
padding: 15px;
}
<div class="a">
<h1>This is some textThis is some textThis is some textThis is some textThis is some textThis is some textThis is some text</h1>
</div>
I ended up taking a break for a drink (I've been designer/making this website for around 5 hours now) after my break I sat, took a breath and started again with the about section. It was much easier to think now this is what I came up with:
<div class="about">
<h1>Hi, I'm Jack</h1>
<div class="aboutTxt">
<p>filler</p>
<p>filler</p>
</div>
</div>
.about {
padding: 0 5%;
background-image: url(img/programmer.gif);
background-repeat: no-repeat;
background-position: left center;
background-size: 30%;
margin-top: 225px;
font-family: 'Montserrat', sans-serif;
margin-left: 5%;
}
.about h1 {
margin-bottom: 30px;
color: #2B9DFF;
text-transform: capitalize;
}
.aboutTxt {
text-align: justify;
}
.about h1,
.aboutTxt {
margin-left: 50%;
background: rgba(211, 211, 211, 0.1);
}
Tbh, I made a big problem out of something that if I took a break and just thought about it, wouldn't have been a problem. Thanks for everyone's help but I got this one ahah!
why don't styling p and h1 separately?
because you are more flexible at the end.
By the way, the section should have an id aboutMe instead of a class name. makes more sense. keep that in mind.
Jsfiddle
https://jsfiddle.net/L0cbe709/
HTML:
<section class="skillset">
<div class="spaceage">
<h1>-filler-</h1>
<p>-filler-</p>
</div>
<div class="ability">
<h3>-filler-</h3>
<p>-filler-</p>
<img src="img/xdlogo.svg" alt="Adobe Experience Design Logo">
<img src="img/pslogo.png" alt="Adobe Photoshop Logo">
<img src="img/html5logo.png" alt="HTML 5 Logo">
<img src="img/css3logo.svg" alt="CSS 3 Logo">
</div>
</section>
<section class="aboutMe">
<div class="aboutMeText">
<h1>-filler-</h1>
<p>-filler-</p>
<p>-filler-</p>
</div>
</section>
CSS
.ability {
width: 100%;
}
.skillset {
font-family: 'Montserrat', sans-serif;
position: relative;
margin-top: 50px;
background-image: url(https://placehold.it/250x150);
background-repeat: no-repeat;
background-position: right center;
background-size: 40%;
}
.aboutMe {
width: 100%;
margin-top: 150px;
margin-right: 5%;
font-family: 'Montserrat', sans-serif;
position: relative;
background-image: url(https://placehold.it/250x150);
background-repeat: no-repeat;
background-position: left center;
background-size: 40%;
}
.aboutMe p {
text-align: right;
}
.aboutMe h1 {
text-align: center;
}
I have question. I am using materialize CSS. And I tried parallax with the html
<img class="parallax"> tag but is there a way to give you're background image in CSS but also making it parallax.
My Example code:
Content html:
<div class="row parallax-container">
<div class="parallax">
<div class="intro headerBackground">
<h1 class="grey-text text-lighten-5">Data</h1>
<h5 class="grey lighten-4 grey-text text-darken-1">Data</h5>
</div>
</div>
</div>
Content CSS:
.intro
{
text-align: center;
padding-top: 13%;
padding-bottom: 13%;
margin-bottom: 50px;
}
.intro h1
{
font-weight: 900;
text-transform: uppercase;
}
.intro h5
{
text-transform: uppercase;
background-color: #fafafa;
padding: 10px;
display: inline-block;
font-size: 1.2rem;
}
.headerBackground{
height:800px;
background-image:url('images');
background-repeat:no-repeat;
background-position:center;
background-size: cover;
}
Please Try:-
<div class="row parallax-container">
<div class="parallax headerBackground">
<div class="intro">
<h1 class="grey-text text-lighten-5">Data</h1>
<h5 class="grey lighten-4 grey-text text-darken-1">Data</h5>
</div>
</div>
I noticed that my web page has a white space/bar right after the footer and at the bottom of the page:
I tried to find the cause of this by using the inspect element in Chrome and can't find anything. I'm using Boostrap and here's my footer HTML/CSS:
<div class="container">
<hr>
</div> <!--end container-->
<div id="footer">
<footer class="container">
<div class="row">
<div class="col-md-3" id="mail"> <img src="images/mail.png" alt="e-kiri" title="Kirjuta mulle!"/>
<p>info#8delfiini.ee</p>
</div>
<div class="col-md-3" id="tel"> <img src="images/phone.png" alt="telefon" title="Helista mulle!"/>
<p>(+372) 52 99 131</p>
</div>
<div class="col-md-3" id="addr"> <img src="images/location.png" alt="asukoht" title="Asukoht"/> <a href="https://goo.gl/maps/ny3wV" title="Asukoht" target="_blank">
<p>Jansuki Shop<br />
Müürivahe 17<br />
Tallinn </p>
</a> </div>
<div class="col-md-3" id="fb"> <img src="images/fb.png" alt="Facebook" title="Facebook"/> <a href="https://www.facebook.com/8Delfiini" title="Facebook" target="_blank">
<p>8 Delfiini Facebookis</p>
</a> </div>
</div>
<!--end row-->
</footer>
</div>
<!--end footer-->
And the CSS for the whole contact page:
/*kontakt*/
#kontakt
{
background: url(../images/IMG_1340.jpg) no-repeat fixed;
width: 100%;
margin-bottom: 0;
}
h2.cont-heading
{
background: url(../images/kontakt.png) no-repeat 0 155px;
background-size: 48.5px 53px;
padding: 160px 0 5px 60px;
color: rgb(255,255,255);
text-transform: uppercase;
}
h1.invitation
{
font-family: 'latoregular', sans-serif;
color: rgb(255,255,255);
font-size: 7em;
}
#logo
{
width: 28px;
height: 40px;
margin-top: 10px;
}
#part3, #part4
{
padding: 40px 40px 40px 0;
}
#part4
{
padding: 30px;
color: rgb(255,255,255);
}
hr
{
border: 0;
height: 1px;
margin: 0;
background-image: -webkit-linear-gradient(left, rgba(255,255,255,0.4), rgba(255,255,255,0.75), rgba(255,255,255,0.4));
background-image: -moz-linear-gradient(left, rgba(255,255,255,0.4), rgba(255,255,255,0.75), rgba(255,255,255,0.4));
background-image: -ms-linear-gradient(left, rgba(255,255,255,0.4), rgba(255,255,255,0.75), rgba(255,255,255,0.4));
background-image: -o-linear-gradient(left, rgba(255,255,255,0.4), rgba(255,255,255,0.75), rgba(255,255,255,0.4));
}
/*footer styles*/
#footer
{
padding: 40px;
color: rgb(255,255,255);
text-align: center;
}
#footer a
{
color: rgb(255,255,255);
font-size: 1.3em;
}
#mail img, #tel img, #addr img, #fb img
{
height: 60px;
width: 60px;
display: block;
margin: 0 auto;
}
#mail a, #tel a, #addr a, #fb a
{
padding: 50px;
font-family: 'latoregular', sans-serif;
}
I'm new to Bootstrap. Is there maybe something special in its CSS that causes this? Thank you for your help. :)
You can fix it by setting a padding for the #footer .row:
#footer .container .row {
padding-bottom:8px;
}
Beautiful layout btw :)
This kind of things has mostly to do with not setting the body style:
body
{
margin: 0;
padding: 0;
}
It can also happen that you have set the heights of other elements wrongly.
It's a good practice to reset all the predefined styles, see http://www.cssreset.com/
And just to be sure; your background image is big enough, right?