I am trying to make a vertical splitter in background of a home-made slider (like here http://theymakeapps.com/users/add). How to do that ?
Here is what I've done so far:
<div id="wrapper">
<div id="dragger">
<div class="rect"></div>
<div class="arrow-down"></div>
</div>
<div id="slide-container"></div>
</div>
<br />
<span class="drag-caption active" id="hi-caption">Hi, bot</span> <span class="drag-caption" id="keep-caption">Keep sliding...</span> <span class="drag-caption" id="submit-caption">Submit</span>
And my css
* {
font-family: calibri
}
#dragger {
width: 10px;
padding: 5px 10px 5px 5px;
}
.rect {
background-color: #ccc;
height: 15px;
width: 10px;
}
.arrow-down {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid #ccc;
}
#wrapper {
z-index: 55;
width: 200px;
padding: 0 10px;
}
#slide-container {
background: #dedede;
height:2px;
border-radius: 1px;
margin-top:-18px;
}
.drag-caption {
padding-right: 20px;
color: #d4d4d4;
-webkit-transition: color 500ms ease;
-moz-transition: color 500ms ease;
-ms-transition: color 500ms ease;
-o-transition: color 500ms ease;
transition: color 500ms ease;
}
.drag-caption.active {
color: black;
}
#submit-caption{
font-weight: bold;
}
And here is the jsfiddle. I'd like my separtors to be aligned over the caption and ON the background bar.
Like this:
---|---------|------------|
| | |
Hi bot Keep sliding Submit
I've added a div and two span elements and positioned the separators on the range using CSS Positioning.
Demo
Demo 2 (If you don't need the last one)
Demo 3 (As per your exact requirements)
Here, am using CSS Positioning to position each of the separator on the range bar, you can tweak up the lefts and rights according to your requirement.
<div id="slide-container"></div>
<div class="separators"><span></span><span></span></div> <!-- Add this after #slide-container -->
.separators {
position: relative;
}
.separators > span:before,
.separators > span:after{
content: "|";
position: absolute;
z-index: -1;
color: #DEDEDE;
}
.separators > span:nth-of-type(1):before {
left: 50px;
top: -12px;
}
.separators > span:nth-of-type(1):after {
left: 100px;
top: -12px;
}
.separators > span:nth-of-type(2):before {
left: 150px;
top: -12px;
}
.separators > span:nth-of-type(2):after {
left: 200px;
top: -12px;
}
Related
I have implemented a :hover animation for a link that takes you to another part of the website. When hovered in Firefox or Google Chrome, the width of the border of the :before and :after pseudo-elements are 2px like specified but when checking Safari, I found the width to be thicker than what is expected.
The HTML, CSS and screenshots of the occurrence are below.
Firefox and Chrome:
Safari:
Code:
a {
text-decoration: none;
color: inherit;
}
#title {
color: black;
margin: 0 auto;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#gallery-link {
padding: 15px 0;
text-align: center;
}
#gallery-link-padding {
padding: 15px 60px;
}
.frame-effect-click {
position: relative;
font-weight: 500;
font-size: 16px;
cursor: pointer;
border-radius: 10px;
transition: 0.4s;
}
.frame-effect-click:after, .frame-effect-click:before {
content: '';
position: absolute;
width: 0;
height: 0;
transition: all 0.4s linear, opacity 0.1s 0.4s;
opacity: 0;
}
.frame-effect-click:after {
bottom: 0;
right: 0;
border-bottom: 2px solid black;
border-right: 2px solid black;
}
.frame-effect-click:before {
top: 0;
left: 0;
border-top: 2px solid black;
border-left: 2px solid black;
}
.frame-effect-click:hover:after, .frame-effect-click:hover:before {
width: calc(100% + 10px);
height: calc(100% + 10px);
transition: 0.4s, opacity 0.1s;
opacity: 1;
}
<div id="title">
<div id="gallery-link">
<a id="gallery-link-padding" class="frame-effect-click" href="#">View gallery</a>
</div>
</div>
Does anyone know why that is and how to fix this issue?
I am trying to create an effect when div class="container" is being hovered, a smooth upper transition occurs of another div from bottom. Only during hover, this should happen cause I want that .bottom div to be hidden. When that div is not hidden, I can see the effect as I want. But as I hide the bottom div, that hovering effect smooth transition effect cannot be seen. Check this code once.
HTML CODE
<div class="box">
Hello
<div class="bottom">
Everyone
</div>
</div>
CSS code
.box{
border: 1px solid black;
display: inline-block;
border-radius: 3px;
padding: 8px;
font-size: 20px;
}
.bottom {
background: pink;
width: 80px;
text-align: center;
position: absolute;
top:80px;
left:0;
/* display: none; */
}
.box:hover .bottom {
display: block;
transition: linear 0.2s;
top:55px;
}
Here is the codepen link
https://codepen.io/Biebk/pen/MWpREqb
First off, rather than display: none to hide the incoming element altogether, you can set its opacity to 0, and then when the parent is hovered, set it to 1, like so:
.bottom {
opacity: 0;
}
.box:hover .bottom {
opacity: 1;
}
I suppose that given you want an incoming "pull-up" effect on hover, you want to that element to also "pull-down" when the hover ends. You can reverse the same effect by using a :not(:hover) on the parent element:
.box:not(:hover) .bottom {
opacity: 0;
}
Also, be sure to set the transition on the non-hovered state. The following example provides the smooth transition you're looking for:
.box {
border: 1px solid black;
display: inline-block;
border-radius: 3px;
padding: 8px;
font-size: 20px;
}
.bottom {
background: pink;
width: 80px;
text-align: center;
position: absolute;
left: 0;
transition: all .25s ease;
}
.box:not(:hover) .bottom {
top: 80px;
opacity: 0;
}
.box:hover .bottom {
top: 55px;
opacity: 1;
}
<div class="box">
Hello
<div class="bottom">
Everyone
</div>
</div>
A secondary approach would be to place the bottom div as a sibling to the box, and use the adjacent sibling combinator to apply the hover effects:
.box {
border: 1px solid black;
display: inline-block;
border-radius: 3px;
padding: 8px;
font-size: 20px;
}
.bottom {
font-size: 20px;
background: pink;
width: 80px;
text-align: center;
position: absolute;
left: 0;
top: 80px;
opacity: 0;
cursor: default;
transition: all .25s ease;
}
.box:hover + .bottom {
top: 55px;
opacity: 1;
}
<div class="box">
Hello
</div>
<div class="bottom">
Everyone
</div>
Use opacity property rather than display to achieve the desired effect, then
use the following code
.box {
border: 1px solid black;
display: inline-block;
border-radius: 3px;
padding: 8px;
font-size: 20px;
}
.bottom {
background: pink;
width: 80px;
text-align: center;
position: absolute;
top: 80px;
left: 0;
opacity: 0;
}
.box:hover .bottom{
opacity: 1;
transition: opacity 0.2s , top 1s;
top: 55px;
}
Use the following code.
.box {
border: 1px solid black;
display: inline-block;
border-radius: 3px;
padding: 8px;
font-size: 20px;
}
.hovered{
transition: all .2s;
}
.bottom {
background: pink;
width: 80px;
text-align: center;
position: absolute;
top: 80px;
left: 0;
visibility: hidden;
}
.hovered:hover+.bottom {
transition: all .2s;
top: 55px;
visibility: visible;
}
<div class="box">
<div class="hovered">Hello</div>
<div class="bottom">
Everyone
</div>
</div>
I have a progress bar that uses arrows but the only way I know how to make it is using pixels. So I am wondering if there is a way to create this progress bar using pixels, and then change its size according to the page. I have looked at similar questions, but none pertain to the type of element I am creating. Attached is what the bar currently looks like, and I want to be able to make it adaptable to the screen size.
.containerr {
font-family: 'Lato', sans-serif;
float: left;
position: relative;
width: 70%;
height: 100%;
}
.wrapperr {
float: left;
width: 70%;
height: 100%;
position: relative;
/*overflow:auto;*/
}
.pull-right {
}
a:hover {
color: #999;
}
/* Breadcrups CSS */
.arrow-steps {
zoom: 1.4;
position: relative;
display: inline-flex;
vertical-align: top;
}
.arrow-steps .step {
font-size: 100%;
text-align: center;
color: #666;
cursor: default;
margin: 0 3px;
padding: 10px 10px 10px 30px;
min-width: 180px;
float: left;
position: relative;
background-color: #d9e3f7;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
transition: background-color 0.2s ease;
}
.arrow-steps .step:after, .arrow-steps .step:before {
content: " ";
position: absolute;
top: 0;
right: -17px;
width: 0;
height: 0;
border-top: 20px solid transparent;
border-bottom: 19px solid transparent;
border-left: 17px solid #d9e3f7;
z-index: 2;
transition: border-color 0.2s ease;
}
.arrow-steps .step:before {
right: auto;
left: 0;
border-left: 17px solid #333;
z-index: 0;
}
.arrow-steps .step:first-child:before {
border: none;
}
.arrow-steps .step:first-child {
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.arrow-steps .step span {
position: relative;
}
.arrow-steps .step span:before {
opacity: 0;
content: "✔";
position: absolute;
top: -2px;
left: -20px;
}
.arrow-steps .step.done span:before {
opacity: 1;
-webkit-transition: opacity 0.3s ease 0.5s;
-moz-transition: opacity 0.3s ease 0.5s;
-ms-transition: opacity 0.3s ease 0.5s;
transition: opacity 0.3s ease 0.5s;
}
.arrow-steps .step.current {
color: #fff;
background-color: #23468c;[![enter image description here][1]][1]
}
html
<div class="containerr">
<div class="wrapperr">
<div class="arrow-steps clearfix">
<div runat="server" id="first" class="step">
<asp:LinkButton ID="machineLink" CssClass="arrowTexts" runat="server" OnClick="machineLink_Click" OnClientClick="getCoordinates()">Safety</asp:LinkButton>
</div>
<div runat="server" id="second" class="step">
<asp:LinkButton ID="estopLink" CssClass="arrowTexts" runat="server" OnClick="estop_Click" OnClientClick="getCoordinates()">Estop Reset
</asp:LinkButton>
</div>
<div runat="server" id="third" class="step">
<asp:LinkButton ID="startLink" CssClass="arrowTexts" runat="server" OnClick="start_Click" OnClientClick="getCoordinates()">Start</asp:LinkButton>
</div>
</div>
</div>
</div>
You can utilize vh vw vmin and vmax to make your progress-bar responsive.
See this codepen
So, I have a div that appears at the top of my screen, and when you hover over it, at the bottom of the screen, text appears.
I want to add another effect to the div that makes more text appear in a completely different place on the screen, while the other text stays in the same place.
Is that possible? Preferably using CSS/HTML instead of Java or anything?
You can use ~ (tilde) operator to target all your siblings (all should have the same parent) show on hover. Please have a look at the example snippet below:
body { margin: 0; }
.holder {
text-align: center;
height: 100vh;
}
.hover {
position: absolute;
top: 10%;
left: 50%;
transform: translateX(-50%);
color: red;
font-size: 30px;
font-weight: bold;
border: 2px solid red;
padding: 10px 15px;
cursor: default;
transition: all .2s linear;
}
.hover:hover {
background: rgba(255, 0, 0, 0.1);
}
.hover:hover ~ .show-text {
opacity: 1;
transition: all .2s linear;
}
.show-text {
position: absolute;
opacity: 0;
font-size: 20px;
border-bottom: 1px solid #aaa;
transition: all .2s linear;
}
.one {
bottom: 20%;
left: 20%;
}
.two {
bottom: 20%;
right: 20%;
}
<div class="holder">
<div class="hover">Hover Me!</div>
<div class="show-text one">I'm Text 1</div>
<div class="show-text two">I'm Text 2</div>
</div>
Hope this helps!
Just hover on 'a headline' in the snippet below and you will see how elements are moving. Why?
There's no margin .. And they're only moving when I add border to the inline-block element. Try to add more border width in section.twelve a like:
section.twelve a {
border-bottom: 10px solid #FFFAFF;
}
But if you remove the border everything's fine.. Why is this behavior ? and is it only for border?
I just want to add any styles to the element without effecting the others.
section{
position: relative;
height: 300px;
padding: 15px 80px;
z-index: 1;
}
section h1{
font-size:3em;
font-weight: 100;
line-height: 1.3;
}
section a {
position: relative;
display: inline-block;
text-decoration: none;
transition: all 0.3s ease-in-out;
vertical-align: bottom;
}
section.twelve {
background: #121A5A;
color: #FFFAFF;
}
section.twelve a {
color:#D8315B;
font-weight: 700;
overflow: hidden;
padding: 0px 5px;
transition all 0.2s ease;
border-bottom: 5px solid #FFFAFF;
}
.twelve a:before{
content: "";
top:0; left: 0;
position: absolute;
width:100%; height: 100%;
background: #FFFAFF;
z-index: -1;
transition: all 0.2s ease;
transform: translateX(100%);
}
.twelve a:hover::before {
transform: translateX(-95%);
background: #D8315B;
}
.twelve a:hover{
color: #FFFAFF;
transform: translateX(5px);
border-bottom: 1px solid #FFFAFF;
}
<section class="twelve">
<h1>Write a headline that makes people do kind of a double take whenthey read it.</h1>
</section>
When you add, or change the width, of a border, that changes the size of the element. Hence, by adding the border on hover, the box grows to occupy more space, which naturally shifts the position of surrounding text / elements.
One method to resolve this issue is to always have the border present, so the size of the box is fixed. When the border shouldn't be visible, it's transparent.
Here's an example:
section {
position: relative;
height: 300px;
padding: 15px 80px;
z-index: 1;
}
section h1 {
font-size: 3em;
font-weight: 100;
line-height: 1.3;
}
section a {
position: relative;
display: inline-block;
text-decoration: none;
transition: all 0.3s ease-in-out;
vertical-align: bottom;
}
section.twelve {
background: #121A5A;
color: #FFFAFF;
}
section.twelve a {
color: #D8315B;
font-weight: 700;
overflow: hidden;
padding: 0px 5px;
transition all 0.2s ease;
border-bottom: 5px solid transparent; /* ADJUSTMENT */
}
.twelve a:before {
content: "";
top: 0;
left: 0;
position: absolute;
width: 100%;
height: 100%;
background: #FFFAFF;
z-index: -1;
transition: all 0.2s ease;
transform: translateX(100%);
}
.twelve a:hover::before {
transform: translateX(-95%);
background: #D8315B;
}
.twelve a:hover {
color: #FFFAFF;
transform: translateX(5px);
border-bottom: 5px solid white; /* ADJUSED */
}
<section class="twelve">
<h1>Write a headline that makes people do kind of a double take whenthey read it.</h1>
</section>
Yes, on hover you are changing element's border, so, element's total height also changes