Related
I've been using the vertical spacing trick for all my div's with text in them, and while it made the vertical spacing go from 0% to 90% perfectly centered, it's leaving more space at the top of the tip then the bottom. It's doing it on every single div I used it on. I've tried setting padding/margin to 0 but nothing happened. Not sure what specifically is causing this. It's pretty irritating. Anyone have an idea?
Live example -
https://jay-portfolio.herokuapp.com/
Pic of issue -
http://i988.photobucket.com/albums/af6/jtbitt/spacing-incorrect_zps0hjolnyv.png
HTML -
<section id="about" ng-controller="aboutController">
<div class="container-fluid">
<div class="row about-row">
<div class="about-left col-xs-12 col-md-6">
</div>
<div class="about-right col-xs-12 col-md-6">
<div class="about-content">
<div class="about-content-title">
<h1><strong>I'M JAY.</strong></h1>
</div>
<div class="about-content-info">
<p ng-if="about.firstParagraph">{{ about.paragraphOne }}</p>
<p ng-if="!about.firstParagraph">{{ about.paragraphTwo }}</p>
</div>
<div class="about-button">
<button ng-if="about.firstParagraph" class="label label-success" ng-click="about.switchParagraph()">MORE =></button>
<button ng-if="!about.firstParagraph" class="label label-success">VIEW SKILLS</button>
</div>
<div class="about-personal-info">
<h4>Email: jaybittner#gmail.com</h4>
</div>
<div class="about-icon">
<img ng-src="{{ profile.icon }}" />
</div>
</div>
</div>
</div>
</div>
</section>
CSS -
#about {
height: 100%;
width: 100%;
background: rgba(0,97,65,1);
background: -moz-linear-gradient(left, rgba(0,97,65,1) 0%, rgba(54,135,95,1) 7%, rgba(36,123,85,1) 22%, rgba(0,97,65,1) 53%, rgba(34,121,84,1) 76%, rgba(54,135,95,1) 90%, rgba(54,135,95,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(0,97,65,1)), color-stop(7%, rgba(54,135,95,1)), color-stop(22%, rgba(36,123,85,1)), color-stop(53%, rgba(0,97,65,1)), color-stop(76%, rgba(34,121,84,1)), color-stop(90%, rgba(54,135,95,1)), color-stop(100%, rgba(54,135,95,1)));
background: -webkit-linear-gradient(left, rgba(0,97,65,1) 0%, rgba(54,135,95,1) 7%, rgba(36,123,85,1) 22%, rgba(0,97,65,1) 53%, rgba(34,121,84,1) 76%, rgba(54,135,95,1) 90%, rgba(54,135,95,1) 100%);
background: -o-linear-gradient(left, rgba(0,97,65,1) 0%, rgba(54,135,95,1) 7%, rgba(36,123,85,1) 22%, rgba(0,97,65,1) 53%, rgba(34,121,84,1) 76%, rgba(54,135,95,1) 90%, rgba(54,135,95,1) 100%);
background: -ms-linear-gradient(left, rgba(0,97,65,1) 0%, rgba(54,135,95,1) 7%, rgba(36,123,85,1) 22%, rgba(0,97,65,1) 53%, rgba(34,121,84,1) 76%, rgba(54,135,95,1) 90%, rgba(54,135,95,1) 100%);
background: linear-gradient(to right, rgba(0,97,65,1) 0%, rgba(54,135,95,1) 7%, rgba(36,123,85,1) 22%, rgba(0,97,65,1) 53%, rgba(34,121,84,1) 76%, rgba(54,135,95,1) 90%, rgba(54,135,95,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#006141', endColorstr='#36875f', GradientType=1 );
background-repeat: no-repeat;
color: #101010;
border-bottom: 3px solid black;
}
#about .container-fluid, #about .row {
height: 100%;
}
.about-left {
height: 100%;
background-image: url('../../images/jay-ocean.jpg');
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
border-right: 3px solid #101010;
}
.about-right {
height: 100%;
width: 50%;
text-align: center;
position: relative;
}
.about-content {
width: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
margin-left: auto;
margin-right: auto;
}
.about-content-title h1{
font-size: 3.1vw;
margin-bottom: 0.6vh;
}
.about-content-info p {
font-size: 1vw;
word-spacing: 0.3vw;
margin-bottom: 0.7vh;
}
.about-button button {
margin-bottom: -0.1vh;
}
.about-personal-info h4 {
margin-bottom: 0.7vh;
}
.about-button button {
color: gray;
border: 1px solid #101010;
background-color: #101010;
font-size: 0.7vw;
}
.about-button a {
color: gray;
}
.about-personal-info h4 {
font-size: 1vw;
word-spacing: 0.3vw;
}
.about-icon img {
height: 3.5vh;
width: 1.75vw;
border-radius: 10px;
border: 1px solid #101010;
margin: 3px;
}
#media only screen and (max-width: 992px) {
.about-left {
height: 50%;
border-bottom: 3px solid black;
}
.about-right {
height: 50%;
width: 100%;
}
.about-content {
width: 70%;
}
.about-content-title h1 {
font-size: 5vw;
}
.about-content-info p {
font-size: 2.5vw;
}
.about-button button {
font-size: 2.5vw;
}
.about-personal-info h4 {
font-size: 2.5vw;
}
.about-icon img {
height: 20px;
width: 20px;
}
}
Try adding *{margin:0px; padding:0px;} to your stylesheet and then edit your div tags from there. Good luck.
You can use a css trick for vertical center a div in another div:
#outerdiv {
width: 700px;
margin-left: auto;
margin-right: auto;
height: 400px;
position: relative;
background: #eee;
text-align: center;
}
#innerdiv{
width: 240px;
height:100px;
position: absolute;
top: 50%;
left: 50%;
margin-left: -120px;/* half of #innerdiv width*/
margin-top: -50px;/* half of #innerdiv height*/
background: #ccc;
}
<div id="outerdiv">
<div id="innerdiv">Centered div</div>
</div>
The answer turned out to be that I needed to add 'margin-top: 0' to .about-content-title h1. There was an extra space above the h1 which was causing the content div to have extra blank space at the top of it. The div was centered but had blank space inside of it. This fixed it.
.about-content-title h1 {
font-size: 3.1vw;
margin-bottom: 0.6vh;
margin-top: 0;
}
I need to create this header design in HTMl for an A4 sheet.
This is the design I need:
I saw this question that helped, but I couldnt get it working right for my dimensions.
Wavy shape with css
This is the original fiddle:
http://jsfiddle.net/7fjSc/9/
This is what I'm tring:
http://jsfiddle.net/7fjSc/1422/
#wave {
position: relative;
height: 70px;
width: 2080px;
background: #e0efe3;
}
#wave:before {
content: "";
display: block;
position: absolute;
border-radius: 100% 50%;
width: 1300px;
height: 80px;
background-color: white;
right: -5px;
top: 40px;
}
#wave:after {
content: "";
display: block;
position: absolute;
border-radius: 100% 50%;
width: 1200px;
height: 70px;
background-color: #e0efe3;
left: 0;
top: 27px;
}
EDIT I'm tring to used fixed width for an A4 has 2080px. But I guess it would be even better if we can adapt this code to be relative (100%)
Any ideias on this?
based on the answer by Camaron A
#wave {
position: relative;
/*height and width can be set to anyhing*/
height: 50px;
width: 678px;
background: #a0d8ef;
background: -moz-linear-gradient(left, #a0d8ef 0%, #ddf1f9 50%, #ddf1f9 100%);
background: -webkit-gradient(linear, left top, right top, color-stop(0%, #a0d8ef), color-stop(50%, #ddf1f9), color-stop(100%, #ddf1f9));
background: -webkit-linear-gradient(left, #a0d8ef 0%, #ddf1f9 50%, #ddf1f9 100%);
background: -o-linear-gradient(left, #a0d8ef 0%, #ddf1f9 50%, #ddf1f9 100%);
background: -ms-linear-gradient(left, #a0d8ef 0%, #ddf1f9 50%, #ddf1f9 100%);
background: linear-gradient(to right, #a0d8ef 0%, #ddf1f9 50%, #ddf1f9 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#a0d8ef', endColorstr='#ddf1f9', GradientType=1);
}
#wave:before {
content: "";
display: block;
position: absolute;
border-radius: 67% 120% 0% 0%;
width: 51.3%;
height: 100%;
background-color: white;
left: 0;
bottom: -50%;
}
#wave:after {
content: "";
display: block;
position: absolute;
border-radius: 0% 0% 50% 100%;
width: 50.5%;
height: 100%;
right: 0;
bottom: -50%;
background: #ddf1f9;
}
<div id="wave" />
<div/>
I'm working on a news aggregation site's homepage and we're supposed to have a couple of areas that pull in content with the photo in the background and text on top with a gradient between the two. For the most part I have it except even though the z-index is lower, the gradient still appears above the text box. I've already experimented with this on a solid background just to be sure. The code and example are here: http://jsfiddle.net/cx0uvshd/
<style type="text/css">
.feature {
position: relative;
float: left;
width: 465px;
height: 170px;
margin-top: 24px;
margin-right: 30px;
}
.feature.last {
margin-right: 0;
}
.feature-bottom {
background: none;
position: absolute;
bottom: 0;
left: 0;
padding: 0 30px 6px;
width: 100%;
z-index: 200;
line-height: 1;
}
.feature-bottom::after {
content: "";
position: absolute;
bottom: 0px;
left: 0px;
width: 100%;
height: 100%;
z-index: 100;
background: rgba(0,0,0,0);
background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.5) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(0,0,0,0)), color-stop(50%, rgba(0,0,0,0.5)), color-stop(100%, rgba(0,0,0,0.5)));
background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.5) 100%);
background: -o-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.5) 100%);
background: -ms-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.5) 100%);
background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.5) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#000000', endColorstr='#000000', GradientType=0 );
}
.feature-bottom h3 {
color: #FFF;
font-size: 15px;
font-weight: 400;
margin: 0;
}
.feature-bottom h2 {
color: #FFF;
font-size: 24px;
font-weight: 400;
margin: 0;
}
</style>
Add (position:relative) and (z-index:201) to your feature-bottoms h3 and h2. Find revised code below:
.feature { position: relative; float: left; width: 465px; height: 170px; margin-top: 24px; margin-right: 30px; }
.feature.last { margin-right: 0; }
.feature-bottom {
background: none;
position: absolute;
bottom: 0;
left: 0;
padding: 0 30px 6px;
width: 100%;
z-index: 200;
line-height: 1;
}
.feature-bottom::after {
content: "";
position: absolute;
bottom: 0px;
left: 0px;
width: 100%;
height: 100%;
z-index: 100;
background: rgba(0,0,0,0);
background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.5) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(0,0,0,0)), color-stop(50%, rgba(0,0,0,0.5)), color-stop(100%, rgba(0,0,0,0.5)));
background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.5) 100%);
background: -o-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.5) 100%);
background: -ms-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.5) 100%);
background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.5) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#000000', endColorstr='#000000', GradientType=0 );
}
.feature-bottom h3 { position:relative; z-index:201; color: #FFF; font-size: 15px; font-weight: 400; margin: 0; }
.feature-bottom h2 { position:relative; z-index:201; color: #FFF; font-size: 24px; font-weight: 400; margin: 0; }
Why not applying gradient to .feature-bottom? Like this:
http://jsfiddle.net/cx0uvshd/2/
In the current version you have the :before element overlaying despite bigger z-index. You need new stacking context
Here's a similar question
A not so clean solution is to add another div with the content below the gradient one. Then give that div a class that is a copy of feature-bottom. Then set color of feature-bottom to transparent to hide the text. Also change the last two selectors to use the copy class. Also duplicate the last two selectors to use for the new class. JsFiddle
CSS:
.feature { position: relative; float: left; width: 465px; height: 170px; margin-top: 24px; margin-right: 30px; }
.feature.last { margin-right: 0; }
/*Copy of feature bottom*/
.feature-bottom2 {
background: none;
position: absolute;
bottom: 0;
left: 0;
padding: 0 30px 6px;
width: 100%;
z-index: 200;
line-height: 1;
}
.feature-bottom {
color: transparent;
background: none;
position: absolute;
bottom: 0;
left: 0;
padding: 0 30px 6px;
width: 100%;
z-index: 200;
line-height: 1;
}
.feature-bottom::after {
content: "";
position: absolute;
bottom: 0px;
left: 0px;
width: 100%;
height: 100%;
z-index: 100;
background: rgba(0,0,0,0);
background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.5) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(0,0,0,0)), color-stop(50%, rgba(0,0,0,0.5)), color-stop(100%, rgba(0,0,0,0.5)));
background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.5) 100%);
background: -o-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.5) 100%);
background: -ms-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.5) 100%);
background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.5) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#000000', endColorstr='#000000', GradientType=0 );
}
/* Copy of below*/
.feature-bottom2 h3 { color: #FFF; font-size: 15px; font- weight: 400; margin: 0; }
.feature-bottom2 h2 { color: #FFF; font-size: 24px; font-weight: 400; margin: 0; }
.feature-bottom h3 { font-size: 15px; font-weight: 400; margin: 0; }
.feature-bottom h2 { font-size: 24px; font-weight: 400; margin: 0; }
I have this simple button:
.btn {
border-radius: 2px;
background-image: -moz-linear-gradient( 90deg, rgb(235,235,235) 0%, rgb(254,254,254) 100%);
background-image: -webkit-linear-gradient( 90deg, rgb(235,235,235) 0%, rgb(254,254,254) 100%);
background-image: -ms-linear-gradient( 90deg, rgb(235,235,235) 0%, rgb(254,254,254) 100%);
color: rgb(64, 64, 64);
text-align: center;
height: 25px;
border: 1px solid #d9d9d9;
vertical-align: middle;
font-family: "Segoe UI";
box-shadow: 0px 0px 1px #d9d9d9;
}
<button class="btn">Some button</button>
Now I want to make something like this:
It's certainly not perfect, but it ain't too bad...
.btn {
border-radius: 2px;
background-image: -moz-linear-gradient( 90deg, rgb(235,235,235) 0%, rgb(254,254,254) 100%);
background-image: -webkit-linear-gradient( 90deg, rgb(235,235,235) 0%, rgb(254,254,254) 100%);
background-image: -ms-linear-gradient( 90deg, rgb(235,235,235) 0%, rgb(254,254,254) 100%);
color: rgb(64, 64, 64);
text-align: center;
height: 25px;
border: 1px solid #d9d9d9;
vertical-align: middle;
font-family: "Segoe UI";
box-shadow: 0px 0px 1px #d9d9d9;
position: relative;
}
.btn span {
position: relative;
z-index: 1;
}
.btn:after {
content: "";
width: 16px;
height: 16px;
background-image: -moz-linear-gradient( 135deg, rgb(235,235,235) 0%, rgb(254,254,254) 100%);
background-image: -webkit-linear-gradient( 135deg, rgb(235,235,235) 0%, rgb(254,254,254) 100%);
background-image: -ms-linear-gradient( 135deg, rgb(235,235,235) 0%, rgb(254,254,254) 100%);
display: block;
position: absolute;
top: 3px;
right: -9px;
border: 1px solid #d9d9d9;
border-left: none;
border-bottom: none;
border-radius: 2px;
-webkit-transform: rotate(47deg) skew(5deg);
-moz-transform: rotate(47deg) skew(5deg);
transform: rotate(47deg) skew(5deg);
}
<button class="btn"><span>Some button</span></button>
.btn {
position: relative;
background: #c2e1f5;
border: 10px solid #c2e1f5;
}
.btn:before {
left: 100%;
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.btn:before {
border-color: rgba(194, 225, 245, 0);
border-left-color: #c2e1f5;
border-width: 36px;
margin-top: -36px;
}
You can wrap the button in a button and then use the position as relative of the wrapper and then add a :before, you can add a border to the :before and make the width and height 0.
It's hard to explain, it's better if you check this blog: https://developerwings.com/button-with-a-sideways-triangle-using-css-html/
I've achieved nearly the look that a want and I've removed the irrelevant html and I want to improve the look of the button.
I've created a fiddle for the button.
I think that the color is good (the blue) and the goal is to make the text render and a look that is more clear. How can the text look less blurry and with sharper contrast ? The CSS is
html {
height: 100%;
overflow-y: scroll;
}
body {
background-color: rgb(255, 255, 235);
font-family: Verdana, sans-serif;
font-size: 12px;
line-height: 16px;
color: rgb(0, 0, 0);
height: 100%;
text-align: center;
background-position: initial initial;
background-repeat: initial initial;
}
#post {
display: block;
position: absolute;
top: 16px;
right: 0px;
height: 46px;
line-height: 46px;
}
#post a {
color: rgb(255, 255, 255);
text-shadow: rgb(255, 244, 210) 1px 1px 2px;
font-size: 20px;
}
#post a:hover, #post a span:hover {
text-decoration: none;
}
#ad {
display: inline-block;
border: 1px solid rgb(0, 0, 0);
width: 290px;
height: 45px;
font-size: 150%;
text-decoration: none;
text-align: center;
color: rgb(255, 255, 255);
font-weight: bold;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
background-image: -webkit-linear-gradient(top, rgb(109, 179, 242) 0%, rgb(84, 163, 238) 50%, rgb(54, 144, 240) 51%, rgb(30, 105, 222) 100%);
background-position: initial initial;
background-repeat: initial initial;
}
#post {
display: inline-block;
border: 1px solid black;
width: 290px;
height: 45px;
font-size: 150%;
text-decoration: none;
text-align: center;
color: white;
font-weight: bold;
-webkit-border-radius: 5px;
border-radius: 5px;
background: #6db3f2; /* Old browsers */
background: -moz-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #6db3f2), color-stop(50%, #54a3ee), color-stop(51%, #3690f0), color-stop(100%, #1e69de)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* IE10+ */
background: linear-gradient(to bottom, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6db3f2', endColorstr='#1e69de', GradientType=0); /* IE6-9 */
}
#post {
display: block;
position: absolute;
top: 16px;
right: 0;
height: 46px;
line-height: 46px;
}
#post span {
display: block;
float: left;
height: 52px;
}
#post a {
color: #FFF;
text-shadow: 1px 1px 2px #FFF4D2;
font-size: 20px;
}
#post a:hover, #post a span:hover {
text-decoration: none;
}
#ad {
display: inline-block;
border: 1px solid #000;
width: 290px;
height: 45px;
font-size: 150%;
text-decoration: none;
text-align: center;
color: #FFF;
font-weight: 700;
-webkit-border-radius: 5px;
border-radius: 5px;
background: #6db3f2;
/* Old browsers */
background: 0;
/* FF3.6+ */
background: 0 color-stop(50%, #54a3ee), color-stop(51%, #3690f0), color-stop(100%, #1e69de));
/* Chrome,Safari4+ */
background: 0;
/* Chrome10+,Safari5.1+ */
background: 0;
/* Opera 11.10+ */
background: 0;
/* IE10+ */
background: linear-gradient(tobottom, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%);
/* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6db3f2', endColorstr='#1e69de', GradientType=0);
/* IE6-9 */
}
Change the text shadow on #post a (And remove duplicate definitions) e.g.
#post a {
color: #FFF;
text-shadow: 1px 1px 2px #333;
font-size: 20px;
}
Demo: http://jsfiddle.net/4u4T7/5/
The text shadow makes it appear a little off, have a mock about with the text shadow and if you're not sure then use something like a text shadow generator to see a real time preview but I'd recommend using inspect element since it's better in my opinion.
Background
Colorzilla's gradient genetor is very helpful and is browser friendly. though in IE8 and below wont be that High Definition looking.
http://www.colorzilla.com/gradient-editor/
Text
Use text-shadow: 0 2px 0 #f2f2f2;
text-shadow: a, b, c, [d], e;
where a = distance from the text vertically (e.g. 1px, 2px, 0, -1px)
b = distance from the text horizontally (e.g. 1px, 2px, 0, -1px)
c = the weight of how it spreads out / smudge out / blur out (e.g. 1px, 2px, 0, -1px) in your case use 0 because you dont want it blurry looking
d = optional. great use for inner borders
e = color of the shadow
try to read on more of that to understand the syntax