Writing two paragraphs, these are spaced apart! IDK why - html

Writing two paragraphs, these are spaced apart. My paragraphs are very far and I don't understand why.
I tried to unlink css files, between the two paragraphs there was an empty line: missing in the code.
My page:
<div class="sharp">
<p class="title">Chi sono?</p><p class="content">Seguimi su Twitter!</p>
</div>
All my CSS:
*{
margin: 0;
height: 100%;
}
.title{
color: #2d3436;
text-align: center;
text-shadow: 3px 2px #b2bec3;
font-size: 50px;
font-weight: bold;
}
.content{
color: #2d3436;
text-align: center;
text-shadow: 2px 1px #b2bec3;
font-size: 25px;
font-weight: lighter;
}
hr {
width: 95%;
height: 2px;
margin-left: auto;
margin-right: auto;
background-color:#666;
border: 0 none;
margin-top: 20px;
margin-bottom:20px;
}
.space{
height: 100px;
}
.dark{
margin: auto;
padding: 20px;
background: #000;
color: #fff;
width: 85%;
height: 80px;
}
.sharp{
margin: auto;
padding: 20px;
background: #fff;
border-radius: 25px;
border: 1px solid #dfe4ea;
width: 85%;
box-shadow: 5px 10px 8px #888888;
}
body{
width: 100%;
background-image: linear-gradient(45deg,#ced6e0,#ced6e0);
background-repeat: no-repeat;
background-size: 4000px 4000px;
}
.img-container{
background-image: url(../data/images/hero.png);
height: 70%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
z-index:1;
}
.inner-container{
text-align: center;
width: 100%;
color: #fff;
position: absolute;
height: auto;
margin-top: 200px;
}
h1{
font-size: 7em;
font-family: "Shadows into Light", Sans Serif;
}
h2{
margin-top: -17px;
font-family: "Source Sans Pro", Sans Serif;
font-size: 1.7em;
text-align: center;
font-weight:400;
}
a{
margin-top: 20px;
font-size: 1.3em;
font-family: "Source Sans Pro", Sans Serif;
}
.btn{
display: inline-block;
width: 200px;
font-weight: bold;
padding: 10px;
color: #fff;
border: 4px solid #fff;
text-align: center;
outline: none;
text-decoration: none;
transition: background-color 0.2s ease-out, color 0.2s ease-out;
}
.btn:hover,.btn:active{
background-color: #fff;
color: #000;
transition: background-color 0.3s ease-in, color 0.3s ease-in;
}
#media only screen and (max-width: 920px){
.inner-container{
margin-top: 100 px;
}
}
#media only screen and (max-width: 540px){
.inner-container{
margin-top: 150px;
}
h1{
font-size: 5em;
}
h2{
font-size: 1.4em;
}
The two paragraphs are too far apart. I hope someone can help me...[How the page looks.][1]

By writing *{height: 100%} in your css, you are telling it to make every element (aka *) take up 100% of the available height. In doing so, your first paragraph is taking up all the height it can, pushing the second one all the way down.
If the only element you want to ensure has a 100% height is the white background, consider styling it individually.

The
*{
height: 100%;
}
part of your CSS file is telling every element on the page to be the same height as the window, so the second element is pushed down. If you remove that line from the CSS file the problem will go away.

Problem solved by giving
height: 10%;
to the paragraphs.

Related

make entire image fill background with css

Struggling to write CSS to format the image so that it covers the entire background of the page, as it doesn't seem to be able to do so below. It seems to be getting stuck up on the header and I am not sure how to correct that.
margin-top: 0px;}
h1 a {
background-color: black;
font-size: 40px;
color: white;
margin-left: 40px;
padding: 10px 20px;
letter-spacing: -1px;
text-decoration: none;
font-weight: bold;
}
.sidenav {
width: 150px;
position: fixed;
z-index: 1;
top: 85px;
left: 10px;
/*background: #ffffff;*/
overflow-x: hidden;
padding: 8x 0;
}
.sidenav a {
padding: 4px 1px 4px 40px;
text-decoration: none;
font-size: 25px;
color: #000000;
display: block;
font-weight: bold;
font-family: 'Helvetica Neue', 'Helvetica', 'Arial', 'sans-serif';
}
Make the image the background of the body or a div (is how I would do it).
CSS:
body {
background: url("");
}
or
.coolbackground {
background: url("");
}
You can set how it covers the page using:
background-size: ;
and
background-repeat: ;
Else if you dont want to do that, use a float, absolute positioning and z-index.

Background color not changing from white

For some reason the background color refuses to change from white. I am trying to get it to change from white to black under the header, but it refuses to change. Putting "background-color:" in the body SCSS doesn't seem to change it.
I am not sure if there is something in my SCSS that is simply over riding the background color without me realizing?
Any help is greatly appreciated
SCSS:
*{
margin: 0;
padding: 0;
text-decoration: none;
list-style: none;
background-color: '#010101';
}
#wrapperHeader {
width: 100vw;
height: 210px; /* height of the background image? */
background:url(images/header.png);
}
div#wrapperHeader div#header {
width: 100vw;
height:100px;
margin:0 auto;
}
div#wrapperHeader div#header img {
width: 100vw ; /* the width of the logo image */
height: 210px ; /* the height of the logo image */
margin:0 auto;
}
header {
color: white;
background-color: dimgrey ;
clear: left;
text-align: center;
}
.toggle_menu{
position: fixed;
padding: 17px 20px 15px 15px;
margin-top: 210px;
color: white;
cursor: pointer;
background-color: #000;
z-index: 1000000;
font-size: 2em;
opacity: 0;
}
.sidebar_menu{
position: fixed;
width: 100vh;
max-width: 250px;
margin-left: 0px;
overflow: hidden;
height: 100vh;
max-height: 100vh;
background-color: rgba(17, 17, 17, 0.9);
opacity: 0,9;
transition: all 0.3s ease-in-out;
}
.fa-times{
right: 10px;
top: 10px;
opacity: 0.7;
cursor: pointer;
position: absolute;
color: red;
transition: all 0.3s ease-in-out;
}
.fa-times:hover{
opacity: 1 ;
}
.boxed_item {
font-family: 'Open Sans';
font-weight: 200;
padding: 10px 20px;
display: inline-block;
border: solid 2px white;
box-sizing: border-box;
font-size: 22px;
color: white;
text-align: center;
margin-top: 70px;
}
.logo_bold{
font-weight: 800;
}
.logo_title{
color: white;
font-family: 'Open Sans';
font-weight: 200;
font-size: 12px;
text-align: center;
padding: 5px 0px;
}
.nav_selection{
margin: 0, 0;
display: block;
width: 200;
margin-top: 100px;
margin-left: 5px;
}
.nav_item{
font-weight: 200;
font-family: 'Open Sans';
color: white;
padding: 15px 0;
font-size: 20px;
color: #D8D8D8;
border-bottom: solid 2px #D8D8D8;
transition: all 0.3s ease-in-out;
}
.hide_menu{
margin-left: -250px;
}
.opacity_one{
opacity: 1;
}
.disabled {
pointer-events:none; //This makes it not clickable
opacity:0.6;
font-weight: 200;
font-family: 'Open Sans';
color: white;
padding: 15px 0;
font-size: 20px;
color: #D8D8D8;
border-bottom: solid 2px #D8D8D8;
transition: all 0.3s ease-in-out;
}
At three place you have give the background color code in three different style.
Please follow anyone format.
Never give the color in the quotation mark. You have given it in *{ background-color: '#010101'; } remember that. It should be *{ background-color: #010101; }.
You have given background-color: dimgrey ; so each time the color name is not working you have gave the color code for that.
This is header part for which you have to make change. for dimgrey the color code is: #696969 so your code will be:
header {
color: white;
background-color: #696969; // check this line.
clear: left;
text-align: center;
}
It will make the change in the header parts background color. you have to check only that part.
It may be possible that other style will be override the background of header. In that case you have to put the !important in the code like this:
header {
color: white;
background-color: #696969 !important; // check this line.
clear: left;
text-align: center;
}
Let me know if it help you.
Change background-color: '#010101'; this to
background-color: '#010101!important';

Fine tune a css element :hover area

I have a little tab coming out of a box, and for some reason applying a hover on that tab is very buggy and the actual hovering area is way above it. What is causing that and how can i fix it?
JSFiddle: https://jsfiddle.net/nmr4wu2z/
body {
background-color: #F5F5F5;
font-family: 'Open Sans Condensed', sans-serif;
width: 90%;
margin: 0 auto;
}
.logo {
height: 250px;
width: 250px;
background-color: #FF7148;
margin-top: 5%;
margin-left: 5%;
font-family: 'Open Sans Condensed', sans-serif;
font-weight: 300;
z-index: -1;
box-shadow: 1px 1px 1px black;
}
.contact {
height: 70px;
width: 280px;
position: relative;
background-color: #FF7148;
box-shadow: 1px 1px 1px black;
top: -150%;
z-index: -2;
transition: all 0.5s ease;
}
.contact:hover {
margin-left: 80%;
}
.contactText {
margin-right: -15.5em;
text-align: center;
transform: rotate(90deg);
font-family: 'Open Sans Condensed', sans-serif;
color: white;
padding-top: 40px;
}
.contactEmail {
color: white;
margin-top: -3.4em;
text-align: center;
padding-left: 5px;
}
.logoText {
color: #F5F5F5;
text-align: right;
padding: 170px 10px;
}
<!-- use <header>, <nav>, <article>, <section>, <aside>, and <footer> -->
<header>
<div class="logo">
<h3 class="logoText"> Name <br> &nbsp &nbsp A Blog </h3>
<div class="contact">
<h3 class="contactText"> Contact </h3>
<h3 class="contactEmail"> Example#blabla.com </h3>
</div>
</div>
You have to make some changes
body {
background-color: #f5f5f5;
font-family: "Open Sans Condensed",sans-serif;
margin: 0 auto;
width: 90%;
}
.logo {
background-color: #ff7148;
box-shadow: 1px 1px 1px black;
font-family: "Open Sans Condensed",sans-serif;
font-weight: 300;
height: 250px;
margin-left: 5%;
margin-top: 5%;
position: relative;
width: 250px;
}
.contact {
background-color: #ff7148;
box-shadow: 1px 1px 1px black;
height: 105px;
position: absolute;
top: 30px;
transition: all 0.5s ease 0s;
width: 280px;
cursor: pointer;
}
.contact:hover {
margin-left: 85%;
}
.contactText {
color: white;
font-family: "Open Sans Condensed",sans-serif;
/* margin-right: -15.5em; */
/* padding-top: 40px; */
text-align: center;
transform: rotate(90deg);
transform-origin: 192px 85px 0;
}
.contactEmail {
color: white;
margin-top: -1.1em;
padding-left: 5px;
text-align: center;
}
.logoText {
background: #ff7148 none repeat scroll 0 0;
color: #f5f5f5;
padding: 170px 10px 35px;
position: relative;
text-align: right;
z-index: 1;
}
<header>
<div class="logo">
<h3 class="logoText"> Name <br> &nbsp &nbsp A Blog </h3>
<div class="contact">
<h3 class="contactText"> Contact </h3>
<h3 class="contactEmail"> Example#blabla.com </h3>
</div>
</div>
in with your style like I do in below snippet -
While the answer above triggers the hover for .contact, it's still buggy when you hover above the square.
In this jsfiddle I changed the approach a bit. Take .contact out of .logo (as it doesn't make logical sense) and apply float: left to both. Instead of overlaying them and adjusting the margin to make .contact move left, I start with a lower width and overflow: hidden; on contact, and increase the width on hover.

how to make sizes look the same on all screens

So, I am working on two sites, and the padding seems to change tremendously on different screens, I was wondering if this was potentially due to the units I am using? Or the specific CSS tag? However, I am hoping someone can figure it out for me
Two bits of code that keep changing:
codepen
.divider {
background-color: #3498db;
padding-top: 5%;
padding-bottom: 5%;
font-family: Open Sans;
font-weight: 300;
text-align: center;
}
.divider h1 {
margin-bottom: 10px;
margin-top: 0%;
padding-top: 20%;
font-weight: 500;
color: white;
}
.divider p {
color: white;
margin-bottom: 5px;
font-family: Open Sans;
text-align: center;
}
.divider button {
padding: 10px;
height: 15%;
cursor: auto;
width: 17%;
margin-top: 30px;
border-radius: 50px;
text-align: center;
color: white;
border: white 1px solid;
background-color: #3498db;
}
.divider button:hover {
background-color: white;
color: black;
transition: all 0.3s ease 0s;
}
<div class="divider">
<h1>See Something You Like?</h1>
<p>Feel free to contact us at any time and we’ll have someone reply to you 6 as soon as possible.
<br>industry's standard dummy text ever since the 1500s
<br>
<br>Whenever you’re ready, email us with the details you want on your website, and we will
<br>respond with a rough price.</p>
<a href="mailto:hello#baseframe.co">
<button>Email</button>
</a>
</div>
on this, the top padding gets super big (or sometimes it gets smaller) on different screens.
codepen
* {
margin: 0 auto;
padding: 0;
}
html {
height: 100%;
}
body {
font-family: 'Open Sans';
font-weight: 400;
height: 100%;
background-color: #ddd;
}
.nav {
background: rgba(0, 0, 0, 0);
position: absolute;
width: 100%;
}
.nav ul {
text-align: right;
vertical-align: middle;
margin-right: 15px;
margin-top: 15px;
font-size: 1.1em;
}
.nav li {
padding-top: 5px;
list-style: none;
display: inline-block;
padding: 15px;
}
.nav a {
margin-top: 17px;
bottom: 0;
display: inline-block;
color: white;
text-decoration: none;
}
.nav a:hover {
color: #3498db;
transition: ease 0.5s all 0s;
}
.nav hr {
opacity: 0.2;
width: 95%;
text-align: center;
}
.nav-logo {
vertical-align: middle;
top: 0;
float: left;
width: 5%;
display: inline-block;
}
.nav-logo img {
width: 250%;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
}
/*-------------------Home-Page-------------------*/
.home-page {
background-image: url("http://baseframe.co/getanimus/img/cover1.jpg");
background-size: cover;
background-position: top;
background-attachment: fixed;
padding-bottom: 17%;
text-align: center;
}
.home-page h1 {
color: white;
padding-top: 15%;
font-size: 5em;
text-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
}
.home-page input {
cursor: auto;
}
.home-page p {
font-weight: 300;
color: white;
margin-bottom: 15px;
}
button#infl {
background-color: #3498db;
color: white;
font-size: 1em;
width: 15%;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
font-family: montserrat;
padding: 15px;
margin: 5px;
border-top-left-radius: 2em;
border-top-right-radius: 2em;
border-bottom-left-radius: 2em;
border-bottom-right-radius: 2em;
border: none;
cursor: auto;
}
button#brands {
background-color: white;
color: #7f8c8d;
font-size: 1em;
width: 15%;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
font-family: montserrat;
padding: 15px;
margin: 5px;
border-top-left-radius: 2em;
border-top-right-radius: 2em;
border-bottom-left-radius: 2em;
border-bottom-right-radius: 2em;
border: none;
cursor: auto;
}
button#brands:hover {
opacity: 0.8;
transition: all 0.3s ease 0s;
}
button#infl:hover {
opacity: 0.8;
transition: all 0.3s ease 0s;
}
/*-------------------About-------------------*/
.about {
background-color: white;
padding-bottom: 10%;
}
.about h1 {
text-align: left;
margin-left: 20%;
margin-top: 5%;
}
.about hr {
background-color: #3498db;
height: 5px;
border: none;
margin-top: 2%;
margin-left: 20%;
width: 5%;
text-align: left;
float: left
}
.about p {
margin-left: 20%;
margin-right: 20%;
line-height: 30px;
margin-top: 5%;
text-align: left;
}
<div class="nav">
<ul>
<li class="nav-logo">
<img src="http://baseframe.co/getanimus/img/logo_white.png">
</li>
<li>Home</li>
<li>Influencers</li>
<li>Brands</li>
<li>Contact</li>
<hr>
</div>
<div class="home-page">
<h1>Animus Digital</h1>
<p>Premium Talent Management Agency</p>
<button id="infl">Influencers</button>
<button id="brands">Brands</button>
</div>
this website navigation doesn't align properly with the logo on the left, for some reason. In addition, on a 1920 x 1080 screen, the buttons get pretty wide.
Really appreciate any help on this. Thanks.
The reason why the sizes of those elements changes on different screens is because you use % instead of px. % scales the size with the browser's size.
You should use CSS Media queries
For first case since you are using % in padding, which leads to unexpected behavior in different situations.
For "n%" margin (and padding) to be the same for
margin-top/margin-right/margin-bottom/margin-left, all four have to be
relative to the same base. If top/bottom used a different base than
left/right', then "n%" margin (and padding) wouldn't mean the same
thing on all four sides.
(Also note having the top/bottom margin relative to the width enables
a weird CSS hack that allows you to specify a box with an unchanging
aspect ratio ...even if the box is rescaled.)
% with margin/padding

Issue with getting text into the centre of div

I have made some buttons to link people from my site to social media pages and the text in the Google Plus one is too low and I would like it to go higher in the div but I am struggling to do this, my code is here on JS fiddle.
The buttons aren't complete yet, I just want to know how to get the text higher, cheers
.GooglePlus {
color: black;
font-size: 35px;
border-radius: 100px;
padding: 2px;
font-family: Garamond;
font-weight: bold;
height: 40px;
width: 40px;
background-color: #D8D8D8;
text-align: center;
vertical-align: central;
}
a:hover .GooglePlus {
background-color: #FE2E2E;
color: white;
}
Just add line-height:27px; to adjust g+
Code full class:
.GooglePlus {
color: black;
font-size: 35px;
border-radius: 100px;
padding: 2px;
font-family: Garamond;
font-weight: bold;
height: 40px;
width: 40px;
background-color: #D8D8D8;
text-align: center;
vertical-align: middle;
line-height:27px;
}
If i understand you correctly you are just trying to move the text inside of those circle backgrounds higher.
If this is the case you can cheat it with line height as done in this fiddle
http://jsfiddle.net/9dj9u/2/
Which leaves the resulting CSS affected.
.FaceBook {
color: black;
font-size: 35px;
border-radius: 100px;
padding: 2px;
font-family: Calibri;
font-weight: bold;
height: 40px;
width: 40px;
background-color: #D8D8D8;
text-align: center;
line-height:1.1;
}
.GooglePlus {
color: black;
font-size: 35px;
border-radius: 100px;
padding: 2px;
font-family: Garamond;
font-weight: bold;
height: 40px;
width: 40px;
background-color: #D8D8D8;
text-align: center;
vertical-align: middle;
line-height:0.8;
}
Just adjust line-height in percentage values: line-height: 50%, keep increasing or decreasing till you get there, you might also want to adjust padding, and box-sizing... and remove vertical-align
Remember, this isn't quite exact science, because you do not intend the g and the f to stand next to each other like they do in a sentence, watch this: fg, notice how the g normally is indeed lower than the f.
i included the correct vertical-align value and adjusted the height and width
.FaceBook {
color: black;
font-size: 35px;
border-radius: 100px;
padding: 5px;
font-family: Calibri;
font-weight: bold;
height: 40px;
width: 40px;
background-color: #D8D8D8;
text-align: center;
}
a:hover .FaceBook {
background-color: #4c66a4;
color: white;
}
#footer .FaceBook {
display: inline-block;
}
.GooglePlus {
color: black;
font-size: 35px;
border-radius: 100px;*/
border-bottom: 2px solid black;
padding: 2px;
font-family: garamond;
font-weight: bold;
height: 50px;
width: 50px;
background-color: #D8D8D8;
text-align:center ;
vertical-align: text-bottom;
padding: 0px;
}
a:hover .GooglePlus {
background-color: #FE2E2E;
color: white;
}
#footer .GooglePlus {
display: inline-block;
}
#plus {
font-size: 20px;
padding:0px 0px;
}
a {
text-decoration: none;
}