I've wrote the following CSS that uses pseudo elements to design a footer.
Looks like it works fine on Chrome & Firefox on windows but on Safari the footer_il::after goes on the bottom of the page.
When im adding margin-top: -20em; on .footer_il::after it's working the way i want it but it obviously breaks on other browsers.
.footer_il::before {
width: 75px;
height: 70px;
-webkit-transform: rotate(134deg);
-ms-transform: rotate(134deg);
transform: rotate(134deg);
left: calc(100% - 463px - 85px);
margin-top: -2em;
}
.footer_il::after {
height: 54px;
left: 0;
width: calc(100% - 449px - 63px);
}
.footer_il::before,
.footer_il::after {
z-index: 100;
position: absolute;
content: "";
background-color: #f7f7f7
}
.footer {
height: 20em;
background-color: #000;
width: 100%;
display: inline-flex;
}
<!-- Footer -->
<footer class="footer_il bg-light">
<div class="footer">
<div class="footer_section_1">
<div class="footer_container">
<div class="footer_branding">
<div class ="footer_logo">
</div>
</div>
</div>
</div>
<div class="footer_section_2">
</div>
<div class="footer_section_3">
<div class="footer_container">
</div>
</div>
<div class="footer_section_4">
</div>
</div>
</footer>
So just by playing around a bit i ended up with the following result. Thanks to pschueller for the hint.
I've added the entire footer into a container. Set the class in absolute position and 100% width. Then added inside the ::after class 0 distance from top.
Now it's working on Mac OS Safari. Because there wasn't a top before it was getting outside of it's intended position.
.footer_entire_container {
position: absolute;
width: 100%;
}
.footer_il::before {
width: 75px;
height: 70px;
-webkit-transform: rotate(134deg);
-ms-transform: rotate(134deg);
transform: rotate(134deg);
left: calc(100% - 463px - 85px);
margin-top: -2em;
}
.footer_il::after {
height: 54px;
left: 0;
top: 0;
width: calc(100% - 449px - 63px);
}
.footer_il::before,
.footer_il::after {
z-index: 100;
position: absolute;
content: "";
background-color: #f7f7f7
}
.footer {
height: 20em;
background-color: #000;
width: 100%;
display: inline-flex;
}
<!-- Footer -->
<div class="footer_entire_container">
<footer class="footer_il bg-light">
<div class="footer">
<div class="footer_section_1">
<div class="footer_container">
<div class="footer_branding">
<div class ="footer_logo">
</div>
</div>
</div>
</div>
<div class="footer_section_2">
</div>
<div class="footer_section_3">
<div class="footer_container">
</div>
</div>
<div class="footer_section_4">
</div>
</div>
</footer>
</div>
Related
What element do I need to create black lines in the image ? [![enter image description here][1]][1]
I have written code but I need lines like image (create between images) how can I do this?
Please tell me
My codes are as follows:
using ":after" & ":before" you can set line between two images
.hiw-content .hiw-img img {
width: 100%;
height: auto;
padding: 100px;
}
div#a3:after {
z-index: 999;
content: '';
width: 150px;
background-color: black;
/* left: 0; */
height: 5px;
position: absolute;
right: -80px;
top: 50%;
border-radius: 100px;
}
div#a3:before {
z-index: 999;
content: '';
width: 150px;
background-color: black;
left: -80px;
height: 5px;
position: absolute;
/* right: 50%; */
top: 50%;
border-radius: 100px;
}
div#a3 {
overflow: visible;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="wrapper">
<div class="col-md-4 col-hiw col-hiw-bottom" id="a4">
<div class="hiw-content">
<div class="hiw-img"><img src=""></div>
<span class="hiw-title">Customer Service</span>
<p class="hiw-content">Let our dedicated customer service team take care of any inquiries</p>
</div>
</div>
<div class="col-md-4 col-hiw col-hiw-bottom" id="a3">
<div class="hiw-content">
<div class="hiw-img"><img src=""></div>
<span class="hiw-title">Order fulfilled</span>
<p class="hiw-content">Once a buyer places an order we’ll take care of order production and shipping.</p>
</div>
</div>
<div class="col-md-4 col-hiw col-hiw-bottom" id="a2">
<div class="hiw-content">
<div class="hiw-img"><img src=""></div>
<span class="hiw-title">Boost your sales</span>
<p class="hiw-content">Use Teesprings Boosted Network, Marketing Tools and Partnership Integrations </p>
</div>
</div>
</div>
It is easier to help you if you included more detailed code, the code above really doesn't help, to create a simple line you can do something like this (adjust margin and height/width appropriately) :
.underline {
width: 5rem;
height: 0.25rem;
background: #000;
}
<div class="underline"></div>
I'm trying to remove the automatically generated container margin around this image. Below is the code I used to produce it. You can view the website here. I tried to add a margin and padding item to the body element, but it didn't resolve the issue.
.container {
position: relative;
width: 240px;
height: 240px;
}
.image {
display: block;
width: 100%;
height: auto;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
opacity: 0;
transition: .5s ease;
background-color: #008CBA;
}
.container:hover .overlay {
opacity: 0.85;
}
.text {
color: white;
font-size: 20px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
}
<div class="container">
<img src="./img/headshots/Exec_DMoon.jpg" width="240" height="240" alt="Photo of David Moon, Assistant Vice President for Financial Affairs" class="image">
<div class="overlay">
<div class="text"><b>David Moon</b> Assistant Vice President for Financial Affairs, <a class="usa-external_link" target="_blank" href="mailto:davidmoon826#gwmail.gwu.edu">Email</a></div>
</div>
</div>
This is the desired output:
What am I doing wrong?
The easiest fix for this, imo: wrap the items you want in a grid in a div and give the div display: flex and flex-wrap: wrap. Good luck!
Well, just add float: left to .container
(to achieve what you show under "this is the desired output")
The answer from Johannes almost worked, but it caused issues where text would reposition itself into the open gaps (see image below), instead of formatting below all the images.
The solution was to use display: inline-block; in .container, as Adrian recommended.
<!DOCTYPE html>
<html>
<head>
<style>
.container {
position: relative;
width: 50%;
height: 50%;
display: inline-block;
}
.image {
display: block;
width: 100%;
height: auto;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
opacity: 0;
transition: .5s ease;
background-color: #008CBA;
}
.container:hover .overlay {
opacity: 0.8;
}
.text {
color: white;
font-size: 25px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
}
</style>
</head>
<body>
<h2>Fade in Overlay</h2>
<p>Hover over the image to see the effect.</p>
<div class="container">
<img src="img_avatar.png" alt="Avatar" class="image">
<div class="overlay">
<div class="text">Hello World</div>
</div>
</div>
<div class="container">
<img src="img_avatar.png" alt="Avatar" class="image">
<div class="overlay">
<div class="text">Hello World</div>
</div>
</div>
<div class="container">
<img src="img_avatar.png" alt="Avatar" class="image">
<div class="overlay">
<div class="text">Hello World</div>
</div>
</div>
<h2>Fade in Overlay</h2>
<p>Hover over the image to see the effect.</p>
</body>
</html>
I'm trying to create a text block with transparent background which is the same width as the image. However if I just add padding to the header then some may overlap or not be long enough due to the varying length in text.
Currently looks like this: http://puu.sh/sdBCX/994cc31da8.png
Here is the relevant HTML:
<div class="container-fluid">
<div class="row">
<div class="artist-grid">
<div class="col-lg-2"></div>
<div class="col-lg-2">
<img id="#artistTile" src="https://dummyimage.com/300x300">
<h3><span>BASSNECTAR</span></h3>
</div>
<div class="col-lg-2">
<img id="#artistTile" src="https://dummyimage.com/300x300">
<h3><span>DATSIK</span></h3>
</div>
<div class="col-lg-2">
<img id="#artistTile" src="https://dummyimage.com/300x300">
<h3><span>CHAINSMOKERS</span></h3>
</div>
<div class="col-lg-2">
<img id="#artistTile" src="https://dummyimage.com/300x300">
<h3><span>ZEDS DEAD</span></h3>
</div>
<div class="col-lg-2"></div>
</div>
</div>
</div>
And the relevant CSS:
h3 {
position: absolute;
top: 244px;
width: 100%
}
h3 span {
color: white;
background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.7);
padding: 10px;
}
.artist-grid {
padding-top: 22px;
}
#artistTile {
position: relative;
max-width: 100%;
}
Cheers!
div {
width: 200px;
height: 200px;
display: block;
position: relative;
}
div::after {
content: "";
background: url(image.jpg);
opacity: 0.5;
top: 0;
left: 0;
bottom: 0;
right: 0;
position: absolute;
z-index: -1;
}
Hi I'm trying to create a collage of three images, like the concept shown in this site: https://codepen.io/zacharybrady/pen/aGmFp
The HTML:
<div class="container">
<div class="diagonal" id="d0">
<img src="http://www.shortpacked.com/comics/2013-02-08-prologue.png" />
<p class="overlay">
TEST
</p>
</div>
<div class="diagonal" id="d1">
<img src="http://www.questionablecontent.net/comics/2381.png" />
<p class="overlay">
TEST
</p>
</div>
<div class="diagonal" id="d2">
<img src="http://www.shortpacked.com/comics/2005-01-17-bow-before-your-master.gif" />
<p class="overlay">
TEST
</p>
</div>
<div class="diagonal" id="d3">
<img src="http://www.questionablecontent.net/comics/2021.png" />
<p class="overlay">
TEST
</p>
</div>
<div class="diagonal" id="d4">
<img src="http://www.shortpacked.com/comics/2009-03-27-fourohfour.png" />
<p class="overlay">
TEST
</p>
</div>
</div>
THE CSS:
#import "compass/css3";
#import "compass/css3";
body{
background: blue;
}
.container{
width: 800px;
height: 400px;
background: white;
overflow: hidden;
position: relative;
margin-left: 100px;
.diagonal{
height: 1200px;
width: 200px;
overflow: hidden;
#include rotate(25deg);
position: absolute;
top: -200px;
img{
#include rotate(-25deg);
margin-top: -100px;
margin-left: -200px;
}
.overlay{
#include rotate(-25deg);
height: 1200px;
width: 800px;
position: absolute;
top: -50px;
left: 0;
background: black;
opacity: 0;
color: white;
-webkit-transition: opacity .5s;
vertical-align: middle;
text-align: center;
&:hover{
opacity: .8;
}
}
&#d0{
left: -180px;
}
&#d1{
left: 40px;
}
&#d2{
left: 260px;
}
&#d3{
left: 480px;
}
&#d4{
left: 700px;
}
}
}
Question: How can I add additional transitions that when a specific image is hovered, it will expand to its full width?
PLEASE DON'T MARK this as duplicate or close this for having ambiguous question, because I know and you know the question there is clear and understandable.
You could change the z-axis on hover, so that the full image comes to the front.
I have a problem implementing this schema:
Here is a jsfiddle: http://jsfiddle.net/ptCoder/3WB32/
The "Bar 2" need to be rotate in vertical:
transform: rotate(90deg);
-ms-transform: rotate(90deg); /* IE 9 */
-webkit-transform: rotate(90deg); /* Safari and Chrome */
Can anyone help me?
Thank You.
You could fudge something like this together DEMO http://jsfiddle.net/kevinPHPkevin/3WB32/5/
<div class="container">
<div id="hbar">Bar 1</div>
<div id="vbar">Bar 2</div>
<canvas id="c" width="400px" height="400px">CANVAS</canvas>
</div>
Below is a custom approach I've built, it personally makes more sense to me to do it this way. You can see how it functions / looks by clicking on the example on the bottom.
The HTML:
<div id="wrapper">
<div id="bar-1">
<p>Bar 1</p>
</div>
<div id="bar-2">
<p>Bar 2</p>
</div>
<div id="canvas">
This is the canvas
</div>
</div>
The CSS:
#wrapper{
min-height: 500px;
position: relative;
background: #ccc;
}
#bar-1{
position: absolute;
left: 100px;
right: 100px;
background: blue;
height: 100px;
}
#bar-2{
position: absolute;
top: 100px;
background: red;
bottom: 100px;
width: 100px;
}
#canvas{
position: absolute;
top:100px;
left: 100px;
background: yellow;
bottom: 100px;
right: 100px;
}
Click here for a working example of the above code:
You are giving same class to both div
<div id="hbar" class="hbar">Bar 1</div>
<div id="vbar" class="hbar">Bar 2</div>
change second one to vbar