Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
How can I make a border style like my added image?
Look at the left bottom border, the border has some gaps.
How can I make that by CSS?
This is the image
Place your border on the main container and then absolutely position the "Anna Jessica" container with a white background to cover the border. Here is a general example based on your image:
h2,
p {
margin: 0px;
}
#test {
border: solid 1px red;
padding: 15px 15px 75px 15px;
position: relative;
}
#bump-out {
display: flex;
position: absolute;
bottom: -38px;
left: 70px;
}
#bump-out-img {
padding: 0px 25px;
background: #FFF;
position: relative;
}
#bump-out-img:before {
content: "";
display: block;
box-sizing: border-box;
position: absolute;
top: -10px;
left: 12px;
width: 75px;
height: 75px;
border: solid 1px red;
}
#bump-out-img img {
display: block;
position: relative;
}
#bump-out-title p {
background: #FFF;
padding: 0px 20px 0px 0px;
display: inline-block;
}
<div id="test">
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.
Mauris placerat eleifend leo.</p>
<div id="bump-out">
<div id="bump-out-img">
<img src="http://via.placeholder.com/75x75" />
</div>
<div id="bump-out-title">
<h2>
Some Name
</h2>
<p>
Some Position
</p>
</div>
</div>
</div>
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I am looking for a way to allow an image inside of a div to stay overflow:visible and to allow the border of the parent div to overlap the image. Right now I have the image right where I want it using negative margins, but the images is covering the parent div's border.
I tried using z-index for the image and the div but that did now work.
This is the effect that I am trying to achieve.
http://imgur.com/a/yt8eU
This where I currently am.
http://imgur.com/a/sgYjI
https://jsfiddle.net/zgwywq0v/
random html <p>
Position the image absolutely or relatively and set it z-index: -1.
div.keynote {
border: 3px solid #F68B1F;
position: relative;
}
div.keynote img {
position: absolute;
left: -20px;
top: -20px;
z-index: -1;
}
https://jsfiddle.net/zgwywq0v/3/
The main trick here is to use the pseudo element ::before for the border, and to align them left/right I gave their parent keynote display: flex
Note, an obvious way would be using z-index, though if one can do it without, do it without
div.keynote {
position: relative;
display: flex;
}
div.keynote::before {
content: '';
position: absolute;
border: 3px solid #F68B1F;
left: 20px;
top: 20px;
right: 20px;
bottom: 20px;
}
div.keynote .speaker-info {
position: relative;
padding: 30px 30px 30px 10px;
box-sizing: border-box;
}
<div class="keynote keynote-border">
<div>
<img src="http://placehold.it/240x320">
</div>
<div class="speaker-info">
<p class="name">PASTOR
<br><strong>PATRICK</strong>WINFIELD</p>
<p class="session">PREPARING FOR TOMORROW</p>
<p class="description">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut molestie rutrum ipsum, luctus interdum metus egestas non. Aliquam at mi sollicitudin leo blandit ornare. Suspendisse laoreet ultrices ante. Nunc a velit elementum, pretium erat ut, vulputate
ante. Maecenas ac magna augue. Donec ac mauris lectus.</p>
</div>
</div>
Updated based on comment
If you can't/don't want to use flex, here is a fallback
div.keynote {
position: relative;
overflow: auto; /* clear float and grow with its content */
}
div.keynote::before {
content: '';
position: absolute;
border: 3px solid #F68B1F;
left: 20px;
top: 20px;
right: 20px;
bottom: 20px;
}
div.keynote div:first-child {
float: left;
width: 240px;
}
div.keynote .speaker-info {
position: relative;
margin-left: 240px; /* left div width */
padding: 30px 30px 30px 10px;
box-sizing: border-box;
}
<div class="keynote keynote-border">
<div>
<img src="http://placehold.it/240x320">
</div>
<div class="speaker-info">
<p class="name">PASTOR
<br><strong>PATRICK</strong>WINFIELD</p>
<p class="session">PREPARING FOR TOMORROW</p>
<p class="description">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut molestie rutrum ipsum, luctus interdum metus egestas non. Aliquam at mi sollicitudin leo blandit ornare. Suspendisse laoreet ultrices ante. Nunc a velit elementum, pretium erat ut, vulputate
ante. Maecenas ac magna augue. Donec ac mauris lectus.</p>
</div>
</div>
Take the image out of the div and place bordered div and img inside a parent with position: relative; then you can change the position and z-index of bordered div and img to get your result.
This looks like the perfect opportunity to deploy an ::after pseudo-element - this will enable you to make the orange border exactly the dimensions you need it to be and position it exactly where you want it to be, completely independently of all the other elements.
.profile-card {
margin: 100px 0 0 100px;
width: 600px;
height: 300px;
font-family: arial, helvetica, sans-serif;
}
.profile-card::after {
content: '';
position: absolute;
top: 70px;
left: 70px;
z-index: 0;
display: block;
width: 600px;
height: 220px;
border: 3px solid rgb(255,165,0);
}
.profile-card h2 {
font-weight: 300;
}
.profile-card h2 b {
font-weight: 900;
}
.profile-card p,
.profile-card a.more {
font-size: 11px;
}
.profile-card h2,
.profile-card h2 ~ strong,
.profile-card a.more {
text-transform: uppercase;
}
.profile-card img {
display: block;
float: right;
width: 280px;
height: 280px;
background-color: rgb(191,191,191);
border: 1px solid rgb(0,0,0);
transform: translateY(-108px);
}
.profile-card a.more {
display: inline-block;
position: relative;
z-index: 6;
margin-left: 90px;
padding: 12px;
color: rgb(255,255,255);
background-color: rgb(255,165,0);
text-decoration: none;
}
<div class="profile-card">
<h2><b>Profile</b> Name</h2>
<img src="/profile-name.png" alt="Profile Photo" />
<strong>Profile Tagline Here</strong>
<p>Paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here, paragraph here.</p>
<a class="more" href="/more.html">Read More</a>
</div>
This question already has answers here:
CSS Sticky Footers with Unknown Height
(7 answers)
Closed 7 years ago.
i would like to make my footer always show at the bottom of the pages and not move up when there is little page content. I tried
body, html {
height: 100%}
html body.wide #wrapper.container {
min-height: 100%;
position: relative;
padding-bottom: 226px!important;/*Footer height*/
}
#containerfooter {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
}
but since my site is responsive, the footer height varies and this code will hide content on some pages. Is there any way to make this work?
If the footer height varies based on the width of the screen, fixing it to the bottom of the viewport or screen won't be the solution.
I get the impression that content in the footer will wrap or collapse below each other as the screen size decreases, so rather set a minimum height on whichever element wraps the page content.
A Code Pen Example
$("#addBodyContent").on("click", function() {
$("<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>").appendTo(".page-wrap .content");
});
$("#addFooterContent").on("click", function() {
$("<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>").appendTo(".site-footer .content");
});
* {
margin: 0;
}
html,
body {
height: 92%;
font-family: "Helvetica", "Arial", "FreeSans", "Verdana", "Tahoma", "Lucida Sans", "Lucida Sans Unicode", "Luxi Sans", sans-serif;
}
.page-wrap {
min-height: 100%;
box-sizing: border-box;
padding: 10px;
}
.page-wrap:after {
content: "";
display: block;
}
.site-footer {
background: black;
position: relative;
left: 0;
right: 0;
bottom: 0;
min-height: 100px;
text-align: center;
padding: 10px;
color: white;
box-sizing: border-box;
}
button.dark:hover {
background-color: rgba(0, 0, 0, 0.7);
}
button.dark {
background-color: black;
border: 3px solid black;
padding: 10px 30px;
color: white;
cursor: pointer;
transition: .7s;
}
button.light:hover {
background-color: #CCCCCC;
}
button.light {
background-color: white;
border: 3px solid white;
padding: 10px 30px;
color: black;
cursor: pointer;
transition: .7s;
}
.content p {
margin-bottom: 10px;
}
.content {
border-top: 1px solid black;
padding-top: 10px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="page-wrap">
<h1>Header</h1>
<br>
<button id="addBodyContent" class="dark">Add Content</button>
<br>
<br>
<div class="content"></div>
</div>
<footer class="site-footer">
<h2>Footer</h2>
<br>
<button id="addFooterContent" class="light">Add Content</button>
<br>
<br>
<div class="content"></div>
</footer>
Use position: fixed. In #containerfooter
#containerfooter {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
}
for "sticky footer" see this tutorial
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I want to put three divs on my webpage, like this, the pink div is the container for two other divs and I want to center the div on the webpage (vertically and horizontally). I prepared some jsfiddle, but obviously I suck at css, so the effect is far from the expected one... So far my css looks like this:
#intro2{
background-color: #b0e0e6;
width: 50%;
margin: 0 auto;
font-size: 1.5em;
}
#intro2 .image{
position: absolute;
left: 0px;
background-color: #aaaae6;
}
#intro2 .text{
position: relative;
right: 0px;
background-color: #cccccc;
}
}
Could you help me with that?
Thanks.
Try like this:-
#intro2{
background-color: #b0e0e6;
width: 50%;
margin: 0 auto;
font-size: 1.5em;
padding: 5px;
}
.clear{
clear: both;
}
#intro2 .image{
float:left;
width:50%;
background-color: #aaaae6;
}
#intro2 .text{
float: right;
width:50%;
background-color: #cccccc;
}
<div class="intro" id="intro2">
<div class="image" id="image1">
<img src="http://www.cdc.gov/animalimportation/images/dog2.jpg" alt="simple" />
</div>
<div class="text" id="text1">
<h1>Simple</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis sodales sit amet mauris in blandit. Aenean sodales in dui eget facilisis. Vestibulum tempor risus dui, sed pharetra nulla auctor id. Sed purus odio, tempus et volutpat a, fermentum sit amet ante. Etiam eros mauris, rutrum at vehicula a, vehicula vitae nulla. Suspendisse non mattis turpis. Donec non convallis lacus. Nullam gravida diam et leo tempor vestibulum. Vivamus lorem nunc, bibendum eu lacinia quis, porta vel nisl. Sed vitae euismod augue. In at est lacinia ipsum feugiat feugiat. Praesent mollis posuere ante, eget maximus est mollis suscipit. Donec ullamcorper elit quis cursus gravida. Quisque leo risus, bibendum sed nisi ut, facilisis iaculis arcu. Pellentesque purus augue, fringilla tempus augue eget, ullamcorper condimentum leo.</p>
</div>
<div class="clear"></div>
</div>
Here:
#intro2{
background-color: #b0e0e6;
width: 50%;
left:50%;
font-size: 1.5em;
position:absolute;
margin-left:-25%;
}
That way your container is centered on the page.
I'm not sure I would go with the absaloute positioning method you've gone for on this occasion. I think perhaps a display:table on the wrapper and display:table-cell on the children would give you more control over your style.
#intro2{
background-color: #b0e0e6;
width: 50%;
margin: 0 auto;
font-size: 1.5em;
}
#intro2 .image{
background-color: #aaaae6;
display: table-cell;
vertical-align: top;
}
#intro2 .text{
background-color: #cccccc;
display: table-cell;
vertical-align: top;
}
Here's an example: http://jsfiddle.net/Lfyacy25/2/
http://jsfiddle.net/Lfyacy25/3/
#intro2{
background-color: #b0e0e6;
width: 50%;
margin: 0 auto;
font-size: 1.5em;
}
#intro2 .image{
float: left;
width: 50%;
background-color: #aaaae6;
}
#intro2 .text{
float: left;
width: 50%;
background-color: #cccccc;
}
.clearfix:after {
content: "";
display: table;
clear: both;
}
.intro{
background-color: #b0e0e6;
width: 100%;
margin: 0 auto;
font-size: 1.5em;
padding: 5px;
}
.intro:before,.intro:after {
content: " ";
display: table;
}
.intro:after {
clear: both;
}
.image{
width: 50%;
background-color: #aaaae6;
float: left;
}
img{
margin: 0 auto;
display: block;
}
.text{
width: 50%;
background-color: #cccccc;
float: left;
}
Updated fiddle
try the following:
<div class="outter">
<div class="innerleft">image goes here</div>
<div class="innerright">text goes here</div>
</div>
.outter {width:100%; min-height:120px; background-color:red; padding:1% }
.innerleft {float:left; width:49%;background-color: green;min-height:120px; }
.innerright {float:right; width:49%;background-color: blue;min-height:120px; }
I want to add the quote box below (created in Photoshop) on my website but would love for it to be created "dynamically" with preferably HTML5/CSS3 (+ jQuery if not possible with HTML/CSS alone). Using images for the quotes is also possible, but would prefer none for the best responsive solution. Width can be fixed but height should adjust to contents within the box.
Googled and searched SO for a solution but couldn't find one.
But! .. found some html blockquote element CSS (see below and [jsbin here][1]) that does everything but the lines, but don't have the skills to get them "drawn" myself, so will appreciate if someone will help. Thanks!
Update
Getting close now!
See here: http://jsbin.com/giwafo/1/ (locked, clone to make changes)
The idea is to position a box that has the background color on top of the border on the <blockquote> element, but I can't seem to figure out how to do this so it adapts to the size of the quote/blockquote and is position correctly no matter what size the blockquote is.
Any ideas?
.container {
z-index: 1;
background: white;
padding: 2em;
}
blockquote {
padding: 2em 1.5em 2em 2em;
position: relative;
color: #999;
}
blockquote p {
color: #555;
}
#media screen and (min-width: 300px) {
blockquote {
border: 1px solid gray;
}
blockquote:before, blockquote:after {
background-color:white;
font-size: 3em;
font-weight: 800;
position: absolute;
z-index: 20;
}
blockquote:before {
content:url('http://download.easyicon.net/png/534874/32/');
width: 34px;
height: 31px;
left: 2px;
top: 2px;
-ms-transform: rotate(178deg); /* IE 9 */
-webkit-transform: rotate(178deg); /* Chrome, Safari, Opera */
transform: rotate(178deg);
}
blockquote:after {
content:url('http://download.easyicon.net/png/534874/32/');
width: 31px;
height: 37px;
right: 3px;
bottom: 0px;
}
}
blockquote cite {
font-size: 14px;
margin-top: 5px;
margin-bottom: -7px;
}
blockquote cite:before {
content:"\2014 \2009";
}
<div class="container">
<blockquote>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
<footer> <cite>Somebody famous</cite> </footer>
</blockquote>
</div>
hope it can help you
Thanks to #Jasper (see comments under my question above), I resolved it. Solution can be found here: jsbin.com/ziquzi/2.
CSS:
.container {
z-index: 1;
background: white;
padding: 2em;
}
blockquote {
padding: 2em 1.5em 2em 2em;
position: relative;
color: #999;
}
blockquote p {
color: #555;
}
#media screen and (min-width: 300px) {
blockquote {
border: 1px solid gray;
}
blockquote:before, blockquote:after {
background-color: white;
font-size: 3em;
font-weight: 800;
position: absolute;
height: 20px;
z-index: 10;
}
blockquote:before {
content:"\201D";
padding: 0 12px 11px 0;
left: -8px;
top: -8px;
}
blockquote:after {
content:"\201C";
padding: 9px 0 0 11px;
right: -8px;
bottom: -7px;
}
}
blockquote cite {
font-size: 14px;
margin-top: 5px;
}
blockquote cite:before {
content:"\2014 \2009";
}
HTML:
<!DOCTYPE html>
<html>
<head>
<title>test</title>
</head>
<body>
<div class="container">
<blockquote>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
<footer>
<cite>Somebody famous</cite>
</footer>
</blockquote>
</div>
</body>
</html>
I'm having a problem with with positioning elements on top of each other.
Here is my markup:
<div id="glownySlajder">
<ul>
<li>
<img src="inc/img/slajder_bg.jpg" alt="Slajd" class="slajd">
<div class="fr">
<img src="inc/img/strzalka_lewo.png" alt="strzalka_lewo">
<p class="fl">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed laoreet consequat gravida. Nunc sed risus est, ac vestibulum nisl. Suspendisse sagittis velit a massa auctor accumsan. Aliquam hendrerit libero tellus, at molestie leo. Curabitur sodales </p>
<img src="inc/img/strzalka_prawo.png" alt="strzalka_prawo">
</div>
</li>
</ul>
</div>
Here is my css:
#glownySlajder {
margin-bottom: -2px;
}
#glownySlajder a {
margin: 7px;
}
#glownySlajder ul li img {
z-index: 9998;
}
#glownySlajder div {
z-index: 9999;
color: black;
background-color: #e7e7e7;
height: 85px;
width: 500px;
padding: 0px 5px;
}
#glownySlajder div p {
font-size: 11px;
line-height: 14px;
margin-top: 20px;
width: 390px;
}
.fr {
float: right;
}
.fl {
float: left;
}
This is what I get:
This is want I want to achieve:
The problem is that z-index doesn't seem to be working. When I try to do negative margin on a div with p, it just disappears under the image, not what I want exactly.
I am unable to work this out on my own, any tips please?
First of all, z-index only works on block elements (display:block). Second, it is only useful for elements which are in the same stacking context. Third, don't use margin to position. Use position: and top, left, right, bottom for this.
References:
CSS2.1: Stack level
CSS2.1: Positioning