positioning a button inside the input field - html

I want to place a button inside my input exactly like this:
So far I have the input but I'm unable to find a solution to place the button properly.
.realoutercontainer {
padding: 10% 0;
position:relative;
}
.outercontainer {
direction: rtl;
text-align: center;
position: relative;
z-index: 1;
max-width: 1040px;
margin: 0 auto;
width: 100%;
box-sizing: border-box;
border-bottom: 2px solid rgba(207,215,223,.25);
position: relative;
background-color: #fff;
border-radius: 30px;
padding: 30px 40px 10px 40px;
-webkit-box-shadow: 0 30px 60px -12px rgba(50,50,93,.25),0 18px 36px -18px rgba(0,0,0,.3);
box-shadow: 0 30px 60px -12px rgba(50,50,93,.25),0 18px 36px -18px rgba(0,0,0,.3);
box-sizing: border-box;
color: #6c6770;
font-family: "Vazir";
}
.realoutercontainer.settings{
padding: 2% 0;
}
.settings .outercontainer {
max-width: 100%;
width: 94%;
height: 600px;
padding: 100px;
padding-top: 50px;
}
.settings-input {
margin: 50px 0;
display: flex;
justify-content: center;
}
.settings-input input {
display: inline-block;
direction: ltr;
text-align: center;
outline: none;
width: 300px;
background: #ededed;
color: #743db0;
padding: 5px 5px;
border-radius: 3px;
border: solid 1px;
border-color: transparent;
transition: all 0.3s ease-in;
}
.settings-input input:focus {
color: #8e5bc5;
background: #fff;
border-color: #e7572c;
}
.settings-input .input-field {
display: flex;
flex-direction: column ;
}
.settings-input .uname{
align-self: flex-start;
margin-bottom: 3px;
}
<div class="realoutercontainer settings">
<div class="outercontainer">
<div class="settings-input">
<div class="input-field">
<div for="fname" class="uname">نام کاربری :</div>
<div><input type="text" id="fname" name="fname" placeholder="user_1252442"/></div>
<button type="submit">ویرایش</button>
</div>
</div>
</div>
</div>

div,
form,
input {
position: relative;
}
.container {
width: 400px;
display: flex;
padding: 0.5rem;
align-items: center;
background-color: coral;
}
input {
width: 100%;
padding: 1rem;
border: 1px solid black;
}
button {
position: absolute;
right: 1rem;
}
<form>
<label> نام کاربری : </label>
<br />
<div class="container">
<input type="text" placeholder="Some Text..." />
<button type="submit"> Submit </button>
</div>
</form>
You can change the styles or whatever you want accordingly. I showed how its done.

Here goes, follow the code, I hope it helps you.
It is not styled, it is in raw form.
input {
position: absolute;
height: 2.3em;
}
.group-wrapper {
width: 50em;
display: flex;
align-items: center;
}
.content {
padding-left: 7em;
background: #EDEDED;
border: none;
border-radius: 0.2em;
}
.uname {
margin:0 9em 0.5em;
display: inline-block;
-moz-transform: scale(-1, 1);
-webkit-transform: scale(-1, 1);
transform: scale(-1, 1);
}
button {
position: relative;
justify-content: start;
color: #E1E5ED;
background: #ED1C24;
padding: 0.4em;
margin-left: 0.5em;
border: none;
}
<form>
<label for="user" class="uname">نام کاربری :</label>
<div class="group-wrapper">
<input id="user" class="content" type="text" placeholder="user_1252442" />
<button type="submit">ویرایش</button>
</div>
</form>

Shamelessly borrowing from #Kunal, this version puts the button on the left as desired:
div,
form,
input {
position: relative;
}
.container {
width: 400px;
display: flex;
padding: 0.5rem;
align-items: center;
}
input {
width: 100%;
padding: 1rem;
padding-left: 100px;
border: 1px solid black;
}
button {
position: absolute;
left: 1rem;
}
<form>
<label> نام کاربری : </label>
<br />
<div class="container">
<input type="text" placeholder="Some Text..." />
<button> My button </button>
</div>
</form>

Related

How do I fit the borders in the input text type?

I want the border to align with the box , what is wrong with my code ? Any help would be appreciated .
.contact {
background-color: rgb(233, 230, 227);
height: 200px;
}
.contact h3 {
text-align: center;
}
.form {
text-align: center;
max-width: 344px;
width: 100%;
border: 1px solid grey;
transform: translatex(450px);
}
.form input {
width: 100%;
padding: 7px;
/* font-size: 20px;*/
border-radius: 5px;
margin-top: 30px;
}
<section class="contact">
<h3>
Contact Us
</h3>
<div class="form">
<input type="text" class="name" id="name">
</div>
</section>
Add box-sizing: border-box; to include the default or defined padding and border in the 100% width:
.contact {
background-color: rgb(233, 230, 227);
height: 200px;
}
.contact h3 {
text-align: center;
}
.form {
text-align: center;
max-width: 344px;
width: 100%;
border: 1px solid grey;
position: relative;
left: 50%;
transform: translatex(-50%);
}
.form input {
width: 100%;
padding: 7px;
/* font-size: 20px;*/
border-radius: 5px;
margin-top: 30px;
box-sizing: border-box;
}
<section class="contact">
<h3>
Contact Us
</h3>
<div class="form">
<input type="text" class="name" id="name">
</div>
</section>
P.S.: You obviously tried to center the form field horizontally. This probably might work the way you did it with the particular parent container width you are using, but I changed it to a more universally working method (see the three parameters added/changed in the .form CSS rule)
You would need a box-sizing: border-box. I recommend you to set this for all your HTML elements. It would save you a lot of time, like so:
*{
box-sizing: border-box; /* that is all you are missing*/
}
.contact {
background-color: rgb(233, 230, 227);
height: 200px;
}
.contact h3 {
text-align: center;
}
.form {
text-align: center;
max-width: 344px;
width: 100%;
border: 1px solid grey;
transform: translatex(450px);
}
.form input {
width: 100%;
padding: 7px;
/* font-size: 20px;*/
border-radius: 5px;
margin-top: 30px;
}
<section class="contact">
<h3>
Contact Us
</h3>
<div class="form">
<input type="text" class="name" id="name">
</div>
</section>
Add border-box set border on only input that will be fit.
.contact {
background-color: rgb(233, 230, 227);
height: 200px;
}
.contact h3 {
text-align: center;
}
.form {
max-width: 344px;
padding: 7px;
width: 100%;
position: relative;
left: 50%;
transform: translatex(-50%);
}
.form input[type=text] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
border: 1px solid red;
border-radius: 5px;
}
<section class="contact">
<h3>
Contact Us
</h3>
<div class="form">
<input type="text" class="name" id="name">
</div>
</section>

How to make an input element take up all available vertical space?

I'm currently working on a calculator in HTML and have made a form to input various numbers. The form is located in a div that's a sidebar, and I've made a div for each row holding an input and label. However, the input elements are left with a lot of space above them, as well as the borders as they're attached to the input elements. How could I allow the inputs to take up all available vertical space? Picture of extra space
.sidebar {
background-color: #272640;
float: left;
width: 20%;
height: 100%;
position: fixed;
box-sizing: border-box;
display: flex;
flex-direction: column;
border: 1px solid #3E1F47;
}
#sidebarCentered {
}
.siderow {
background-color: #312244;
border-top: 1px solid #3E1F47;
color: white;
padding: 10px;
box-sizing: border-box;
width: 50% text-align:center;
font-family: monaco;
}
.siderow label {}
.siderow input {
box-sizing: border-box;
background-color: #312244;
border: 0px;
height: 100%;
border-left: 1px solid #5A5766;
color: white;
width: 50%;
float: right;
text-align: center;
}
.sidebarbuttons {
background-color: #312244;
margin-top: 10%;
}
.sidebarbuttons input {
background-color: #312244;
font-family: monaco;
font-size: 15px;
margin: 5px;
width: 45%;
color: white;
padding: 10px;
border: 1px solid #3E1F47;
border-radius: 10px;
transition: all ease-in-out 0.15s;
}
.sidebarbuttons input:hover {
background-color: #272640;
color: #272640;
transition: all ease-in-out 0.15s;
}
#centermenu {
background-color: #212F45;
color: #EDFFEC;
overflow: hidden;
text-decoration: none;
border-bottom: 1px solid #5A5766;
box-sizing: border-box;
}
<div class="sidebar">
<form id="sidebarCentered">
<div class="siderow">
<label for="balance">Balance:</label>
<input type="number" name="balance" value=500>
</div>
<div class="siderow">
<label for="monthly">Monthly <br> contribution:</label>
<input type="number" name="monthly" value=0>
</div>
<div class="siderow">
<label for="nummonths">Number of <br> Months:</label>
<input type="number" name="nummonths" value=12>
</div>
<div class="siderow" style="border-bottom:1px solid #3E1F47;">
<label for="ror">Monthly Rate <br> of Return:</label>
<input type="number" name="ror" value=1>
</div>
<div class="sidebarbuttons">
<input type="button" value="Calculate" style="float:left;">
<input type="button" value="Quit" style="float:right;">
</div>
</form>
</div>
That space is caused by padding of 10px in .siderow. I changed the padding to 0 10px which sets top and bottom padding to zero and left/right to 10px. I also added min-width: 200px; to .sidebar for clarity. You may want to change that. Extra vertical space has been removed.
.sidebar {
background-color: #272640;
float: left;
width: 20%;
min-width: 200px;
height: 100%;
position: fixed;
box-sizing: border-box;
display: flex;
flex-direction: column;
border: 1px solid #3E1F47;
}
#sidebarCentered {
}
.siderow {
background-color: #312244;
border-top: 1px solid #3E1F47;
color: white;
padding: 0 10px; /* changed here */
box-sizing: border-box;
width: 50% text-align:center;
font-family: monaco;
}
.siderow label {}
.siderow input {
box-sizing: border-box;
background-color: #312244;
border: 0px;
height: 100%;
border-left: 1px solid #5A5766;
color: white;
width: 50%;
float: right;
text-align: center;
}
.sidebarbuttons {
background-color: #312244;
margin-top: 10%;
}
.sidebarbuttons input {
background-color: #312244;
font-family: monaco;
font-size: 15px;
margin: 5px;
width: 45%;
color: white;
padding: 10px;
border: 1px solid #3E1F47;
border-radius: 10px;
transition: all ease-in-out 0.15s;
}
.sidebarbuttons input:hover {
background-color: #272640;
color: #272640;
transition: all ease-in-out 0.15s;
}
#centermenu {
background-color: #212F45;
color: #EDFFEC;
overflow: hidden;
text-decoration: none;
border-bottom: 1px solid #5A5766;
box-sizing: border-box;
}
<div class="sidebar">
<form id="sidebarCentered">
<div class="siderow">
<label for="balance">Balance:</label>
<input type="number" name="balance" value=500>
</div>
<div class="siderow">
<label for="monthly">Monthly <br> contribution:</label>
<input type="number" name="monthly" value=0>
</div>
<div class="siderow">
<label for="nummonths">Number of <br> Months:</label>
<input type="number" name="nummonths" value=12>
</div>
<div class="siderow" style="border-bottom:1px solid #3E1F47;">
<label for="ror">Monthly Rate <br> of Return:</label>
<input type="number" name="ror" value=1>
</div>
<div class="sidebarbuttons">
<input type="button" value="Calculate" style="float:left;">
<input type="button" value="Quit" style="float:right;">
</div>
</form>
</div>
Give .siderow padding of 0 and add a height to .siderow input and .siderow label.
Next, delete those br tags and add flex to .siderow label so it can be vertically aligned in the middle. Also, don't use inline css.
In all, you will have this:
<div class="sidebar">
<form id="sidebarCentered">
<div class="siderow">
<label for="balance">Balance:</label>
<input type="number" name="balance" value=500>
</div>
<div class="siderow">
<label for="monthly">Monthly contribution:</label>
<input type="number" name="monthly" value=0>
</div>
<div class="siderow">
<label for="nummonths">Number of Months:</label>
<input type="number" name="nummonths" value=12>
</div>
<div class="siderow">
<label for="ror">Monthly Rate of Return:</label>
<input type="number" name="ror" value=1>
</div>
<div class="sidebarbuttons">
<input type="button" value="Calculate" style="float:left;">
<input type="button" value="Quit" style="float:right;">
</div>
</form>
</div>
and the CSS
.sidebar {
background-color: #272640;
float: left;
width: 400px;
height: 100%;
position: fixed;
box-sizing: border-box;
display: flex;
flex-direction: column;
border: 1px solid #5A5766;
}
#sidebarCentered {
}
.siderow {
border-top: 1px solid #5A5766;
color: white;
padding: 0;
box-sizing: border-box;
width: 100%;
text-align:center;
font-family: monaco;
height: auto;
float: left;
}
.siderow:first-child {
border-top: none;
}
.siderow:nth-child(4) {
border-bottom: 1px solid #5A5766;
}
.siderow label {
width: calc(50% - 5px);
float: left;
height: 40px;
display: flex;
align-items: center;
margin-left: 5px;
}
.siderow input {
box-sizing: border-box;
background-color: #272640;
border: 0;
height: 100%;
border-left: 1px solid #5A5766;
color: white;
width: 50%;
float: left;
text-align: center;
height: 40px;
}
.sidebarbuttons {
margin-top: 10%;
}
.sidebarbuttons input {
background-color: #888;
font-family: monaco;
font-size: 15px;
margin: 5px;
width: 45%;
color: white;
padding: 10px;
border: 1px solid #5A5766;
border-radius: 10px;
transition: all ease-in-out 0.15s;
}
.sidebarbuttons input:hover {
background-color: #ccc;
color: #272640;
transition: all ease-in-out 0.15s;
}
#centermenu {
background-color: #212F45;
color: #EDFFEC;
overflow: hidden;
text-decoration: none;
border-bottom: 1px solid #5A5766;
box-sizing: border-box;
}
Link to Fiddle for reference https://jsfiddle.net/kavyw86d/

Custom shaped buttons for menu

I am trying to achieve this effect which I got on image. I am having trouble in creating custom shapes. Could someone assist me with this please?
body {
margin: 0;
}
.container {
display: flex;
width: 100%;
height: 100vh;
}
.menu {
background: lightgray;
flex: 0.1;
display: flex;
flex-direction: column;
padding-left: 15px;
}
.numbers {
background: #79726c;
border: none;
transform: skewY(10deg);
}
.content {
flex: 1;
background: blue;
}
<div class="container">
<div class="menu">
<button class="first">Start
</button>
<button class="numbers">1
</button>
<button class="numbers">2
</button>
</div>
<div class="content">
</div>
</div>
If you were only interested in the visual component, then it turned out quite similar:
body {
margin: 0;
display: flex;
justify-content: space-around;
align-items: center;
min-height: 100vh;
background-color: #312a28;
background-image: url("https://cdn.pixabay.com/photo/2016/11/27/05/02/texture-1862140_960_720.jpg");
}
.container {
position: relative;
display: flex;
height: 626px; width: 70vw;
}
.tabs {
position: relative;
top: 124px;
display: flex;
flex-flow: column nowrap;
justify-content: space-between;
height: 464px; width: 66px;
user-select: none;
}
.tabs>input {
position: absolute !important;
height: 1px !important;
width: 1px !important;
border: none !important;
padding: 0 !important;
margin: 0 !important;
white-space: nowrap !important;
overflow: hidden !important;
clip: rect(1px, 1px, 1px, 1px) !important;
}
.tab {
position: relative;
left: 6px;
height: 34px; width: 66px;
border: none;
box-sizing: border-box;
font-size: 40px; line-height: 34px;
font-family: sans-serif; font-weight: bold;
text-align: center;
color: #f9f9f7;
background-color: #79726c;
filter: drop-shadow(-2px 8px 4px #0008);
transition: 0.3s ease;
}
.tab:nth-of-type(1) { z-index: 6; }
.tab:nth-of-type(2) { z-index: 5; }
.tab:nth-of-type(3) { z-index: 4; }
.tab:nth-of-type(4) { z-index: 3; }
.tab:nth-of-type(5) { z-index: 2; }
.tab:nth-of-type(6) { z-index: 1; }
.tab:nth-of-type(7) { z-index: 0; }
.tab::before,
.tab::after {
content: "";
position: absolute;
left: 0; z-index: -1;
width: 100%;
border-radius: 6px 4px 4px 6px;
background-color: inherit;
background-image: inherit;
}
.tab::before {
bottom: 16px; height: 126px;
transform: skewy(-28deg);
}
.tab::after {
top: 16px; height: 40px;
transform: skewy(28deg);
}
.tabs > input:not(:checked) + .tab:hover {
background-color: #aba5a0;
cursor: pointer;
}
.tabs > input:checked + .tab {
left: 0; z-index: 7;
background-color: #d8cec1;
background-image: url("https://cdn.pixabay.com/photo/2016/11/08/03/16/seamless-1807376_960_720.jpg");
color: #393534;
}
.tab .vertical {
position: absolute;
left: 10px; top: -85px;
transform: rotate(-90deg);
font-size: 12px;
text-transform: uppercase;
text-shadow: 0 0 2px currentcolor;
}
.content {
position: relative;
left: -3px; z-index: 8;
flex: 1;
border-radius: 6px;
background-color: #d8cec1;
background-image: url("https://cdn.pixabay.com/photo/2016/11/08/03/16/seamless-1807376_960_720.jpg");
box-shadow: 2px 13px 6px -4px #0008;
}
<section class="container">
<div class="tabs">
<input type="radio" name="tabs" id="tab0" checked><label for="tab0" class="tab"><span class="vertical">Start</span></label>
<input type="radio" name="tabs" id="tab1"><label for="tab1" class="tab">1</label>
<input type="radio" name="tabs" id="tab2"><label for="tab2" class="tab">2</label>
<input type="radio" name="tabs" id="tab3"><label for="tab3" class="tab">3</label>
<input type="radio" name="tabs" id="tab4"><label for="tab4" class="tab">4</label>
<input type="radio" name="tabs" id="tab5"><label for="tab5" class="tab">5</label>
<input type="radio" name="tabs" id="tab6"><label for="tab6" class="tab">6</label>
</div>
<div class="content"></div>
</section>
enter image description here
hello,I tried a little and made this one.I think this structure can be useful for you.
Code:
enter code here
<div class="container">
<div class="menu">
<button class="first">Start
</button>
<button class="numbers" id="btn-top-shadow">1
</button>
<button class="numbers">2
</button>
<button class="numbers">3
</button>
<button class="numbers">4
</button>
<button class="numbers">5
</button>
<button class="numbers">6
</button>
<button class="numbers">7
</button>
</div>
<div class="content">
</div>
</div>
body {
margin: 0;
}
.container {
display: flex;
width: 100%;
height: 100vh;
}
.first
{
transform: rotate(270deg) scale(4.5) ;
position: relative;
top:10%;
font-size: 4px;
}
.menu {
background: lightgray;
flex: 0.1;
display: flex;
flex-direction: column;
padding-left: 15px;
}
.numbers {
background: #79726c;
border: none;
transform: skewY(10deg);
width: 38%;
position: relative;
left: 38px;
top: 110px;
color: white;
text-shadow: 0px 7px 3px black;
height: 5%;
border-bottom: 0.4px solid black
}
#btn-top-shadow
{
box-shadow: 0px -7px 7px black;
}
.content {
flex: 1;
background: blue;
}
To achieve the shape you want on the first button. Use two buttons!
Assign the same scripts!
https://www.codegrepper.com/code-examples/css/css+triangle+button
Here's some details on how to make the triangle part!
Good luck!

Adjust text input position in input box

How do I adjust the text input position in the input box? I did do input[type=text] but it messes up my input box's position completely. I did change my ::placeholder left margin a little bit in case if you want to know.
HTML & CSS
.registerbox {
width: 500px;
height: 450px;
background: rgba(255, 255, 255, 0.7);
margin: 10px auto;
border-radius: 20px;
box-shadow: 0 0 40px 10px rgba(0, 0, 0, 0.6);
color: white;
}
.inner-registerbox {
position: relative;
width: 100%;
height: 100%;
}
.registerbox-front {
position: absolute;
height: 100%;
width: 100%;
padding: 55px;
box-sizing: border-box;
border-radius: 14px;
}
input label {
display: block;
}
.registerbox h2 {
text-align: center;
font-size: 25px;
font-weight: normal;
margin-bottom: 20px;
margin-top: 0;
color: black;
}
.input-box2 {
width: 95%;
background: transparent;
border: 1px solid black;
height: 32px;
border-radius: 5px;
padding: 0 0px;
box-sizing: border-box;
outline: none;
text-align: left;
color: black;
display: table;
margin-top: 2px;
margin-bottom: 15px;
}
.input-box3 {
width: 105%;
background: transparent;
border: 1px solid black;
height: 32px;
border-radius: 5px;
padding: 0 0px;
box-sizing: border-box;
outline: none;
text-align: left;
color: black;
display: table;
margin-top: 2px;
margin-bottom: 15px;
}
.registerbox-front ::placeholder {
padding-left: 10px;
}
.box-firstline, .box-secondline {
margin-top: 10px
}
<body>
<div class="registerbox">
<div class="inner-registerbox">
<div class="registerbox-front">
<h2>BORANG PENDAFTARAN MURID</h2>
<form>
<section>
<div class="box-firstline">
<div style="float:left;margin-right:25px;">
<label for="idmurid">ID Murid</label> <br />
<input type="text" name="idmurid" class="input-box2" placeholder="ID Murid" required>
</div>
<div style="float:left;">
<label for="namamurid">Nama Murid</label> <br />
<input type="text" name="namamurid" class="input-box3" placeholder="Nama Murid" required>
</div>
</div>
<br style="clear:both;" />
</section>
<div class="box-secondline">
<div style="float:left;margin-right:25px;">
<label for="namakelas">Nama Kelas</label> <br />
<input type="text" name="namakelas" class="input-box2" placeholder="Nama Kelas" required>
</div>
<div style="float:left;">
<label for="katalaluan_murid">Kata Laluan</label> <br />
<input type="password" name="katalaluan_murid" class="input-box3" placeholder="Katalaluan" required>
</div>
<br style="clear:both;" />
</div>
</div>
</div>
</body>
I took the code you posted, removed the ::placeholder padding and then added
input[type="text"] {
padding-left: 10px;
}
input[type="password"] {
padding-left: 10px;
}
And it adjusted the the text to match the placeholder.
Here is the full CSS:
.registerbox {
width: 500px;
height: 450px;
background: rgba(255, 255, 255, 0.7);
margin: 10px auto;
border-radius: 20px;
box-shadow: 0 0 40px 10px rgba(0, 0, 0, 0.6);
color: white;
}
input[type="text"] {
padding-left: 10px;
}
input[type="password"] {
padding-left: 10px;
}
.inner-registerbox {
position: relative;
width: 100%;
height: 100%;
}
.registerbox-front {
position: absolute;
height: 100%;
width: 100%;
padding: 55px;
box-sizing: border-box;
border-radius: 14px;
}
input label {
display: block;
}
.registerbox h2 {
text-align: center;
font-size: 25px;
font-weight: normal;
margin-bottom: 20px;
margin-top: 0;
color: black;
}
.input-box2 {
width: 95%;
background: transparent;
border: 1px solid black;
height: 32px;
border-radius: 5px;
padding: 0 0px;
box-sizing: border-box;
outline: none;
text-align: left;
color: black;
display: table;
margin-top: 2px;
margin-bottom: 15px;
}
.input-box3 {
width: 105%;
background: transparent;
border: 1px solid black;
height: 32px;
border-radius: 5px;
padding: 0 0px;
box-sizing: border-box;
outline: none;
text-align: left;
color: black;
display: table;
margin-top: 2px;
margin-bottom: 15px;
}
.box-firstline, .box-secondline {
margin-top: 10px;
}

DIV element breaking out of parent element

I have a split screen HTML page. There are three DIVs in a horizontal flex layout, with a left and right pane for content. The button bar on the left pane is set at 100% width, but it's overflowing the parent element. What could be the cause of this?
Here's a dump of the innerHTML
body {
padding: 0px;
margin: 0px;
background-color: rgb(200, 210, 80);
font-family: 'Droid Sans', sans-serif;
}
.colsplit {
height: 12px;
width: 100%;
background-color: white;
background-image: url("http://www.vitacoll.co.uk/assets/images/splitterv.png");
background-repeat: no-repeat;
background-position: center;
cursor: ns-resize;
}
.rowsplit {
height: 100%;
width: 12px;
background-color: white;
background-image: url("http://www.vitacoll.co.uk/assets/images/splitterh.png");
background-repeat: no-repeat;
background-position: center;
cursor: ew-resize;
}
.top {
overflow: auto;
}
.treeul {
list-style: none;
user-select: none;
-moz-user-select: none;
}
.treeli {
margin: 3px;
list-style-type: none;
}
.treeli span:first-of-type {
user-select: none;
font-weight: bold;
cursor: pointer;
}
.folderselected {
background-color: blue;
color: white;
}
.fileselected {
margin: 3px;
background-color: blue;
color: green;
}
.loading {
z-index: 100;
position: fixed;
height: 100%;
width: 100%;
background-color: rgba(255, 255, 255, 1);
cursor: wait;
}
.blankout {
opacity: 0;
z-index: -10;
position: fixed;
display: flex;
height: 100%;
width: 100%;
background-color: rgba(255, 255, 255, 0.6);
justify-content: center;
align-items: center;
}
.square {
padding: 15px;
background-color: rgb(232, 123, 4);
border: 1px solid;
}
.square p {
display: flex;
}
.square label {
flex-basis: 30%;
text-align: right;
padding: 5px;
}
.tabselected {
-moz-user-select: none;
background-color: #b3c3dd;
color: white;
flex-basis: auto;
padding: 5px;
border-radius: 8px 8px 0px 0px;
}
.tabnormal {
-moz-user-select: none;
background-color: #37588e;
color: white;
flex-basis: auto;
padding: 5px;
border-radius: 8px 8px 0px 0px;
}
#category_props {}
#category_items {
display: none;
}
#rightpane {
display: flex;
flex-direction: column;
}
#content {
background-color: #b3c3dd;
}
#tabs {
display: flex;
flex-direction: row;
width: 100%;
margin: 7px 7px 0px 7px;
}
#treepane {
width: 100%;
display: flex;
flex-direction: column;
}
#treemenubuttonbar {
border: 3px solid;
padding: 10px;
width: 100%;
display: flex;
flex-direction: row;
justify-content: center;
}
#treemenubuttonbar button {
display: block;
flex-base: auto;
}
#treecontroller {
width: 100%;
flex-base: auto;
overflow: auto;
}
#split1 {
padding: 0px;
border: 0px;
position: absolute;
width: 100%;
height: 100%;
}
<div id="split1" style="display: flex; flex-direction: row;">
<div id="treepane" style="display: flex; flex-basis: 406px;">
<div id="treemenubuttonbar">
<button id="buttonadd">add</button><button id="buttondelete">delete</button>
<button id="buttonrefresh">refresh</button>
</div>
<div id="treecontroller">
<ul class="treeul">
<li class="treeli" data-id="1">
<div data-closed="true"><span>[+]</span><span>root</span></div>
<ul style="display: none;">
<li class="treeli" data-id="2">Vitamins</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="rowsplit" data-before="0" data-after="1"></div>
<div id="rightpane" style="display: flex; flex-basis: 948px;">
<div id="tabs">
<div data-id="1" class="tabselected">Category Properties</div>
<div data-id="2" class="tabnormal">Category Products</div>
</div>
<div id="category_props" style="display:none">
<form id="categorypropform">
<input name="base" type="hidden">
<p><label for="title2">Catergory Title:</label><input name="title2" required="" minlength="1" maxlength="50" type="text"></p>
<p><label for="shortname2">Shortname:</label><input name="shortname2" required="" minlength="1" maxlength="10" type="text"></p>
<p><button name="create2">Create</button></p>
<p><button name="cancel2">Cancel</button></p>
</form>
</div>
<div id="category_items"></div>
</div>
</div>
<div id="newcategory" class="blankout">
<div class="square">
<form id="newcategoryform">
<input name="base" value="" type="hidden">
<p><label for="title">Catergory Title:</label><input name="title" required="" minlength="1" maxlength="50" type="text"></p>
<p><label for="shortname">Shortname:</label><input name="shortname" required="" minlength="1" maxlength="10" type="text"></p>
<p><button name="create">Create</button></p>
<p><button name="cancel">Cancel</button></p>
</form>
</div>
</div>
Your button is being pushed over because of its padding.
2 options:
Remove the padding.
Add box-sizing: border-box; to your button container.
Try changing the width value to auto for #threebuttonbar:
#treemenubuttonbar {
border: 3px solid;
padding: 10px;
width: auto;
display: flex;
flex-direction: row;
justify-content: center;
}