I need help to create the following view. I can definitely use position absolute but is there a way to do it without using the absolute value?
.balls {
display: flex;
}
.balls>.left {
height: 2.3rem;
width: 2.4rem;
border-radius: 50%;
margin-right: -0.9rem;
border: 4px solid white;
background-color: red;
}
.center_ball {
z-index: 99999;
}
.left_ball2 {
z-index: 9999;
}
.right_ball2 {
z-index: 99;
}
<div class="balls">
<div class="left"></div>
<div class="left left_ball2"></div>
<div class="left center_ball"></div>
<div class="left right_ball2"></div>
<div class="left"></div>
</div>
I think something like this? Adding a display: flex to make them stay on the same row, and a negative margin to make them override each other.
.balls {
display: flex;
}
.balls > .left {
height: 2.3rem;
width: 2.4rem;
border-radius: 50%;
margin-right: -0.9rem;
border: 4px solid white;
background-color: red;
}
<div class="balls">
<div class="left"></div>
<div class="left"></div>
<div class="left"></div>
<div class="left"></div>
<div class="left"></div>
</div>
Here you have a snippet with live example
.first {
z-index: 1;
border: 2px solid blue;
position: relative;
}
.second {
z-index: 2;
left: -60px;
position: relative;
top: 10px;
border: 2px solid red;
}
.third {
z-index: 1;
left: -100px;
position: relative;
border: 2px solid green;
}
<div>
<img src="https://fr.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-fr.svg" class="first">
<img src="https://fr.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-fr.svg" class="second">
<img src="https://fr.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-fr.svg" class="third">
</div>
Related
I have two sticky boxes. On hovering over a particular area inside the sticky boxes a popup opens. I want these popups to appear always on top of the sticky boxes. But increasing the z index of one hides the other. Any solution ?
Note - Removing sticky from the boxes and keeping z index of both the box same solves the problem but I need the boxes to be sticky.
.box {
margin: 40px;
padding: 20px;
background: yellow;
border: 1px solid red;
position: sticky;
}
.innerBox {
width: 100px;
height: 50px;
background: lightgreen;
position: relative;
}
.popup1 {
position: absolute;
width: 50px;
height: 150px;
top: 25px;
left: 35px;
background: red;
display: none;
}
.popup2 {
position: absolute;
width: 50px;
height: 150px;
bottom: 25px;
left: 35px;
background: black;
display: none;
}
.box1:hover .popup1 {
display: block;
}
.box2:hover .popup2 {
display: block;
}
.boxUp {
z-index: 3;
}
.boxDown {
z-index: 3;
}
<div>
<div class="box boxUp">
<div class="innerBox box1">
<p>
Hover Here
</p>
<div class="popup1">
</div>
</div>
</div>
<div class="box boxDown">
<div class="innerBox box2">
<p>
Hover Here
</p>
<div class="popup2">
</div>
</div>
</div>
</div>
Set the z-index on hover the .box
.box {
margin: 40px;
padding: 20px;
background: yellow;
border: 1px solid red;
position: sticky;
}
.innerBox {
width: 100px;
height: 50px;
background: lightgreen;
position: relative;
}
.popup1 {
position: absolute;
width: 50px;
height: 150px;
top: 25px;
left: 35px;
background: red;
display: none;
}
.popup2 {
position: absolute;
width: 50px;
height: 150px;
bottom: 25px;
left: 35px;
background: black;
display: none;
}
.box1:hover .popup1 {
display: block;
}
.box2:hover .popup2 {
display: block;
}
.box:hover {
z-index: 2;
}
<div>
<div class="box boxUp">
<div class="innerBox box1">
<p>
Hover Here
</p>
<div class="popup1">
</div>
</div>
</div>
<div class="box boxDown">
<div class="innerBox box2">
<p>
Hover Here
</p>
<div class="popup2">
</div>
</div>
</div>
</div>
Above is screenshot of my personal project. I'm trying to make web-math-test page and want to columns in it.
Right now, the page use 'https://github.com/cognitom/paper-css'.
Following is the code..
<section class="sheet padding-15mm">
<div class="head background-1">
<div class="column-2">
<div name="name">name</div>
<div name="date">date</div>
</div>
<div class="column-6">
<div name="testname">ITSM Report & Feedback</div>
</div>
<div class="column-2">
<div name="logo">logo</div>
<div name="organization">org</div>
</div>
</div>
<div class="body">
<div class="problem problem-3">1</div>
<div class="problem problem-3">2</div>
<div class="problem problem-3">3</div>
<div class="problem problem-3">4</div>
<div class="problem problem-3">5</div>
</div>
</section>
and related css fragments..
div.head { height: 5em; border: 3px solid black; border-radius: 8px; padding: .5em; position: relative; }
div.head.background-1::after { content:''; top:0; left:0; bottom:0; right:0; position: absolute; z-index: 1; background-image: url({{asset('background-1.png')}}); opacity: 0.15;}
div.head > div { float: left; }
div.column-2 { width: 20%; }
div.column-6 { width: 60%; }
div[name="name"] { background-color: white; }
div[name="testname"] { font-size: 1.5em; margin-top: .75em; text-shadow: 5px 5px 3px rgba(0,0,0,0.5); }
div.body { position: relative; -moz-column-count: 2; -webkit-column-count: 2; column-count: 2; column-rule-style: groove; column-gap: 3em; }
div.head + div.body { height: calc(100% - 7em - 3px); margin-top: 1em; }
div.problem { position: static; width: 100%; }
div.head + div.body div.problem-3 { height: 30%; }
div.problem-2 { height: 50%; }
div.problem-3 { height: 33%; }
div.problem-4 { height: 25%; }
At the moment, I cannot find any reason why div.problem.problem-3 is going out from parent div.
I have a nested Table in which I have to show a Tooltip for the texts. I have extracted the problem in an jsfiddle, the problem is that I can not position the blue Element on top of the Block 2.1 Content even if i set z-index very big.
Here again the html and css code to that:
.block {
display: block;
}
.content {
border: 1px solid #ccc;
padding: 2px 5px;
box-shadow: 5px 5px 10px black;
height: 30px;
width: 90%;
line-height: 30px
}
.block1_content {
z-index: 3;
position: relative;
background: white;
}
.block2_content {
z-index: 2;
margin-left: 10px;
position: relative;
background: #ccc;
}
.tooltip {
position: absolute;
display: block;
background: blue;
color: white;
height: 40px;
width: 100px;
z-index: 99999;
padding: 5px 10px;
top: 15px
}
<div class="block1 block">
<div class="block1_content content">Block 1 Content</div>
<div class="block2 block">
<div class="block2_content content">
Block2 Content
<div class="tooltip">Tooltip</div>
</div>
</div>
</div>
<div class="block1 block">
<div class="block1_content content">Block 2.1 Content</div>
<div class="block2 block">
<div class="block2_content content"> Block 2.2 Content</div>
</div>
</div>
EDIT
Here a little bit complicated version of the code/problem as requested.
hope this helps you. thanks
.block {
display: block;
}
.relative{
position: relative
}
.content {
border: 1px solid #ccc;
padding: 2px 5px;
box-shadow: 5px 5px 10px black;
height: 30px;
width: 90%;
line-height: 30px
}
.block1_content {
z-index: 3;
position: relative;
background: white;
}
.block2_content {
z-index: 2;
margin-left: 10px;
position: relative;
background: #ccc;
}
.tooltip {
position: absolute;
display: block;
background: blue;
color: white;
height: 40px;
width: 100px;
z-index: 99999;
padding: 5px 10px;
top: 15px
}
<div class="block1 block">
<div class="block1_content content">Block 1 Content</div>
<div class="block2 block">
<div class="block2_content content">
Block2 Content
</div>
</div>
</div>
<div class="block1 block relative">
<div class="tooltip">Tooltip</div>
<div class="block1_content content">Block 2.1 Content</div>
<div class="block2 block">
<div class="block2_content content"> Block 2.2 Content</div>
</div>
</div>
I have a big problem with 4 columns layout inside my view.
I must build this layout:
Anybody know how I can make this layout? I use -clip method but first div always is another from last div. Two centered div is OK but first and last not.
Please, help me if you know how I can do this...
Here is an example using trapezoid borders in combination with positioning:
body {
margin: 0;
}
.section {
position: relative;
display: inline-block;
width: 25%;
margin-right: -4px;
}
.background {
position: absolute;
top: 0;
width: 100%;
height: 0;
border-right: 30px solid transparent;
border-bottom: 300px solid #346;
}
.content {
position: absolute;
top: 0;
color: #fff;
padding: 10px 10px 10px 30px;
z-index: 100;
}
.s1 .background {
border-bottom-color: yellow;
z-index: 5;
}
.s2 .background {
border-bottom-color: blue;
z-index: 4;
}
.s3 .background {
border-bottom-color: navy;
z-index: 3;
}
.s4 .background {
background-color: black;
border: none;
height: 300px;
}
<div class="section s1">
<div class="background"></div>
<div class="content">Lorem Ipsum</div>
</div>
<div class="section s2">
<div class="background"></div>
<div class="content">Lorem Ipsum</div>
</div>
<div class="section s3">
<div class="background"></div>
<div class="content">Lorem Ipsum</div>
</div>
<div class="section s4 last">
<div class="background"></div>
<div class="content">Lorem Ipsum</div>
</div>
Limits: You have to define a fixed height (300px in the example above)
I would like to implement timeline part on my website.
I have picture how it should look but I can't think any good way to do it.
How it should look:
Actual code:
js fiddle
<div class="right ">
what should I put here to get that circle?
</div>
Most confusing part is how to get that circle and that line together?
Could anyone suggest anything?
Thank you.
You could use :after, changing the styles to your liking.
.border needs to be positioned non-statically.
.wrapper {
width: 1030px;
background-color: #534741;
height: 500px;
}
.right {
color: #fff;
width: 90%;
text-align: right;
padding: 10px 10px 0 0;
display: block;
}
.border {
border-bottom: 2px solid #000;
width: 50%;
float: right;
margin: 10px 140px 0 10px;
position: relative;
}
.border:after {
/* Position and border */
display: block;
content: '';
border: 2px solid #000;
position: absolute;
width: 32px;
right: -34px; /*** -(Width+Border) ***/
height: 32px;
bottom: -18px; /*** -((Height/2)+Border) ***/
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
}
.text {
float: right;
width: 300px;
margin-right: 90px;
}
<div class="wrapper">
<div class="right">
<h2>Text</h2>
</div>
<div class="right">
<h3>2014</h3>
</div>
<div class="right "></div>
<div class="right border"></div>
<div class="right text">
<p>Lorem ipsum doloremLorem ipsum doloremLorem ipsum doloremLorem ipsum doloremLorem ipsum dolorem</p>
</div>
</div>
JSFiddle
Try to make it with positioning and borer radius. Or simply use images.
.content-wrapper {
position: relative;
width: 400px;
margin-bottom: 30px;
}
.line .circle {
width: 50px;
height: 50px;
border-radius: 25px;
border: 1px solid black;
position: absolute;
top: -25px;
}
.line {
position: relative;
border-bottom: 1px solid black;
}
.odd .line {
margin-right: 50px;
}
.even .line {
margin-left: 50px;
}
.odd .circle {
right: -50px;
}
.even .circle {
left: -50px;
}
.content,
.header {
padding: 0 60px;
}
.odd .content,
.odd .header {
text-align: right;
}
.even .content,
.even .header {
text-align: left;
}
<div class="content-wrapper odd">
<div class="header">Some title</div>
<div class="line">
<div class="circle"></div>
</div>
<div class="content">Loerm ipsum dolerom</div>
</div>
<div class="content-wrapper even">
<div class="header">Some title</div>
<div class="line">
<div class="circle"></div>
</div>
<div class="content">Loerm ipsum dolerom</div>
</div>
Below code should work:
.box-with-circle {
width: 90%;
position: relative;
}
.box-with-circle .circle {
width: 40px;
height: 40px;
position: absolute;
top: 0;
left: 0;
margin -20px 0 0 -20px;
border: 1px solid #000;
background-color: #fff;
z-index: 1;
border-radius: 50%;
}
.box-with-circle hr {
position: relative;
top: 20px;
}
<div class="box-with-circle">
<div class="circle"></div>
<hr />
</div>