here is my how i want the website design to be :
so i am in the initial step, my query is how do i place the slider div upon the header div and i want it to be in the centre. my code what i have used is :
<div id="header">
<div class="slider">
</div>
</div>
<div class="content">
</div>
<div class="footer">
</div>
body {
margin:0px;
padding:0px;
background:#fff;
}
#header
{
background:#859685;
height:300px;
}
.slider
{
margin-left:auto;
margin-right:auto;
margin-top:50px;
position:absolute;
z-index:1;
width:980px;
height:200px;
border: 4px #666 solid;
}
.content
{
margin-left: auto;
margin-right: auto;
margin-bottom:10px;
margin-top:10px;
width:980px;
height:400px;
background:#fff;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
.footer
{
margin-top:10px;
margin-bottom:10px;
padding: 0;
height:300px;
background:#98AFC7;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
background:#111312;
}
here is my fiddle jsfiddle.net/hdmep/
Thanx in advance!
Change your slider class to something like this:
.slider
{
margin-left:auto;
margin-right:auto;
left:0;
right:0;
margin-top:250px;
position:absolute;
width:980px;
height:200px;
border: 4px #666 solid;
}
Check out this Working Fiddle
I changed the sizes a little bit (so it'll look nice in the Fiddle)
this is all about absolute positioning.
also if you're just going to use background for color, use background-color instead of background
and, notice the short way of using margin for all sides at once.
CSS:
#header
{
background-color: #859685;
height: 100px;
position: relative; /*the slider is now relative to the header*/
}
.slider
{
position:absolute;
width: 80%; /*80% of header*/
height: 50%; /* 50% of header*/
border: 4px #666 solid;
top: 70%;
left: 10%;
}
.content
{
margin: 10px auto;
height: 100px;
background-color: azure;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
.footer
{
margin: 10px 0;
height: 100px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
background-color: #111312;
}
try this:
DEMO
update slider class:
.slider {
margin-left: auto;
margin-right: auto;
bottom: -150px;
position: relative;
z-index: 1;
width: 980px;
height: 200px;
border: 4px #666 solid;
}
Related
I want the white circle above the inner circle. I can't see why the z-index doesn't work when the wrapper has a position relative and no z-index. I did something similar in a previous challenge on site css battle and it worked.
<div class="wrapper">
</div>
<style>
body{
display:grid;
place-content:center;
background-color:#191919;
}
.wrapper {
position:relative;
width: 100px;
height: 100px;
border-radius:50%;
background: #E08027;
overflow:hidden;
box-shadow: 0 0 0 30px #824B20;
}
.wrapper::before {
content:'';
width: 100px;
height: 50px;
position:absolute;
top:20;
left:-20px;
border-bottom-left-radius: 110px;
border-bottom-right-radius: 110px;
border: 20px solid #FFF58F;
border-top:0px;
z-index:5;
}
</style>
<div class="wrapper">
</div>
<style>
body{
display:grid;
place-content:center;
background-color:#191919;
}
.wrapper {
position:relative;
width: 100px;
height: 100px;
border-radius:50%;
background: #E08027;
box-shadow: 0 0 0 30px #824B20;
}
.wrapper::before {
content:'';
width: 100px;
height: 50px;
position:absolute;
top:20;
left:-20px;
border-bottom-left-radius: 110px;
border-bottom-right-radius: 110px;
border: 20px solid #FFF58F;
border-top:0px;
z-index:5;
}
</style>
I'm not sure if I understood your request but tell me if that helps when you remove the overflow: hidden; (try running the snippet above)
I have to code a shape(below image) in HTML
And below is the code what I tried so far:
body {
font: 13px Verdana;
}
h3 {
height: 100px;
background: #72bbab;
border-radius: 50px 10px 10px 50px;
display: flex;
margin-top: 50px;
position: relative;
line-height: 100px;
color: #ffffff;
font-size: 13px;
font-weight: normal;
}
h3 i {
width: 130px;
height: 130px;
transform: translateY(-15px);
background: #71bbab;
border-radius: 50%;
position: relative;
margin-right: 20px;
}
h3:before {
content: "";
position: absolute;
border: 1px dashed #fff;
top: 5px;
bottom: 5px;
left: 20px;
right: 2px;
border-radius: 10px;
}
h3 i:before {
content: "";
position: absolute;
top: 5px;
bottom: 5px;
left: 5px;
right: 5px;
border: 1px dashed #fff;
border-radius: 50%;
}
<h3><i></i>Text</h3>
Now the issue is I am not able to remove dashed border of circle from right side. I tried border-top:0 and border-right:0 but didn't work.
Thanks in advance
Note: Don't want to use any king of image
If you need to get the output by keeping same HTML mark-up then you have to use many pseudo selectors, CSS calc() function to calculate h2 tag width and many such properties to get output using CSS.
You have too even use position and z-index to hide circle border backside of h2 tag. And using margin you could arrange the remaining, so at one point whole diagram connects.
body {
font: 13px Verdana;
}
h3{
background:#72bbab;
width:calc(100% - 95px);
height:85px;
margin-left:95px;
margin-top:21px;
display:flex;
justify-content:flex-start;
align-items:center;
border-top-right-radius:10px;
border-bottom-right-radius:10px;
padding-left:20px;
box-sizing:border-box;
color:#fff;
}
h3 i{
width:120px;
height:120px;
background:#72bbab;
border-radius:50%;
display:inline-block;
top:2px;
left:2px;
position:absolute;
z-index:-1;
overflow:hidden;
}
h3 i:before{
content:"";
width:100px;
height:100px;
border:2px dashed #fff;
position:absolute;
top:8px;
left:8px;
border-radius:50%;
}
h3:before{
content:"";
width:calc(100% - 120px);
height:65px;
border:2px dashed #fff;
position:absolute;
right:15px;
border-top-right-radius:10px;
border-bottom-right-radius:10px;
}
h3:after{
content:"";
width:3px;
height:68px;
background:#72bbab;
position:absolute;
top:28px;
margin-left:-61px;
}
<h3><i></i>Text</h3>
See if this helps.
https://jsfiddle.net/induprakash/8ofLjqxm/
I added a higher z-index to rectangle border.
body {
font: 13px Verdana;
}
h3 {
height: 100px;
background: #72bbab;
border-radius: 50px 10px 10px 50px;
display: flex;
margin-top: 50px;
position: relative;
line-height: 100px;
color: #ffffff;
font-size: 13px;
font-weight: normal;
}
h3 i {
width: 130px;
height: 130px;
transform: translateY(-15px);
background: #71bbab;
border-radius: 50%;
position: relative;
margin-right: 20px;
}
h3:before {
content: "";
position: absolute;
border: 1px dashed #fff;
top: 5px;
bottom: 5px;
left: 105px;
z-index: 10;
right: 2px;
border-radius: 0px;
border-left: 0;
}
h3 i:before {
content: "";
position: absolute;
top: 5px;
bottom: 5px;
left: 5px;
right: 5px;
border: 1px dashed #fff;
border-radius: 50%;
border-right : 1px solid #72bbab;
}
Try this one, its running as per your image. I have tried a simple and different approach.
JSFiddle Link - https://jsfiddle.net/deepak104080/uwx873x1/
.circle {
width:130px;
height:130px;
border-radius:65px;
position:absolute;
z-index:100;
background:#71bbab;
margin:0px;
padding:0px;
}
.innercircle {
width:110px;
height:110px;
border-radius:55px;
position:absolute;
top:9px;
left:9px;
z-index:100;
background:#71bbab;
border: 1px dashed #fff;
}
.tab {
height: 100px;
position:absolute;
margin-top:15px;
margin-left:105px;
z-index:1000;
width:350px;
background:#71bbab;
border-top-right-radius:10px;
border-bottom-right-radius:10px;
}
.innertab {
height: 78px;
position:absolute;
margin-top:10px;
margin-left:0px;
z-index:1000;
width:340px;
background:#71bbab;
border-top-right-radius:10px;
border-bottom-right-radius:10px;
border-top: 1px dashed #fff;
border-bottom: 1px dashed #fff;
border-right: 1px dashed #fff;
}
<div>
<div class="circle">
<div class="innercircle">
</div>
</div>
<div class="tab">
<div class="innertab">
</div>
</div>
</div>
Use the ::after pseudo for h3 element.
h3:after {
z-index: 9999;
position:absolute;
max-width: 100%;
width: 100px;
height: 87px;
background: #71bbab;
content: '';
left: 35px;
margin-top: 6px;
}
https://jsfiddle.net/apyupfwo/
I want to create a line with tick marks and a ball (like a scale).
However the tutorials for this suggest using absolute positioning, or float. That works partially, but when I change the screen size, the divs shift out of place.
.line {
width: 100%;
min-height: 5px;
background-color: black;
padding: 20px;
margin-top: 20%;
}
.point {
-moz-border-radius: 50px/50px;
-webkit-border-radius: 50px 50px;
border-radius: 50px/50px;
border: solid 21px #f00;
width: 50px;
height: 50px;
background-color: red;
float: right;
overflow: visible;
position: relative;
z-index: 1000;
padding: 20px;
margin-top: -15%;
}
<div class="line"></div>
<div class="point"></div>
Wrap it in a div and do use absolute positioning for the inner divs, also, don't use margin-top percentages (https://jsfiddle.net/xv259d4p/1/):
.line {
width:100%;
min-height:5px;
background-color:black;
padding:20px;
margin-top:60px;
position: absolute;
}
.point {
-moz-border-radius: 50px/50px;
-webkit-border-radius: 50px 50px;
border-radius: 50px/50px;
border:solid 21px #f00;
width:50px;
height:50px;
background-color:red;
float: right;
overflow: visible;
position: absolute;
z-index: 1000;
padding:20px;
right: 0;
margin-top: 20px;
}
.outer {
display: block;
width: 100%;
top: 0px;
left: 0px;
position: relative;
}
<div class="outer">
<div class="line"> </div>
<div class="point"></div>
</div>
I have an html file(index.html) and a css file(style.css), there is the jsfiddle : http://jsfiddle.net/RZm5y/2/ .
index.html
<html>
<head>
<title>demo</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="nav">
<div class="logo">artistLog</div>
</div>
<div class="topbar">This is the top search/login bar</div>
<div class="content">
<div class="card">
<img class="cover" src="img/cover.png" />
</div>
<div class="card">Description</div>
</div>
</body>
</html>
style.css
html, body {
background: #343434;
margin:0px;
height: 100%;
overflow: hidden;
position: relative;
}
.nav {
background: #565656;
color: #b4b4b4;
margin-right:0px;
bottom: 0;
left: 0;
position: absolute;
top: 0;
border-right:7px solid #2b2b2b;
width: 86px;
}
.nav .logo {
background:#353535;
height:60px;
cursor:pointer;
border-bottom:1px solid #353535;
}
.topbar {
background: #1d1d1d;
border-bottom: 1px solid #8d8d8d;
height: 60px;
left: 86px;
position: absolute;
right: 0;
top: 0;
}
.content {
bottom: 0;
left: 120px;
overflow: auto;
position: absolute;
right: 0;
top: 62px;
padding: 50px 25px 25px 20px;
}
.content .card {
background: #101010;
color:#a4a4a4;
width:250px;
height:320px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
margin-right:10px;
margin-bottom: 15px;
}
.content .card .cover {
max-width:250px;
max-height:140px;
background: transparent;
float:left;
-webkit-border-top-left-radius: 6px;
-webkit-border-top-right-radius: 6px;
-moz-border-radius-topleft: 6px;
-moz-border-radius-topright: 6px;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
}
I want the cards inside the content to be showed one after another not one under another when the display is big enough to show minimum 2 cards one after another else show one under another.
You could achieve that simply by floating the cards to a side.
Example Here.
.content .card {
background: #101010;
color:#a4a4a4;
width:250px;
height:320px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
margin-right:10px;
margin-bottom: 15px;
float: left; /* <-- Added declaration */
}
Since you have added overflow: auto; to the .content element, the float is already cleared. However you might want to consider this topic:
What does the CSS rule clear: both do?
Demo jsFiddle
I have div color azure I want to fill the width area in the middle column no meter what size will be.
is there any solution with css3/css no jQuery ?
i need it like this picture:
the ststus current like this:
many Thx.
Demo jsFiddle
the code html:
<div id="frame">
<div id="inside_window">
<div id="Yellow"></div>
<div id="Green"></div>
<div id="Blue"></div>
<div id="Red"></div>
<div id="ver"></div>
<div id="hor"></div>
<div id="ver2"></div>
</div>
</div>
the code css:
html, body{
height:100%;
background-color: azure;
}
#frame
{
position: relative;
background-color: black;
height: 100%;
width: 100%;
margin: auto;
padding:0;
border: 1px solid black;
}
#Yellow
{
position: absolute;
height: 100%;
width: 150px;
-webkit-border-radius: 0px;
margin: 0 ;
background-color: Yellow;
z-index:10;
display:table;
left:0px;
top:0;
}
#Green
{
position: absolute;
height: 100%;
width: 150px;
-webkit-border-radius: 0px;
margin: 0 ;
background-color: green;
z-index:10;
right:0px;
top:0;
}
#Blue
{
position: relative;
height:100%;
min-width:65.8%;
-webkit-border-radius: 0px;
margin: 0 auto;
background-color: #62A9FF;
z-index:10;
display:table;
font-size:220%;
left:0px;
top:0px;
}
#Red
{
position: absolute;
height: 150px;
width: 100%;
-webkit-border-radius: 0px;
margin: 0 ;
background-color: red;
z-index:10;
border: 1px solid black;
left:0px;
bottom:0px;
}
#inside_window
{
width:100%;
height:100%;
margin:0 auto;
position: relative;
border: 1px solid black;
background-color: brown;
-webkit-transform: rotate(0deg);
-webkit-transform-origin:50% 50%;
}
#ver
{
position: absolute;
height: 100%;
width: 5px;
margin: 0;
background-color: white;
left:150px;
top:0px;
z-index:1;
}
#hor
{
position: absolute;
height: 5px;
width: 100%;
margin: 0;
background-color: white;
left:0px;
bottom:150px;
z-index:20;
}
#ver2
{
position: absolute;
height: 100%;
width: 5px;
margin: 0;
background-color: white;
right:150px;
top:0px;
z-index:1;
}
Try removing the following CSS from your blue code:
position: relative;
display:table;
There are many ways to acheive a layout like this. Supposing that you could alter the order of your content, you could always try the "Holy Grail" layout method.