I want my #wrap to have bottom:0 so that my cards all align to the bottom of the viewport but it doesn't seem work when I applied position absolute to the wrapper. Why does it so?
<div id="wrap">
<div class="card" id="card1">black</div>
<div class="card" id="card2">pink</div>
<div class="card" id="card3">orange</div>
</div>
CSS
.card{
border:1px solid black;
height:120px;
width:100px;
position:absolute;
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
#wrap{
position:absolute;
bottom:0;
height: 100% !important;
min-height: 100% !important;
}
#card1{
background:black;
top:0;
}
#card2{
background:pink;
top:10px;
}
#card3{
background:orange;
top:20px;
}
http://jsfiddle.net/t94vdwak/1/
Here you go buddy
http://jsfiddle.net/incept0/rrapj20o/4/
.card{
border:1px solid black;
height:120px;
width:100px;
position:absolute;
bottom: 0;
left: 0;
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
#wrap{
position:absolute;
bottom:0;
left: 0;
height: 120px;
min-height: 120px;
}
#card1{
background:black;
top:0;
}
#card2{
background:pink;
top:10px;
}
#card3{
background:orange;
top:20px;
}
The wrapper itself must be positioned absolutely at the bottom and then the cards must be offset within the wrapper.
http://jsfiddle.net/ryvvyqfc/
.card {
border:1px solid black;
height:120px;
width:100px;
position:absolute;
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
#wrap{
position:absolute;
bottom:0;
}
#card1{
background:black;
top:0;
}
#card2{
background:pink;
top:10px;
}
#card3{
background:orange;
top:20px;
}
it seems that you specify that you need the stack of cards on the bottom of the viewport, well position: absolute align items against the page, if you want to align items against the viewport you could use position: fixed.
Here I edited your sample:
.card{
border:1px solid black;
height:120px;
width:100px;
position:absolute;
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
#wrap{
position:fixed;
bottom:0;
overflow: visible;
}
#card1{
background:black;
bottom:20px;
}
#card2{
background:pink;
bottom:10px;
}
#card3{
background:orange;
bottom:0px;
}
<div id="wrap">
<div class="card" id="card1">black</div>
<div class="card" id="card2">pink</div>
<div class="card" id="card3">orange</div>
</div>
This way your items will stick to the bottom of the viewport even if you scroll down.
How it works is that wrapper has no height but it does not hide the overflow and cards are positioned not from the top(like in your example) but from the bottom (reverse of what you did)
Don't forget that if you want the items to be over other content to adjust z-index property.
Related
First, I know there are similar questions available (like. Create concave corners in css) but they don't really cover this situation.
This is not about single cell/div element.
I have three blocks that will have some text content inside:
top-middle centered block (narrow)
middle-middle block (screen-wide)
bottom-middle centered block (narrow)
Basically something like a cross (text removed):
The outer corners (8) is straighforward but how could I achieve those inner ones (4)?
see bellow code, maybe it needs some adjustments but the idea is that you use pseudo-elements to make those inner borders
let me know if this is what you want
.colored {
background:yellow;
border:5px solid green;
width:100px;
height:100px;
box-sizing:border-box;
position:relative;
}
#content {
width:300px;
position:relative;
background:#000;
}
.top,.bottom { position:relative;margin:0 auto;clear:both}
.top { border-bottom:none}
.bottom { border-top:none}
.left { border-right:none}
.right { border-left:none;}
.colored.center { border:none;}
.left,.center,.right { float:left;}
.top { border-top-left-radius:10px;border-top-right-radius:10px;}
.bottom { border-bottom-left-radius:10px;border-bottom-right-radius:10px;}
.right { border-bottom-right-radius:10px;border-top-right-radius:10px;}
.left { border-bottom-left-radius:10px;border-top-left-radius:10px;}
.top:before {
position:absolute;
height:100%;
width:100%;
left:-100%;
top:5px;
content:"";
border-bottom-right-radius:10px;
border-right:5px solid green;
border-bottom:5px solid green;
z-index:9999;
box-sizing:border-box;
}
.top:after {
position:absolute;
height:100%;
width:100%;
right:-100%;
top:5px;
content:"";
border-bottom-left-radius:10px;
border-left:5px solid green;
border-bottom:5px solid green;
z-index:9999;
box-sizing:border-box;
}
.bottom:before {
position:absolute;
height:100%;
width:100%;
left:-100%;
bottom:5px;
content:"";
border-top-right-radius:10px;
border-right:5px solid green;
border-top:5px solid green;
z-index:9999;
box-sizing:border-box;
}
.bottom:after {
position:absolute;
height:100%;
width:100%;
right:-100%;
bottom:5px;
content:"";
border-top-left-radius:10px;
border-left:5px solid green;
border-top:5px solid green;
z-index:9999;
box-sizing:border-box;
}
<div id="content">
<div class="top colored">
</div>
<div class="left colored">
</div>
<div class="center colored">
</div>
<div class="right colored">
</div>
<div class="bottom colored">
</div>
</div>
Variation with just three divs, a bit hacky but functional. Uses pseudo elements, transforms and inner box-shadow.
div {
background-color: #000;
min-height: 100px;
}
.center {
width: 100px;
margin: 0 auto;
}
.rounded {
border-radius: 20px;
border: 5px solid red;
}
.conc {
position: relative;
}
.conc::before,
.conc::after {
content: '';
position: absolute;
border: 5px solid red;
border-radius: 20px;
width: 25px;
height: 25px;
background-color: trnaspanret;
border-color: red transparent transparent;
z-index: 3;
box-shadow: white 0px 0px 0px 20px inset
}
.conc.bottom {
margin-bottom: -5px;
border-bottom: 0;
border-radius: 20px 20px 0 0
}
.conc.top {
margin-top: -5px;
border-top: 0;
border-radius: 0 0 20px 20px
}
.conc::before {
left: -35px;
}
.conc::after {
right: -35px;
}
.conc.top::before,
.conc.top::after {
top: 0px;
}
.conc.bottom::before,
.conc.bottom::after {
bottom: 0px;
}
.conc.bottom::before {
transform: rotate(135deg)
}
.conc.bottom::after {
transform: rotate(-135deg)
}
.conc.top::before {
transform: rotate(45deg)
}
.conc.top::after {
transform: rotate(-45deg)
}
.centerblinders {
position: relative;
}
.centerblinders::before,
.centerblinders::after {
content: '';
position: absolute;
width: 130px;
height: 20px;
background-color: #000;
left: 50%;
transform: translatex(-50%);
z-index: 2;
}
.centerblinders::before {
top: -15px;
}
.centerblinders::after {
bottom: -15px;
}
<div class="rounded center conc bottom"></div>
<div class="rounded centerblinders"></div>
<div class="rounded center conc top"></div>
I want to create arc transparent inside border radius with CSS\html. In fact I want corner div to be transparent and display bottom of page.
.corner{
float:right;
border-top-left-radius:60%;
width:50px;
height:48px;
margin-top:2px;
background:#fff;
background:rgba(f,f,f,0.1);
}
.div{
background-color: rgb(50,20,70);
width:130px;
height:50px;
}
.left{
float:left;
width:70px;
height:48px;
margin-top:2px;
color:white;
}
<div class="div">
<div class="left">345345</div>
<div class="corner"></div>
</div>
You can use a box-shadow to keep a transparent background on .corner :
.corner {
float: right;
border-top-left-radius: 60%;
width: 50px;
height: 48px;
margin-top: 2px;
box-shadow:0 0 0 500px rgb(50, 20, 70);
}
.div {
overflow:hidden;
width: 130px;
height: 50px;
}
.left {
float: left;
width: 70px;
height: 48px;
margin-top: 2px;
color: white;
}
body{
background:url('http://lorempixel.com/output/people-q-c-640-480-7.jpg');
background-size:cover;
<div class="div">
<div class="corner"></div>
<div class="left">345345</div>
</div>
My HTML page with 2 columns and footer and header:
<div id="main">
<div class="header"> </div>
<div class="left"> </div>
<div class="data"> </div>
<div class="bottom"> </div>
</div>
In my case I want left DIV with auto width and data DIV with 100% width. Like on this image:
How to CSS with IE 6 support? Thank you!
Demo
html
<div class="header">
header content
</div>
<div class="content">
<div class="left">left</div>
<div class="right">right</div>
</div>
<div class="footer">
footer content
</div>
css
body, html{
padding:0;
margin:0;
position:relative;
height:100%
}
.header, .footer{
width:100%;
background:#ccc;
padding:10px;
box-sizing:border-box;
}
.content{
background:#eee;
width:100%;
padding:10px;
height:100%;
box-sizing:border-box;
padding:10px;
}
.left{
width:50%;
float:left;
background:#bbb;
height:100%;
}
.right{
width:50%;
float:right;
background:#aaa;
height:100%;
}
as required DEMO
css
keeping everything same as above just change below css
.content{
background:#eee;
width:100%;
padding:10px;
height:100%;
box-sizing:border-box;
padding:10px;
display:table
}
.left{
width:auto;
background:#bbb;
height:100%;
display:table-cell
}
.right{
background:#aaa;
height:100%;
display:table-cell;
width:100%
}
It will work i think.
Please check and let me know.
.container {
width: 500px;
max-height: 500px;
margin: 10px;
border: 1px solid #fff;
background-color: #ffffff;
box-shadow: 0px 2px 7px #292929;
-moz-box-shadow: 0px 2px 7px #292929;
-webkit-box-shadow: 0px 2px 7px #292929;
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
.mainbody,
.header,
.footer {
padding: 5px;
}
.mainbody {
margin-top: 0;
min-height: 150px;
max-height: 388px;
overflow: auto;
}
.header {
height: 40px;
border-bottom: 1px solid #EEE;
background-color: #ffffff;
height: 40px;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.footer {
height: 40px;
background-color: whiteSmoke;
border-top: 1px solid #DDD;
-webkit-border-bottom-left-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
-moz-border-radius-bottomleft: 5px;
-moz-border-radius-bottomright: 5px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
.left{
width:50%;
float:left;
background:#bbb;
height:100%;
}
.right{
width:50%;
float:right;
background:#aaa;
height:100%;
}
<div id="container">
<div class="header">Header</div>
<div class="mainbody">
<div class="left">left</div>
<div class="right">right</div>
</div>
<div class="footer">Footer</div>
</div>
How to accomplish this div border using css:
I tried using dashed border but leads to this:http://jsfiddle.net/23qGr/
div {width: 20px;
height: 20px; border: 6px #6a817d dashed;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
You could use pseudo element and transparent/black borders : DEMO
div {
width: 20px;
height: 20px;
padding:6px;
position:relative;
}
div:before , div:after {
content:'';
border:6px solid transparent;
position:absolute;
}
div:before {
left:2px;
right:2px;
top:0;
bottom:0;
border-top-color:black;
border-bottom-color:black;
}
div:after {
top:2px;
bottom:2px;
left:0;
right:0;
border-right-color:black;
border-left-color:black;
}
If you increse border-width, it looks better : demo
I'm trying to build a facebook like Profile/Cover Layout, but i'm struggling with the correct layout.
What i have so far:
http://jsfiddle.net/kvEBF/
<div class="user_profile_cap">
<div class="user_profile_cover">
<img src="jpgfile" alt=""/>
</div>
<div class="user_profile_headline">
Pull Right Text
</div>
</div>
css
.user_profile_cap {
width: 970;
height: auto 9;
border: 1px solid #DDD;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.user_profile_cover {
img {
width: 970px;
height: 115px;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
}
.user_profile_headline {
padding: 10px;
font-size: 16px;
}
http://jsfiddle.net/kvEBF/
The Desired Layout
I'm struggling on placing the Profile Picture, the Page Title and the Right Text correctly in to this Layout.
Can somebody help me out ?
Like this
working demo
css
.user_profile_cap {
width: 970;
height: auto 13;
border: 1px solid #DDD;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
overflow:hidden;
}
.user_profile_cover {
img {
width: 970px;
height: 115px;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
}
.user_profile_headline {
padding: 10px;
font-size: 16px;
}
.user_profile_headline img{
border:1px solid #EEEEEE;
width:124px;
height:124px;
float:left;
margin:-90px 10px 0 0;
position:relative;
z-index:111;
background-color:white;
}
.user_profile_headline h2{
margin:0;
padding:0;
font-size:12px;
font-weight:bold;
display:block;
}
.user_profile_headline span{
font-size:10px;
font-family:verdana;
color:gray;
}