CSS Form underline text field animation effect - html

I have the following code (below) of my form section and in it i want this (below image) underline animation to be done in the text input field . Whenever the user focus on the field the animation to be done.
the animation is to be smooth ease.
But something is missing i can't find in it. What is wrong and How to fix it?
Anyone Please help
html {
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
text-rendering: optimizelegibility;
}
html, body {
height: 100%;
}
#contact {
font-family: "Montserrat", sans-serif;
font-size: 14px;
font-weight: 300;
letter-spacing: 3px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-flow: row wrap;
flex-flow: row wrap;
margin: 10% 0;
}
#contact main, body footer {
width: 100%;
}
#contact main {
height: 100%;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.form .text-input, .form .textarea, .form .label, .form .button {
padding: 1em 1.5em;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
outline: none;
line-height: normal;
border: 1px solid transparent;
border-radius: 0;
}
.form .text-input, .form .textarea {
font: inherit;
line-height: normal;
width: 100%;
box-sizing: border-box;
display: block;
padding-left: 0;
border-bottom-color: #00d2ff;
background: transparent;
outline: none;
color: black;
}
.form .text-input:placeholder, .form .textarea:placeholder {
color: rgba(0, 0, 0, 0.7);
}
.form .text-input:-webkit-autofill, .form .textarea:-webkit-autofill {
box-shadow: 0 0 0px 1000px white inset;
border-top-color: white;
border-left-color: white;
border-right-color: white;
}
.form .error.text-input, .form .error.textarea, .error .form .text-input, .form .error .text-input, .error .form .textarea, .form .error .textarea {
border-color: transparent transparent red transparent;
}
.form:not(.has-floated-label) .text-input:active, .form:not(.has-floated-label) .textarea:active, .form:not(.has-floated-label) .text-input:focus, .form:not(.has-floated-label) .textarea:focus {
border-color: transparent transparent black transparent;
}
.form .label {
position: absolute;
z-index: 10;
pointer-events: none;
padding-left: 0;
}
.form .label {
top: 0;
left: 0;
color: rgba(0, 0, 0, 0.3);
-webkit-transition: color 0.3s;
transition: color 0.3s;
}
.active .form .label, .form .active .label {
font-size: 0.80em;
line-height: 1;
font-weight: 600;
text-transform: uppercase;
padding: 0;
color: rgba(0, 0, 0, 0.7);
background: white;
}
.focus .form .label, .form .focus .label {
color: black;
}
.form.has-floated-label .field:after {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 0%;
border-bottom: 3px solid #00d2ff;
-webkit-transition: width 0.3s cubic-bezier(0.455, 0.03, 0.515, 0.955);
transition: width 0.3s cubic-bezier(0.455, 0.03, 0.515, 0.955);
}
.form.has-floated-label .field.focus:after {
width: 100%;
}
.form .button {
font: inherit;
line-height: normal;
cursor: pointer;
background-color: #00d2ff;
color: white;
text-transform: uppercase;
text-align: center;
letter-spacing: 0.14286em;
transition-duration: 0.4s;
}
.form .button:hover, .form .button:focus, .form .button:active {
box-shadow: 0 10px 15px rgba(0, 0, 0, .1);
}
.form .button:active {
position: relative;
top: 1px;
left: 1px;
}
.form {
/* max-width: 50em; */
width: 100%;
margin: 0 10%;
/* padding: 1em 2em; */
box-sizing: border-box;
overflow: hidden;
}
.form .field {
position: relative;
width: 100%;
margin-bottom: 1.5em;
float: left;
}
#media screen and (min-width: 40em) {
.form .field.half {
width: calc(50% - 2em);
margin-right: 2em;
}
.form .field.half + .half {
margin-left: 2em;
margin-right: 0;
}
}
.form .field:last-child {
float: right;
width: auto;
}
.form .textarea {
max-width: 100%;
}
<section id="contact">
<main>
<form action='' class='form'>
<p class='field required half'>
<label class='label required' for='name'>Name</label>
<input class='text-input' id='name' name='name' required type='text'>
</p>
<p class='field required half'>
<label class='label' for='email'>E-mail</label>
<input class='text-input' id='email' name='email' required type='email'>
</p>
<p class='field'>
<label class='label' for='message'>Message</label>
<textarea class='textarea' cols='50' id='message' name='message' required rows='4'></textarea>
</p>
<p class='field'>
<input class='button' type='submit' value='Send message'>
</p>
</form>
</main>
</section>

This is an example:
.input-name{
position: relative;
display: inline-block;
overflow: hidden;
}
.input-name > input[type=text]{
border: none;
border-bottom: 2px solid red;
outline: none;
}
.underline-animation{
transition: all 0.5s;
display: inline-block;
bottom: 0;
left: -100%;
position: absolute;
width: 100%;
height: 2px;
background-color: #64e4fe;
}
.input-name > input[type=text]:focus + .underline-animation{
left: 0;
}
<div class="input-name">
<input type="text" placeholder="name">
<span class="underline-animation"></span>
</div>

I don't think this is possible with only the underline element since I know of no way to animate it like that, you can use the <hr> element though.
then you can do
hr{
position:relative;
left:0;
width:0%;
height:2px;
background-color:#1784E1;
border:none;
margin-top:0;
margin-left:0;
margin-bottom:20px;
transition:0.5s;
}
input:focus + hr{
width:100%;
}
if you go to sam.apostel.be/TAD, is that what you want?

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.

Separate two spans CSS

I have a animation where when i hover the icons swing from the right, i want to have it for both of my icons, the delete and edit, but i can't find out which style should i use to separate them and change colors indivitually without messing up the sizing of the icons or the placement.
Html:
import React, { useState } from "react";
import "./App.css";
import axios from "axios";
import { FontAwesomeIcon } from "#fortawesome/react-fontawesome";
import { faTrash, faPlus, faEdit } 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} />
<FontAwesomeIcon icon={faEdit} />
</span>
</li>
<li>
Buy something
<span>
<FontAwesomeIcon icon={faTrash} />
<FontAwesomeIcon icon={faEdit} />
</span>
</li>
<li>
Learn something
<span>
<FontAwesomeIcon icon={faTrash} />
<FontAwesomeIcon icon={faEdit} />
</span>
</li>
</ul>
<div class="footer">
<span> You have 3 pending tasks</span>
<button>Clear</button>
</div>
</div>
</div>
</>
);
}
export default App;
The classes i been trying to change to separate them are the .todoList li and .todoList li span
CSS:
* {
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: 45px;
line-height: 45px;
position: relative;
background: #f2f2f2;
border-radius: 3px;
margin-bottom: 8px;
padding: 0 15px;
cursor: default;
overflow: hidden;
}
.todoList li span {
position: absolute;
right: -60px;
color: #fff;
width: 45px;
text-align: center;
background: #e74c3c;
border-radius: 0 3px 3px 0;
cursor: pointer;
transition: all 0.3s ease;
}
.todoList li:hover span {
right: 0px;
}
.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 forgot a principle: ‌
single responsible principle
So the best way is the component is only responsible for one thing.
So let's make a separate component that gets a conditional rendering based on prop and then be responsible for its own behavior.
You can then wrap them with an element and use flexbox in css.
solution :
1-add "icon_container" className to span
<span className="icon_container">
...
</span>
2-add "font_custom_class" className to FontAwesome
<FontAwsome className="font_custom_class" .../>
3.change some style in css file:
.todoList li {
display : flex;
flex-flow : row;
justify-content : space-between;
list-style: none;
height: 45px;
line-height: 45px;
position: relative;
background: #f2f2f2;
border-radius: 3px;
margin-bottom: 8px;
cursor: default;
overflow: hidden;
padding-left: 15px !important;
}
.icon_container {
width : 100px;
background : red;
display : flex;
flex-flow : row nowrap;
justify-content : center;
align-items : center;
transform : translateX(100px);
transition : all 0.5s;
}
.icon_container > .font_custom_class {
flex-grow: 1;
text-align: center;
}
.todoList li:hover .icon_container {
transform : translateX(0);
}

Change check button label when pressed using CSS

I wish to change the color and the background of the button label when I check the button, but it is not working. This is a collapsible button.
.accordion>input[name="collapse"] {
display: none;
/*position: absolute;
left: -100vw;*/
}
.accordion label,
.accordion .content {
margin-left: 0;
}
.accordion label {
display: block;
border-bottom: solid 1px #ffffff55;
width: 76%;
margin-left: 12%;
text-indent: 10px;
font-size: 15px;
font-weight: 400;
font-family: Open Sans;
margin-top: 7px;
padding-top: 13px;
padding-bottom: 7px;
}
.accordion .content {
overflow: hidden;
height: 0;
transition: 0.5s;
}
.accordion>input[name="collapse"]:checked~.content {
height: 0px;
transition: height 0.5s;
}
/* For Desktop */
#media only screen and (min-width: 620px) {
.accordion .handle {
margin: 0;
font-size: 16px;
}
.accordion label {
color: #fff;
cursor: pointer;
font-weight: normal;
user-select: none;
}
.accordion label:hover,
.accordion label:focus {
background: rgba(255, 255, 255, 0.2);
border: rgba(255, 255, 255, 0.2);
border-radius: 5px;
}
.accordion .handle label:after {
font-family: FontAwesome;
content: "\f107";
display: inline-block;
margin-left: 10px;
font-size: 1em;
line-height: 1.556em;
vertical-align: middle;
transition: 0.4s;
}
.accordion>input[name="collapse"]:checked~.content {
height: 70px;
margin-left: 12%;
border-top: 0;
transition: 0.3s;
}
.accordion {
margin-bottom: 0;
}
.accordion>input[name="collapse"]:checked~.handle label:after {
transform: rotate(180deg);
transform-origin: center;
transition: 0.4s;
}
.accordion>input[name="collapse"]:checked~.accordion label {
color: #000;
background: #ffffff;
}
}
<div class="accordion">
<input type="checkbox" name="collapse" id="handle4">
<h2 class="handle ">
<label for="handle4" style="">Change Language</label>
</h2>
<div class="content">
<p>Some contents</p>
</div>
</div>
The very last CSS instruction is the one I'm trying to use to change the color and background of the label "Change language", but it does not work.
Please help!
Your sibling element shall be .handle label instead of .accordion label
you would need to change the instruction to this
.accordion>input[name="collapse"]:checked ~ .handle label {
color: #000;
background: #ffffff;
}
the one you have will not work since there is no direct sibling that is .accordion

need to make this below range slider Responsive

I need to make this Range slider responsive. Text is getting overlapped when i start using in mobile version. Please help me to achieve this.
I have tried to add it in Table responsive and adding some responsive divs but still it didn't workout.
It would be great if someone help me to find out the way to make it responsive. You can see executable code in
#import url(https://fonts.googleapis.com/css?family=Catamaran" rel="stylesheet);
#import url("https://fonts.googleapis.com/css?family=Dancing+Script");
.label-container {
margin-top: 0.5rem;
-webkit-flex-basis: 100%;
display: -webkit-flex;
-webkit-flex-wrap: nowrap;
-webkit-justify-content: space-between;
margin-bottom: 50px;
}
.label-slider {
color: #3949ab;
font-size: 14px;
font-weight: 700;
text-align: center;
-webkit-tap-highlight-color: transparent;
cursor: pointer;
}
.label-slider:nth-child(1) {
padding-left: 0px;
}
.label-slider:nth-child(2) {
padding-left: 18px;
}
.label-slider:nth-child(3) {
padding-left: 34px;
}
.label-slider:nth-child(4) {
padding-left: 32px;
}
.label-slider:nth-child(5) {
padding-left: 32px;
}
.slider-container {
width: 100%;
margin-top: 5px;
}
.slider {
-webkit-appearance: none;
-moz-appearance: none;
width: 100%;
height: 10px;
border-radius: 5px;
background: #dde5ff;
outline: none;
opacity: 0.7;
-webkit-transition: 0.2s;
transition: opacity 0.2s;
}
input[type="range"],
input[type="range"]::-moz-range-track {
-webkit-appearance: none;
-moz-appearance: none;
width: 100%;
border-radius: 5px;
background: #dde5ff;
outline: none;
transition: opacity 0.2s;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
border-radius: 50%;
background: #2b8aeb;
cursor: pointer;
outline: none;
}
input[type="range"]::-moz-range-thumb {
-moz-appearance: none;
appearance: none;
width: 25px;
height: 25px;
border-radius: 50%;
background: #1492ea;
cursor: pointer;
outline: none;
z-index: 10;
}
input[type="range"]:focus {
outline: none;
}
<body>
<p class="title">Range Sliders</p>
<h4>Range Slider without steps</h4>
<div class="slider-container">
<input type="range" min="0" max="4" class="slider">
</div>
<div class="label-container">
<div class="label-slider">None</div>
<div class="label-slider">1</div>
<div class="label-slider">2</div>
<div class="label-slider">3</div>
<div class="label-slider">4+</div>
</div>
</body>
Just replace width: 600px by max-width:600px; in container.
For the font-size, I would recommand you to set font size based in rem. and set breakpoints font-size on your html element to size as you wish. as this subject: Rem not compatible with media queries?
Ad I will also recommand you to remove container padding-left and right when you under a certain width of screen, this way, the scale will stay well align with your input.
Edit
To fix the the container label, I set them with position absolute.
First step add position relative on container:
.label-container{
position:relative;
}
Then add position: absolute on labels:
.label-slider{
position: absolute;
}
And finaly just Adjust correctly with absolute as follow:
.label-slider:nth-child(1) {
left:0;
}
.label-slider:nth-child(2) {
left:25%;
transform: translateX(-25%);
margin-left: 1%;
}
.label-slider:nth-child(3) {
left:50%;
transform: translateX(-50%);
margin-left: .5%;
}
.label-slider:nth-child(4) {
right: 25%;
transform: translateX(25%);
margin-left: 1%;
}
.label-slider:nth-child(5) {
right:0;
}
DEMO FULL
#import url(https://fonts.googleapis.com/css?family=Catamaran" rel="stylesheet);
#import url("https://fonts.googleapis.com/css?family=Dancing+Script");
body {
font-family: "Catamaran", sans-serif;
background: #2b8aeb;
}
.container {
font-family: "Catamaran", sans-serif;
max-width: 600px;
margin: 30px auto 0;
display: block;
background: #fff;
padding: 10px 50px 50px;
border-radius: 4px;
box-shadow 0 6px 16px rgba(0,0,0,0.15)
}
.title {
text-align: center;
font-family: "Dancing Script", cursive;
color: #3949ab;
font-size: 35px;
}
.label-container {
margin-top: 0.5rem;
-webkit-flex-basis: 100%;
display: -webkit-flex;
-webkit-flex-wrap: nowrap;
-webkit-justify-content: space-between;
margin-bottom: 50px;
position : relative;
}
.label-slider {
color: #3949ab;
font-size: 14px;
font-weight: 700;
text-align: center;
-webkit-tap-highlight-color: transparent;
cursor: pointer;
position: absolute;
}
.label-slider:nth-child(1) {
left:0;
}
.label-slider:nth-child(2) {
left:25%;
transform: translateX(-25%);
margin-left: 1%;
}
.label-slider:nth-child(3) {
left:50%;
transform: translateX(-50%);
margin-left: .5%;
}
.label-slider:nth-child(4) {
right: 25%;
transform: translateX(25%);
margin-left: 1%;
}
.label-slider:nth-child(5) {
right:0;
}
.slider-container {
width: 100%;
margin-top: 5px;
}
.slider {
-webkit-appearance: none;
-moz-appearance: none;
width: 100%;
height: 10px;
border-radius: 5px;
background: #dde5ff;
outline: none;
opacity: 0.7;
-webkit-transition: 0.2s;
transition: opacity 0.2s;
}
input[type="range"],
input[type="range"]::-moz-range-track {
-webkit-appearance: none;
-moz-appearance: none;
width: 100%;
border-radius: 5px;
background: #dde5ff;
outline: none;
transition: opacity 0.2s;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
border-radius: 50%;
background: #2b8aeb;
cursor: pointer;
outline: none;
}
input[type="range"]::-moz-range-thumb {
-moz-appearance: none;
appearance: none;
width: 25px;
height: 25px;
border-radius: 50%;
background: #1492ea;
cursor: pointer;
outline: none;
z-index: 10;
}
input[type="range"]:focus {
outline: none;
}
.ticks {
font-family: "Catamaran", sans-serif;
color: #3949ab;
font-size: 14px;
font-weight: 700;
display: flex;
justify-content: space-between;
height: 6px;
margin: 0 10px 0 15px;
counter-reset: count -1;
}
.ticks > div {
height: 100%;
width: 1px;
background: silver;
counter-increment: count 1;
}
.ticks > div:nth-child(5n - 4) {
height: 200%;
}
.ticks > div:nth-child(5n - 4)::before {
display: block;
content: counter(count,decimal);
transform: translate(-50%, 100%);
text-align: center;
width: 16px;
}
<body>
<div class="container">
<p class="title">Range Sliders</p>
<h4>Range Slider without steps</h4>
<div class="slider-container">
<input type="range" min="0" max="4" class="slider">
</div>
<div class="label-container">
<div class="label-slider">None</div>
<div class="label-slider">1</div>
<div class="label-slider">2</div>
<div class="label-slider">3</div>
<div class="label-slider">4+</div>
</div>
</div>
</body>

How to align buttons with html and css?

I wrote a little html page that contains some buttons. What I want to do is to have them look like this :
I'm not good at all at css, I tried some combination but what I get is to have them "below the blue line" like this :
Here is my html code :
<div class="module form-module">
<div class="flex-container">
<article class="article">
<table>
<tr>
<td>
<button>Configurations</button>
</td>
<td>
<button>Create User </button>
</td>
<td>
<button>Update User</button>
</td>
<td>
<button>Create Group</button>
</td>
<td>
<button>Update Group</button>
</td>
</tr>
</table>
</article>
</div>
</div>
You can find my css code in that plunker : https://plnkr.co/edit/sCcBBFfWRiCwGz8hs8oR?p=catalogue
Can you please help me to fix this little problem in html ?
CSS changes:
.form-module {
border-bottom: 5px solid #33b5e5;
position: relative;
background: #ffffff;
width: 100%;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
margin: 0 auto;
align: right;
}
.flex-container > * {
padding: 15px;
-webkit-flex: 1 100%;
flex: 1 100%;
}
table {
border-spacing:0px;
}
td {
padding:0px;
}
Changes expalined:
The blue line is a border, and was set on the button's parent container. It was set to top when you wanted it to be on the bottom, so that's first change.
Then you had padding, which was separating the buttons from the edges of the container, that's second change, set it to 0px.
Finally, both the table and each button had a 1px border which would separate it from the edges of the container, third change was setting those borders to 0px.
Small suggestion:
In case you're not aware: it's really helpful to use browser inspector to better understand what's going on with CSS. Also, if you don't wish to make everything from scratch, I'd recommend you have a look at Bootstrap, it's quite easy and might save you a bunch of time.
Good luck.
In case it's useful, here's the complete CSS:
body {
background: #e9e9e9;
color: #666666;
font-family: 'RobotoDraft', 'Roboto', sans-serif;
font-size: 14px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
table {
border-spacing:0px;
}
td {
padding:0px;
}
/* Pen Title */
.pen-title {
padding: 50px 0;
text-align: center;
letter-spacing: 2px;
}
.pen-title h1 {
margin: 0 0 20px;
font-size: 48px;
font-weight: 300;
}
.pen-title span {
font-size: 12px;
}
.pen-title span .fa {
color: #33b5e5;
}
.pen-title span a {
color: #33b5e5;
font-weight: 600;
text-decoration: none;
}
/* Form Module */
.form-module {
position: relative;
background: #ffffff;
width: 100%;
border-bottom: 5px solid #33b5e5;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
margin: 0 auto;
align: right;
}
.form-module .toggle {
cursor: pointer;
position: absolute;
top: -0;
right: -0;
background: #33b5e5;
width: 30px;
height: 30px;
margin: -5px 0 0;
color: #ffffff;
font-size: 12px;
line-height: 30px;
text-align: center;
}
.form-module .toggle .tooltip {
position: absolute;
top: 5px;
right: -65px;
display: block;
background: rgba(0, 0, 0, 0.6);
width: auto;
padding: 5px;
font-size: 10px;
line-height: 1;
text-transform: uppercase;
}
.form-module .toggle .tooltip:before {
content: '';
position: absolute;
top: 5px;
left: -5px;
display: block;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-right: 5px solid rgba(0, 0, 0, 0.6);
}
.form-module .form {
display: none;
padding: 40px;
}
.form-module .form:nth-child(2) {
display: block;
}
.form-module h2 {
margin: 0 0 20px;
color: #33b5e5;
font-size: 18px;
font-weight: 400;
line-height: 1;
}
.form-module table {
width: 100%
}
.form-module input {
outline: none;
width: 80%;
border: 1px solid #d9d9d9;
padding: 10px 15px;
font-weight: 400;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.form-module input:focus {
border: 1px solid #33b5e5;
color: #333333;
}
.form-module button {
cursor: pointer;
background: #33b5e5;
width: 90%;
border: 0;
padding: 10px 15px;
color: #ffffff;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.form-module button:hover {
background: #178ab4;
}
.form-module select {
cursor: pointer;
width: 85%;
height:80%;
padding: 10px 15px;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.flag button {
background: white;
color: #178ab4;
}
.flag button:hover {
background: white;
border: 20px;
border-color: #178ab4;
}
.flag {
cursor: pointer;
background: white;
width: 100%;
border: 0;
padding: 10px 15px;
border-color: #178ab4;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.flag a {
cursor: pointer;
background: white;
width: 100%;
border: 0;
color: #33b5e5;
border-color: #178ab4;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.flag a :hover {
background: white;
}
.form-module .cta {
background: #f2f2f2;
width: 100%;
padding: 15px 40px;
box-sizing: border-box;
color: #666666;
font-size: 12px;
text-align: center;
}
.form-module .cta a {
color: #333333;
text-decoration: none;
}
.flex-container {
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row wrap;
flex-flow: row wrap;
align: right;
}
.flex-container > * {
padding: 0px;
-webkit-flex: 1 100%;
flex: 1 100%;
}
.article {
text-align: left;
}
.detail button {
width: 120px
}
.detail table {
border-collapse: separate;
border-spacing: 5px 10px;
width: 100%
}
.search table {
border-collapse: separate;
border-spacing: 5px 10px;
width: 70%
}
.search button {
width: 120px
}
.search input {
outline: none;
width: 90%;
border: 1px solid #d9d9d9;
padding: 10px 15px;
font-weight: 400;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.search select {
cursor: pointer;
width: 90%;
padding: 10px 15px;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.resultSearch table {
border-collapse: separate;
border-spacing: 5px 10px;
width: 80%
}
.dropbtn {
outline: none;
border:1;
width: 80%;
border: 1px solid #d9d9d9;
padding: 10px 15px;
font-size: 16px;
cursor: pointer;
}
.dropbtn:hover, .dropbtn:focus {
}
#myInput {
border-box: box-sizing;
background-image: url('searchicon.png');
background-position: 14px 12px;
background-repeat: no-repeat;
font-size: 16px;
outline: none;
width: 100%;
border: 1px solid #d9d9d9;
padding: 10px 15px;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f6f6f6;
min-width: 230px;
overflow: auto;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown a:hover {background-color: #ddd}
.show {display:block;}
#searchbox
{
width: 35px;
}
#media all and (min-width: 768px) {
.nav {text-align:left;-webkit-flex: 1 auto;flex:1 auto;-webkit-order:1;order:1;}
.article {-webkit-flex:5 0px;flex:5 0px;-webkit-order:2;order:2;}
footer {-webkit-order:3;order:3;}
}
.newUser button {
width: 120px
}
.newUser table {
border-collapse: separate;
border-spacing: 5px 10px;
width: 90%
}
.return table{
border-collapse: separate;
border-spacing: 5px 10px;
width: 90%;
}
.returnCheckBox input {
align: left;
width:0%;
}
.invoiceListTable table {
border-collapse: separate;
border-spacing: 5px 10px;
width: 90%
}
.sessionInfo table {
border-collapse: separate;
border-spacing: 5px 10px;
width: 100%;
align: right;
}
.sessionInfo {
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row wrap;
flex-flow: row wrap;
align: right;
}
.sessionInfo > * {
padding: 15px;
-webkit-flex: 1 100%;
flex: 1 100%;
align: right;
}
.sessionInfo {
position: relative;
background: #ffffff;
width: 20%;
border-top: 5px solid #33b5e5;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
margin: 0 auto;
align: right;
}
.sessionInfo .toggle {
cursor: pointer;
position: absolute;
top: -0;
right: -0;
background: #33b5e5;
width: 30px;
height: 30px;
margin: -5px 0 0;
color: #ffffff;
font-size: 12px;
line-height: 30px;
text-align: center;
}
.sessionInfo .toggle .tooltip {
position: absolute;
top: 5px;
right: -65px;
display: block;
background: rgba(0, 0, 0, 0.6);
width: auto;
padding: 5px;
font-size: 10px;
line-height: 1;
text-transform: uppercase;
}
.sessionInfo .toggle .tooltip:before {
content: '';
position: absolute;
top: 5px;
left: -5px;
display: block;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-right: 5px solid rgba(0, 0, 0, 0.6);
}
.form-module .form {
display: none;
padding: 40px;
align:right;
}
UPDATE:
You mentioned the buttons should be outside and above the form-module, so the html needs to be changed and not just the css. We removed the flex-container div which was nested inside form-module div and placed it after this container is closed. Since the buttons were getting their layout properties from .form-module's style, it was necessary to create a new class "buttons". Basically now form-module and buttons are in different containers and with separated style properties.
To understand how container blocks work:
http://www.w3schools.com/html/html_blocks.asp
html:
<div class="flex-container buttons">
<article class="article">
<table>
<tr>
<td>
<button>Configurations</button>
</td>
<td>
<button>Create User </button>
</td>
<td>
<button>Update User</button>
</td>
<td>
<button>Create Group</button>
</td>
<td>
<button>Update Group</button>
</td>
</tr>
</table>
</article>
</div>
<div class="module form-module">
</div>
changed css:
body {
background: #e9e9e9;
color: #666666;
font-family: 'RobotoDraft', 'Roboto', sans-serif;
font-size: 14px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.buttons table {
width: 100%;
border-spacing:0px;
}
.buttons td {
padding:0px;
}
.buttons input {
outline: none;
width: 80%;
border: 1px solid #d9d9d9;
padding: 10px 15px;
font-weight: 400;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.buttons input:focus {
border: 1px solid #33b5e5;
color: #333333;
}
.buttons button {
cursor: pointer;
background: #33b5e5;
width: 90%;
border: 0;
padding: 10px 15px;
color: #ffffff;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.buttons button:hover {
background: #178ab4;
}
.buttons select {
cursor: pointer;
width: 85%;
height:80%;
padding: 10px 15px;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
complete css:
body {
background: #e9e9e9;
color: #666666;
font-family: 'RobotoDraft', 'Roboto', sans-serif;
font-size: 14px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.buttons table {
width: 100%;
border-spacing:0px;
}
.buttons td {
padding:0px;
}
.buttons input {
outline: none;
width: 80%;
border: 1px solid #d9d9d9;
padding: 10px 15px;
font-weight: 400;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.buttons input:focus {
border: 1px solid #33b5e5;
color: #333333;
}
.buttons button {
cursor: pointer;
background: #33b5e5;
width: 90%;
border: 0;
padding: 10px 15px;
color: #ffffff;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.buttons button:hover {
background: #178ab4;
}
.buttons select {
cursor: pointer;
width: 85%;
height:80%;
padding: 10px 15px;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
/* Pen Title */
.pen-title {
padding: 50px 0;
text-align: center;
letter-spacing: 2px;
}
.pen-title h1 {
margin: 0 0 20px;
font-size: 48px;
font-weight: 300;
}
.pen-title span {
font-size: 12px;
}
.pen-title span .fa {
color: #33b5e5;
}
.pen-title span a {
color: #33b5e5;
font-weight: 600;
text-decoration: none;
}
/* Form Module */
.form-module {
position: relative;
background: #ffffff;
width: 100%;
border-top: 5px solid #33b5e5;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
margin: 0 auto;
align: right;
}
.form-module .toggle {
cursor: pointer;
position: absolute;
top: -0;
right: -0;
background: #33b5e5;
width: 30px;
height: 30px;
margin: -5px 0 0;
color: #ffffff;
font-size: 12px;
line-height: 30px;
text-align: center;
}
.form-module .toggle .tooltip {
position: absolute;
top: 5px;
right: -65px;
display: block;
background: rgba(0, 0, 0, 0.6);
width: auto;
padding: 5px;
font-size: 10px;
line-height: 1;
text-transform: uppercase;
}
.form-module .toggle .tooltip:before {
content: '';
position: absolute;
top: 5px;
left: -5px;
display: block;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-right: 5px solid rgba(0, 0, 0, 0.6);
}
.form-module .form {
display: none;
padding: 40px;
}
.form-module .form:nth-child(2) {
display: block;
}
.form-module h2 {
margin: 0 0 20px;
color: #33b5e5;
font-size: 18px;
font-weight: 400;
line-height: 1;
}
.form-module table {
width: 100%
}
.form-module input {
outline: none;
width: 80%;
border: 1px solid #d9d9d9;
padding: 10px 15px;
font-weight: 400;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.form-module input:focus {
border: 1px solid #33b5e5;
color: #333333;
}
.form-module button {
cursor: pointer;
background: #33b5e5;
width: 90%;
border: 0;
padding: 10px 15px;
color: #ffffff;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.form-module button:hover {
background: #178ab4;
}
.form-module select {
cursor: pointer;
width: 85%;
height:80%;
padding: 10px 15px;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.flag button {
background: white;
color: #178ab4;
}
.flag button:hover {
background: white;
border: 20px;
border-color: #178ab4;
}
.flag {
cursor: pointer;
background: white;
width: 100%;
border: 0;
padding: 10px 15px;
border-color: #178ab4;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.flag a {
cursor: pointer;
background: white;
width: 100%;
border: 0;
color: #33b5e5;
border-color: #178ab4;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.flag a :hover {
background: white;
}
.form-module .cta {
background: #f2f2f2;
width: 100%;
padding: 15px 40px;
box-sizing: border-box;
color: #666666;
font-size: 12px;
text-align: center;
}
.form-module .cta a {
color: #333333;
text-decoration: none;
}
.flex-container {
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row wrap;
flex-flow: row wrap;
align: right;
}
.flex-container > * {
padding: 0px;
-webkit-flex: 1 100%;
flex: 1 100%;
}
.dropbtn {
outline: none;
border:1;
width: 80%;
border: 1px solid #d9d9d9;
padding: 10px 15px;
font-size: 16px;
cursor: pointer;
}
.dropbtn:hover, .dropbtn:focus {
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f6f6f6;
min-width: 230px;
overflow: auto;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown a:hover {background-color: #ddd}
.show {display:block;}
ul{
list-style-type:none;
width:500px;
}
li{
width:33%;
text-align:center;
float:left;
border-bottom:2px solid #33b5e5;
}
Maybe instead of a 'table' use a 'list' html element like ul or li.
plunker
New HTML:
<div class="module form-module">
<div class="flex-container">
<article class="article">
<ul>
<li>
<button>Configurations</button>
</li>
<li>
<button>Create User </button>
</li>
<li>
<button>Update User</button>
</li>
</ul>
</article>
</div>
</div>
and add the following CSS:
ul{
list-style-type:none;
width:500px;
}
li{
width:33%;
text-align:center;
float:left;
border-bottom:2px solid #33b5e5;
}