Expandable Search Form, to the left - html

Check this link (Demo 2)
https://codepen.io/912lab/pen/LsplC
html,
body {
font-family: 'Arial', sans-serif;
font-size: 16px;
}
/* border-box */
.search-container *,
.search-container *:after,
.search-container *:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
/* search bar focus */
.search-container *:focus {
background: #fbfbfb;
color: #333333;
outline: 0;
}
/* search bar container */
.search-container {
display: table;
position: relative;
width: 51px;
}
/* search icon button */
.search-icon-btn {
background-color: aquamarine;
border: 1px solid aquamarine;
display: table-cell;
height: 50px;
position: relative;
text-align: center;
vertical-align: middle;
width: 50px;
z-index: 2;
}
/* search bar input container */
.search-input {
position: absolute;
left: 0;
z-index: 1;
}
/* search bar input */
.search-input input.search-bar {
border: 1px solid #cccccc;
height: 50px;
padding: 0px;
width: 50px;
}
.search-input input.search-bar:focus {
padding-left: 60px;
padding-right: 10px;
width: 200px;
}
/* transition effect */
.search-input input.search-bar,
.search-icon-btn {
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-ms-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
}
/* hover on search bar container */
.search-container:hover > .search-input input.search-bar {
padding-left: 60px;
padding-right: 10px;
width: 200px;
}
<h1>Expandable Search Form</h1>
<p>Pen by Prinzadi</p>
<h3>Demo 1</h3>
<form>
<input type="search" placeholder="Search">
</form>
<h3>Demo 2</h3>
<form id="demo-2">
<input type="search" placeholder="Search">
</form>
Is it possible to expand the search on demo 2 to the left, instead of the right though? I changed the padding and width, but it still expands to the left, instead of the right.
Again, I've tried it several different way but I guess I am missing something silly. I appreciate the help.
Thanks,

When you use the CSS property float: right, it expands from right to left.
Here is the code:
body {
background: #fff;
color: #666;
font: 90%/180% Arial, Helvetica, sans-serif;
width: 800px;
max-width: 96%;
margin: 0 auto;
}
a {
color: #69C;
text-decoration: none;
}
a:hover {
color: #F60;
}
h1 {
font: 1.7em;
line-height: 110%;
color: #000;
}
p {
margin: 0 0 20px;
}
input {
outline: none;
}
input[type=search] {
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
font-family: inherit;
font-size: 100%;
}
input::-webkit-search-decoration,
input::-webkit-search-cancel-button {
display: none;
}
input[type=search] {
background: #ededed url(https://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 9px center;
border: solid 1px #ccc;
padding: 9px 10px 9px 32px;
width: 55px;
-webkit-border-radius: 10em;
-moz-border-radius: 10em;
border-radius: 10em;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
float: right;
margin-right: 701px;
}
input[type=search]:focus {
width: 120px;
background-color: #fff;
border-color: #66CC75;
float: right;
-webkit-box-shadow: 0 0 5px rgba(109,207,246,.5);
-moz-box-shadow: 0 0 5px rgba(109,207,246,.5);
box-shadow: 0 0 5px rgba(109,207,246,.5);
}
input:-moz-placeholder {
color: #999;
}
input::-webkit-input-placeholder {
color: #999;
}
/* Demo 2 */
#demo-2 input[type=search] {
width: 15px;
padding-left: 10px;
color: transparent;
cursor: pointer;
}
#demo-2 input[type=search]:hover {
background-color: #fff;
}
#demo-2 input[type=search]:focus {
width: 130px;
padding-left: 32px;
color: #000;
background-color: #fff;
cursor: auto;
}
#demo-2 input:-moz-placeholder {
color: transparent;
}
#demo-2 input::-webkit-input-placeholder {
color: transparent;
}
<h1>Expandable Search Form</h1>
<p>Pen by Prinzadi</p>
<h3>Demo 1</h3>
<div class="container">
<form>
<input type="search" placeholder="Search">
</form>
</div>
For some reason the input doesn't work in the Stack Snippet, so just copy it over in CodePen or whatever other platform you have chosen.
This isn't positioned how you want, so I set a margin-right property in CSS to change it back to what it was.
I also didn't fix it for the second demo because I want you to figure out how to make this change yourself by looking at the changes I made, then implementing them yourself. This way you will understand how to replicate this solution in the future and increase your knowledge of HTML/CSS in general.
Links: float documentation, tutorial on floats
Related tags: html, css, input, css-float, animation, layout

Related

Style does not change anything else than the color CSS

I'm first making the static html design and css for my Todo list app and then passing them into react components.
I can't figure why does the span in the li doesn't move to the right, but after trying deleting things and figuring out what works and what doesn't work i found that the li css doesn't change anything more than the color, so if for example i tried changing the line height or height nothing changed and thaught that the whole style wasn't working, but the color does work but everything else doesn't. Is there some style that's blocking the ability to change sizes and placement of things?
Here is the app.js:
import React, { useState } from "react";
import "./App.css";
import axios from "axios";
import { FontAwesomeIcon } from "#fortawesome/react-fontawesome";
import { faTrash, faPlus } from "#fortawesome/free-solid-svg-icons";
function App() {
return (
<>
<div className="backgound">
<div className="wrapper">
<header>Todo app MERN</header>
<div className="inputField">
<input type="text" placeholder="Add your new task"></input>
<button>
<FontAwesomeIcon icon={faPlus} />
</button>
</div>
<ul className="todoList">
<li>
Do something
<span>
<FontAwesomeIcon icon={faTrash} />
</span>
</li>
<li>
Buy something
<span>
<FontAwesomeIcon icon={faTrash} />
</span>
</li>
<li>
Learn something
<span>
<FontAwesomeIcon icon={faTrash} />
</span>
</li>
</ul>
<div class="footer">
<span> You have 3 pending tasks</span>
<button>Clear</button>
</div>
</div>
</div>
</>
);
}
export default App;
And here is the css, the two styles that are causing me problems are .todoList li and .todoList li span:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
::selection {
color: #ffff;
background: rgb(142, 73, 232);
}
body {
width: 100%;
height: 100vh;
padding: 10px;
background: linear-gradient(to bottom, #68EACC 0%, #497BE8 100%);
}
.wrapper {
background: #fff;
max-width: 400px;
width: 100%;
margin: 120px auto;
padding: 25px;
border-radius: 5px;
box-shadow: 0px 10px 15px rgba(0, 0, 0, 0.1);
}
.wrapper header {
font-size: 30px;
font-weight: 600;
}
.wrapper .inputField {
margin: 20px 0;
width: 100%;
display: flex;
height: 45px;
}
.inputField input {
width: 85%;
height: 100%;
outline: none;
border-radius: 3px;
border: 1px solid #ccc;
font-size: 17px;
padding-left: 15px;
transition: all 0.3s ease;
}
.inputField input:focus {
border-color: #8E49E8;
}
.inputField button {
width: 50px;
height: 100%;
border: none;
color: #fff;
margin-left: 5px;
font-size: 21px;
outline: none;
background: #8E49E8;
cursor: pointer;
border-radius: 3px;
opacity: 0.6;
pointer-events: none;
transition: all 0.3s ease;
}
.inputField button:hover,
.footer button:hover {
background: #721ce3;
}
.inputField button.active {
opacity: 1;
pointer-events: auto;
}
.wrapper .todoList {
max-height: 250px;
overflow-y: auto;
}
.todoList li {
list-style: none;
height: 45 px;
line-height: 45 px;
position: relative;
background: #f2f2f2;
border-radius: 3px;
margin-bottom: 8 px;
padding: 0 15 px;
}
.todoList li span {
position: absolute;
right: 0 px;
color: #e74c3c;
}
.wrapper .footer {
display: flex;
width: 100%;
margin-top: 20px;
align-items: center;
justify-content: space-between;
}
.footer button {
padding: 6px 10px;
border-radius: 3px;
border: none;
outline: none;
color: #fff;
font-weight: 400;
font-size: 16px;
margin-left: 5px;
background: #8E49E8;
cursor: pointer;
user-select: none;
opacity: 0.6;
pointer-events: none;
transition: all 0.3s ease;
}
.footer button.active {
opacity: 1;
pointer-events: auto;
}
You should not add spaces before "px" in your CSS code. height: 45 px; should be height: 45px;
You can always inspect elements in web browser and see which stylesheets are applied and in what priority.

Making range slider vertical

I am trying to customize a range slider according to my need i am almost there except for the orientation of it, currently it's aligned horizontally which should be vertical.
I have tried adding
data-orientation = "vertical"
and Orient="vertical" as well as
.input-range{
writing-mode: bt-lr; /* IE */
-webkit-appearance: slider-vertical;
}
got no luck.
current code base is as follows : Style
.input-range{
writing-mode: bt-lr; /* IE */
-webkit-appearance: slider-vertical;}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.PrixMin {
float: left;
color: #164188;
font-size: 19px;
margin-right: 5px;
}
.selecteurPrix {
padding-top: 15px;
display:block;
position:absolute;
top:90px;
left:0;
z-index: 1200
}
body {
font-family: sans-serif;
padding: 40px;
}
.range-slider {
position: relative;
width: 450px;
float: left;
margin-right: 5px;
}
#media (-webkit-min-device-pixel-ratio:0) {
/* Non-IE styles here*/
.range-slider .input-range {
-webkit-appearance: none;
width: 449px;
height: 5px;
border-radius: 5px;
background: #ccc;
outline: none;
}
}
#media (-ms-high-contrast:none),(-ms-high-contrast:active) {
/* IE styles here*/
.range-slider .input-range {
/*removes default webkit styles*/
-webkit-appearance: none;
/*fix for FF unable to apply focus style bug */
border: 1px solid white;
/*required for proper track sizing in FF*/
width: 450px;
outline: none;
}
}
.range-slider .input-range::-webkit-slider-thumb {
-webkit-appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
background: #164188;
cursor: pointer;
-webkit-transition: background .15s ease-in-out;
transition: background .15s ease-in-out;
}
.range-slider .input-range::-webkit-slider-thumb:hover {
background: #164188;
}
.range-slider .input-range:active::-webkit-slider-thumb {
background: #164188;
}
.range-slider .input-range::-moz-range-thumb {
width: 20px;
height: 20px;
border: 0;
border-radius: 50%;
background: #164188;
cursor: pointer;
-webkit-transition: background .15s ease-in-out;
transition: background .15s ease-in-out;
}
.range-slider .input-range::-moz-range-thumb:hover {
background: #164188;
}
.range-slider .input-range:active::-moz-range-thumb {
background: #164188;
}
.range-slider .range-value {
display: inline-block;
position: relative;
width: 100px;
color: #fff;
font-size: 23px;
line-height: 32px;
text-align: center;
border-radius: 3px;
background: #164188;
padding: 5px 10px;
margin-left: 7px;
}
::-moz-range-track {
background: #ccc;
border: 0;
}
input::-moz-focus-inner {
border: 0;
}
input[type=range] {
margin: 2px;
}
input[type=range]::-ms-track {
width: 450px;
height: 5px;
/*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */
background: transparent;
/*leave room for the larger thumb to overflow with a transparent border */
border-color: transparent;
border-width: 6px 0;
/*remove default tick marks*/
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: #ccc;
border-radius: 10px;
}
input[type=range]::-ms-fill-upper {
background: #ccc;
border-radius: 10px;
}
Markup
<div class="selecteurPrix">
<div class="PrixMin"> -100</div>
<div class="range-slider">
<input class="input-range" orient="vertical" type="range" value="0" min="-100" max="100" step="25">
</div> <div class="PrixMin"> 100</div>
</div>
Is there something i am missing here? any help would is appreciated. Thanks
2 things
#media (-webkit-min-device-pixel-ratio:0) {
/* Non-IE styles here*/
.range-slider .input-range {
-webkit-appearance: none;
width: 449px;
height: 5px;
}
}
Is overwriting your
.input-range{
writing-mode: bt-lr; /* IE */
-webkit-appearance: slider-vertical;
}
Also you need to flip the width and height to match the vetical design
.input-range{
writing-mode: bt-lr; /* IE */
-webkit-appearance: slider-vertical;
width: 5px;
height: 449px;
}
you're looking for this appearance css property:
.input-range {
appearance: slider-vertical;
-moz-appearance: slider-vertical;
-webkit-appearance: slider-vertical;
}
Add:
input[orient=vertical] {
-webkit-appearance: slider-vertical;
height: 450px;
padding: 0 20px;
width: 20px;
writing-mode: bt-lr;
}
Remove:
.range-slider {
position: relative;
width: 450px;
float: left;
margin-right: 5px;
}

Custom range slider issue on Internet Explorer

Below is the css for my slider. The problem is that the slider is totally failing on IE.
Here is also the online version: https://codepen.io/mariomez/pen/yLNYdRg
I tried using MS fillers but it didn't go well as I am not familiar with how to properly use them.
.valeurPrix {
position: absolute;
top: -59px;
left: 177px;
}
.range-slider {
position: relative;
width: 450px;
float: left;
margin-right: 5px;
}
.range-slider .input-range {
-webkit-appearance: none;
width: 449px;
height: 5px;
border-radius: 5px;
background: #ccc;
outline: none;
}
.range-slider .input-range::-webkit-slider-thumb {
-webkit-appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
background: #164188;
cursor: pointer;
-webkit-transition: background .15s ease-in-out;
transition: background .15s ease-in-out;
}
.range-slider .input-range::-webkit-slider-thumb:hover {
background: #164188;
}
.range-slider .input-range:active::-webkit-slider-thumb {
background: #164188;
}
.range-slider .input-range::-moz-range-thumb {
width: 20px;
height: 20px;
border: 0;
border-radius: 50%;
background: #164188;
cursor: pointer;
-webkit-transition: background .15s ease-in-out;
transition: background .15s ease-in-out;
}
.range-slider .input-range::-moz-range-thumb:hover {
background: #164188;
}
.range-slider .input-range:active::-moz-range-thumb {
background: #164188;
}
.range-slider .range-value {
display: inline-block;
position: relative;
width: 100px;
color: #fff;
font-size: 23px;
line-height: 32px;
text-align: center;
border-radius: 3px;
background: #164188;
padding: 5px 10px;
margin-left: 7px;
}
::-moz-range-track {
background: #ccc;
border: 0;
}
input::-moz-focus-inner {
border: 0;
}
Can you please guide me on how to use MS fillers on this code?
First, since the input event only supports input of type text and password in the IE browser, I suggest you could try to use the mouseup event to get the range value. Code as below:
var range = $('.input-range'),
value = $('.range-value');
value.html(range.attr('value') + ' %');
range.on('mouseup', function() {
value.html(this.value + ' %');
});
Second, please try to use the following CSS style:
<style>
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.PrixMin {
float: left;
color: #164188;
font-size: 19px;
margin-right: 5px;
}
.selecteurPrix {
padding-top: 15px;
}
body {
font-family: sans-serif;
padding: 40px;
}
.valeurPrix {
position: absolute;
top: -59px;
left: 177px;
}
.range-slider {
position: relative;
width: 450px;
float: left;
margin-right: 5px;
}
#media (-webkit-min-device-pixel-ratio:0) {
/* Non-IE styles here*/
.range-slider .input-range {
-webkit-appearance: none;
width: 449px;
height: 5px;
border-radius: 5px;
background: #ccc;
outline: none;
}
}
#media (-ms-high-contrast:none),(-ms-high-contrast:active) {
/* IE styles here*/
.range-slider .input-range {
/*removes default webkit styles*/
-webkit-appearance: none;
/*fix for FF unable to apply focus style bug */
border: 1px solid white;
/*required for proper track sizing in FF*/
width: 450px;
outline: none;
}
}
.range-slider .input-range::-webkit-slider-thumb {
-webkit-appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
background: #164188;
cursor: pointer;
-webkit-transition: background .15s ease-in-out;
transition: background .15s ease-in-out;
}
.range-slider .input-range::-webkit-slider-thumb:hover {
background: #164188;
}
.range-slider .input-range:active::-webkit-slider-thumb {
background: #164188;
}
.range-slider .input-range::-moz-range-thumb {
width: 20px;
height: 20px;
border: 0;
border-radius: 50%;
background: #164188;
cursor: pointer;
-webkit-transition: background .15s ease-in-out;
transition: background .15s ease-in-out;
}
.range-slider .input-range::-moz-range-thumb:hover {
background: #164188;
}
.range-slider .input-range:active::-moz-range-thumb {
background: #164188;
}
.range-slider .range-value {
display: inline-block;
position: relative;
width: 100px;
color: #fff;
font-size: 23px;
line-height: 32px;
text-align: center;
border-radius: 3px;
background: #164188;
padding: 5px 10px;
margin-left: 7px;
}
::-moz-range-track {
background: #ccc;
border: 0;
}
input::-moz-focus-inner {
border: 0;
}
input[type=range] {
margin: 2px;
}
input[type=range]::-ms-track {
width: 450px;
height: 5px;
/*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */
background: transparent;
/*leave room for the larger thumb to overflow with a transparent border */
border-color: transparent;
border-width: 6px 0;
/*remove default tick marks*/
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: #ccc;
border-radius: 10px;
}
input[type=range]::-ms-fill-upper {
background: #ccc;
border-radius: 10px;
}
input[type=range]::-ms-thumb {
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: #164188;
}
input[type=range]:focus::-ms-fill-lower {
background: #ccc;
}
input[type=range]:focus::-ms-fill-upper {
background: #ccc;
}
</style>
The result in IE browser as below (you could find the whole sample code from here):
body {
padding: 30px;
}
input[type=range] {
/*removes default webkit styles*/
-webkit-appearance: none;
/*fix for FF unable to apply focus style bug */
border: 1px solid white;
/*required for proper track sizing in FF*/
width: 300px;
}
input[type=range]::-webkit-slider-runnable-track {
width: 300px;
height: 5px;
background: #ddd;
border: none;
border-radius: 3px;
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: goldenrod;
margin-top: -4px;
}
input[type=range]:focus {
outline: none;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: #ccc;
}
input[type=range]::-moz-range-track {
width: 300px;
height: 5px;
background: #ddd;
border: none;
border-radius: 3px;
}
input[type=range]::-moz-range-thumb {
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: goldenrod;
}
/*hide the outline behind the border*/
input[type=range]:-moz-focusring{
outline: 1px solid white;
outline-offset: -1px;
}
input[type=range]::-ms-track {
width: 300px;
height: 5px;
/*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */
background: transparent;
/*leave room for the larger thumb to overflow with a transparent border */
border-color: transparent;
border-width: 6px 0;
/*remove default tick marks*/
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: #777;
border-radius: 10px;
}
input[type=range]::-ms-fill-upper {
background: #ddd;
border-radius: 10px;
}
input[type=range]::-ms-thumb {
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: goldenrod;
}
input[type=range]:focus::-ms-fill-lower {
background: #888;
}
input[type=range]:focus::-ms-fill-upper {
background: #ccc;
}
<input type="range">

How to avoid header or even other containers from messing up when zoomed in/out?

I'm trying to achieve a Bootstrap-like header with navigations but I just found out that when I zoomed out the window, the contents inside the header are messing up and the header also minimizes instead of staying on the same size. I already used vh unit on the header so that it will only stay on the same size with any screen device's size but it doesn't work. I only want the content to become smaller as it gets zoomed out but not the header just like on the Bootstrap Themes I saw, how can this be achieved without using Bootstrap?
Here's the SCREENSHOT IMAGE of my code:
And here's what I want to ACHIEVE: This was zoomed out but only the contents became small, not the header.
HTML
<!DOCTYPE html>
<html>
<head>
<title>Dental Services</title>
<meta name="project" content="Dental Services">
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<header class="master-header">
<nav class="nav-bar">
<div class="nav-container">
<div class="brand-container">
<span class="brand-name">Dental Services</span>
</div>
<ul class="nav-links">
<li>Home</li><li>Services</li><li>About</li><li>Sign In</li>
</ul>
</div>
<div class="jumbotron">
<h1 class="motto">We care about</br> your teeth</h1>
<form class="login-form">
<p class="form-title">Get started for free</p>
<input type="text" placeholder="Enter your username" />
<input type="text" placeholder="Enter your email" />
<input type="password" placeholder="Enter your password" />
<button class="bnt-submit">Get Started</button>
</form>
</div>
</nav>
</header>
</body>
</html>
CSS
body {
margin: 0; padding: 0;
font: 1rem Arial;
background: #AAA;
box-sizing: border-box;
}
input {
position: relative;
height: 50px; width: 100%;
margin: 25px 0; padding: 5px 15px;
border: 1px solid #BBB; border-radius: 3px;
font: 1em Arial;
color: #555;
background: #FFF;
transition: box-shadow 100ms linear;
box-sizing: border-box;
display: block;
}
button {
position: relative;
height: 50px; width: 100%;
border: 0; border-radius: 4px;
font: 1em Arial;
color: #FFF;
background: Mediumseagreen;
box-sizing: border-box;
transition: background 100ms linear;
cursor: pointer;
}
button:hover {
background: Seagreen;
}
input:focus {
outline: none;
border-color: Steelblue;
box-shadow: 0 0 0 4px Lightsteelblue;
}
.master-header {
position: fixed;
height: 100%; width: 100%;
background: url(../images/header_img.jpg) top center no-repeat;
background-attachment: fixed;
}
.nav-bar {
position: absolute;
width: 100%;
background: transparent;
overflow: hidden;
}
.nav-container {
position: relative;
width: 94%;
margin: 0 auto; padding: 0 15px;
background: transparent;
overflow: auto;
box-sizing: border-box;
}
.brand-container {
float: left;
padding: 20px 0;
}
.brand-name {
position: relative;
color: #DDD;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
.nav-links {
margin: 0; padding: 0;
float: right;
list-style-type: none;
box-sizing: border-box;
}
.nav-links li {
font: 1em Arial;
padding: 20px 15px;
display: inline-block;
box-sizing: border-box;
}
.nav-links li a {
color: #DDD;
text-decoration: none;
text-transform: uppercase;
transition: color 100ms linear;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
.nav-links li a:hover {
color: #AAA;
}
.jumbotron {
position: relative;
padding: 40px 60px;
box-sizing: border-box;
overflow: hidden;
}
.motto {
font: 5em Arial;
color: #FFF;
text-align: left;
text-shadow: 1px 1px #333;
display: inline-block;
float: left;
}
.login-form {
position: relative;
width: 40%;
padding: 20px 50px;
background: #FFF;
box-sizing: border-box;
display: inline-block;
float: right;
}
.form-title {
position: relative;
margin: 20px 0 30px 0;
font: 1.5em Arial;
color: #666;
text-align: left;
}
Nevermind. I fixed it with one CSS property: background-size: cover;
I thought the header itself was becoming smaller as it gets zoomed out. But I found out that only the background image became smaller and I fixed it myself when I tried background-size: cover;.

CSS hover styling on just the border of an object?

I'm having an issue customizing the CSS of some button widgets that came with a WordPress theme I'm running. I grabbed a quick screen capture video of what's happening because it's hard to describe.
Video Link: https://drive.google.com/open?id=1mYvOtAjz-0QnJYV3_nGYXnFoRpsRdVo_
The CSS I have applied on the buttons:
.lc_button {
height: 100px !important;
width: 200px !important;
font-size: 18px !important;
border: 1px solid #dd3333 !important;
text-align: center;
background-color: white;
border-radius: 5%;
}
.lc_button:hover {
background-color: white;
border: 4px solid #dd3333 !important;
color: #151515 !important;
}
.lc_button a:hover {
color: #151515 !important;
}
Any idea what I have to do to get the inside to stay visible no matter where the cusror is at inside the button?
Thanks
I've tried to solve your problem. I am successful. You can use this code of mine.
HTML
<div class="lc_button">
Watch video
</div>
CSS
.lc_button a {
display: block;
width: 200px;
height: 100px;
line-height: 100px;
font-size: 18px;
font-weight: 700;
color: #000000;
border-radius: 5%;
box-sizing: border-box;
transition: 0.3s;
background-color: white;
text-decoration: none;
text-transform: uppercase;
text-align: center;
position: relative;
}
.lc_button a:before {
display: block;
position: absolute;
border-radius: 5%;
left: 0;
top: 0;
content: "";
width: 200px;
height: 100px;
box-sizing: border-box;
border: 1px solid red;
transition: 0.3s;
}
.lc_button a:hover:before {
border: 4px solid red;
}
.lc_button a:hover {
color: #151515 !important;
background-color: #ffffff;
}
.lc_button a {
display: block;
width: 200px;
height: 100px;
line-height: 100px;
font-size: 18px;
font-weight: 700;
color: #000000;
border-radius: 5%;
box-sizing: border-box;
transition: 0.3s;
background-color: white;
text-decoration: none;
text-transform: uppercase;
text-align: center;
position: relative;
}
.lc_button a:before {
display: block;
position: absolute;
border-radius: 5%;
left: 0;
top: 0;
content: "";
width: 200px;
height: 100px;
box-sizing: border-box;
border: 1px solid red;
transition: 0.3s;
}
.lc_button a:hover:before {
border: 4px solid red;
}
.lc_button a:hover {
color: #151515 !important;
background-color: #ffffff;
}
<div class="lc_button">
Watch video
</div>
The .css you've provided seems fully functional, and customizable. (aka, not broken, works fine).
The whole .css and the .html might shed some light on things without any "major alterations".
.lc_button {
height: 100px !important;
width: 200px !important;
font-size: 18px !important;
border: 1px solid #dd3333 !important;
text-align: center;
background-color: white;
border-radius: 5%;
}
.lc_button:hover {
background-color: white;
border: 4px solid #0000ff !important;
color: #00ff00 !important;
}
.lc_button a:hover {
color: #151515 !important;
}
<body>
<button class="lc_button">Test</button>
</body>
I've shared the code snippet..I think this will help you to solve the problem...
*, *:after, *:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body{
font-family: 'PT Sans', sans-serif;
display: table;
width: 100%;
background: #f54785;
}
.container{
display: table-cell;
vertical-align: middle;
text-align: center;
height: 100vh;
}
button{
display: inline-block;
position: relative;
background: none;
border: none;
color: #fff;
font-size: 18px;
cursor: pointer;
margin: 20px 30px;
background: rgba(0,0,0,0.09);
}
span{
display: block;
padding: 25px 80px;
}
button::before, button::after{
content:"";
width: 0;
height: 2px;
position: absolute;
transition: all 0.2s linear;
background: #fff;
}
span::before, span::after{
content:"";
width:2px;
height:0;
position: absolute;
transition: all 0.2s linear;
background: #fff;
}
button:hover::before, button:hover::after{
width: 100%;
}
button:hover span::before, button:hover span::after{
height: 100%;
}
.btn-1::after{
left:0;
bottom: 0;
transition-duration: 0.4s;
}
.btn-1 span::after{
right:0;
top: 0;
transition-duration: 0.4s;
}
.btn-1::before{
right: 0;
top: 0;
transition-duration: 0.4s;
}
.btn-1 span::before{
left: 0;
bottom: 0;
transition-duration: 0.4s;
}
<div class="container">
<button class="btn-1"><span>Hover Me</span></button>
</div>
This will help you to solve the problem...
button {
height: 100px !important;
width: 200px !important;
font-size: 18px !important;
border: 1px solid #dd3333 !important;
text-align: center;
background-color: white;
border-radius: 5%;
}
button:hover {
background-color: white;
border: 4px solid #dd3333 !important;
color: #151515 !important;
}
button a:hover {
color: #151515 !important;
}
<div class="container">
<button class="lc_button"><span>Hover Me</span></button>
</div>