online div not side by side - html

I have this code below. I have one container div with 2 inner div. I want the two inner divs to be side by side so I used in-line block on the two divs. Also I want the two divs to be start on top. In the demo below they are stuck on top and I dont know why while in my own project they are side by side but first div starts on top while second div does not start on top.
What is the best css style to make the 2 div in a container start on top while it is side by side?
What is the best way to make two div side by side?
.homissync {
display: block;
height: 100%;
}
.homissync>div {
padding: 27px;
margin: 3px;
display: inline-block;
}
#homissyncbuttons {
height: 100vh;
width: 20%;
margin: 3px;
}
#homissynclist {
height: 100vh;
margin: 3px;
width: 68%;
}
#homissyncbuttons .libuttons {
width: 100% !important;
background-color: #ff0000;
}
.vBorder {
border: solid 1px #ddd;
}
button, input[type=submit] {
padding: 8px 20px;
color: #fff;
text-shadow: 0 0 2px rgba(0,0,0,0.35);
background-color: orange;
font-size: 0.9rem;
font-weight: bold;
border-radius: 3px;
border: 0;
outline: none !important;
margin: 3px 0;
cursor: pointer;
transition: background 1s ease-in-out;
}
<div class=" homissync">
<div id="homissyncbuttons" class=" vBorder">
<ul>
<li>
<button class="libuttons">UACS</button>
</li>
<li>
<button class="libuttons">Medicine</button>
</li>
<li>
<button class="libuttons">Non-Drugs</button>
</li>
<li>
<button class="libuttons">Miscellaneous</button>
</li>
</ul>
</div>
<div id="homissynclist" class=" vBorder">
<button class="listbuttons" id="new_uacs_entry">New UACS Entry</button>
<button class="listbuttons" id="update_uacs_entry">Update UACS Entry</button>
<div id="homissynclistresult" class=" vPadding vBorder">
</div>
</div>
</div>

Please try this code instead of the display:inline-block; and just add float:left.
.homissync>div {
display: block;
float: left;
}

you can use float: left; instead of display: inline-block;
.homissync {
display: block;
height: 100%;
}
.homissync>div {
padding: 27px;
margin: 3px;
float:left;
}
#homissyncbuttons {
height: 100vh;
width: 20%;
margin: 3px;
}
#homissynclist {
height: 100vh;
margin: 3px;
width: 65%;
}
#homissyncbuttons .libuttons {
width: 100% !important;
background-color: #ff0000;
}
.vBorder {
border: solid 1px #ddd;
}
button, input[type=submit] {
padding: 8px 20px;
color: #fff;
text-shadow: 0 0 2px rgba(0,0,0,0.35);
background-color: orange;
font-size: 0.9rem;
font-weight: bold;
border-radius: 3px;
border: 0;
outline: none !important;
margin: 3px 0;
cursor: pointer;
transition: background 1s ease-in-out;
}
<div class=" homissync">
<div id="homissyncbuttons" class=" vBorder">
<ul>
<li>
<button class="libuttons">UACS</button>
</li>
<li>
<button class="libuttons">Medicine</button>
</li>
<li>
<button class="libuttons">Non-Drugs</button>
</li>
<li>
<button class="libuttons">Miscellaneous</button>
</li>
</ul>
</div>
<div id="homissynclist" class=" vBorder">
<button class="listbuttons" id="new_uacs_entry">New UACS Entry</button>
<button class="listbuttons" id="update_uacs_entry">Update UACS Entry</button>
<div id="homissynclistresult" class=" vPadding vBorder">
</div>
</div>
</div>

display:inline-block have default white space, you need to remove the white space. otherwise you need to relace the display-inline-block with float:left , there is so many options to remove the white space please check the reference link below
Why is there an unexplainable gap between these inline-block div elements?

Related

how to make a div grow in width when the contents inside it are positioned absolute

I have a div inside which there is a text which has a subtitle that must always be positioned on the bottom right in this manner
I achieved this by making the parent div relative and the contents inside it as absolute.But the upper text can grow to whatever length and i want the parent div to expand with it and not overlay other elements which it is doing as shown in the image
Here is what i tried.
header {
height: 60px;
padding: 0 12px;
background: #fff;
position: fixed;
width: calc(100% - 24px);
z-index: 999999; // no z-index values above this for any body elements
box-shadow: 7px -9px 6px 6px $black;
left: 0;
li {
float: right;
display: block;
margin-left: 20px;
padding: 20px 0;
width: 18px;
text-align: right;
i {
color: $icon-grey;
font-size: $header-icon-size;
cursor: pointer;
&.fa-times {
color: $icon-red;
}
&.notify{
color: gold;
}
&.fa-caret-down{
color: gold;
}
}
img{
width: 40px;
height: 40px;
border-radius: 50%;
margin-top: -0.7em;
object-fit: cover;
object-position: center right;
}
}
.user-info {
text-align: right;
display: inline-block;
margin-top: -0.5em;
h5{
color: $section;
}
span{
color: $icon-grey;
font-size: 14px;
}
}
.user-details{
margin-right: 15px;
}
}
<header>
<li>
<i class="fas fa-caret-down"></i>
</li>
<li>
<img src="{{user.image}}">
</li>
<li>
<div class="user-info">
<h4>Smith</h4>
<p>CAD</p>
</div>
</li>
<li class="notification-menu">
<i class="fas fa-bell"></i>
</li>
</header>
All elements inside header are aligned on the right side.
I could not find any solution that just uses css.
Just use text-align:right...it seems to be adequate. No need for extra fancy layout options unless there is more to this than it appears.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
::before,
::after {
box-sizing: inherit;
}
.user-info {
text-align: right;
display: inline-block;
border: 1px solid grey;
}
<div class="user-info">
<h4>Smith</h4>
<p>CAD</p>
</div>
<div class="user-info">
<h4>Longer name - Smith</h4>
<p>CAD</p>
</div>
<div class="user-info">
<h4>Smith</h4>
<p>Longer Initials CAD</p>
</div>

How to place navbar menu below logo?

I have built this header using custom CSS and bootstrap class names. I have tried z-index, float: initial properties already. Thanks in advance
.branding-preview {
height: 75px;
margin-left: 15px;
margin-right: 15px;
background-color: #0071bb;
}
.branding-logo {
float: left;
height: 50px;
font-size: 18px;
padding: 15px 15px;
}
.branding-logo img {
width: 300px;
height: 50px;
}
.branding-powered-by-logo {
float: right;
height: 50px;
color: white;
font-size: 15px;
padding: 2px 10px;
}
.preview-menu {
margin: 30px 0 0 0;
}
.preview-menu > li > a {
margin: 0 3px;
color: white;
text-transform: uppercase;
border-bottom: solid 1px transparent;
background-color: transparent !important;
}
<div class="branding-preview">
<div class="branding-logo">
<img id="branding-logo" src="/path/to/logo">
</div>
<div class="branding-powered-by-logo">
<span>Powered By</span>
<img id="branding-powered-by-logo" src="/path/to/logo" height="30">
</div>
<ul class="navbar-nav navbar-right nav preview-menu">
<li><a>Start</a></li>
<li><a>Plan</a></li>
<li><a>Manage</a></li>
<li><a>Learn</a></li>
<li><a>Admin</a></li>
</ul>
</div>
This is the result that I am getting with the current code,
actual result:
This is what I'm hoping it will look like, expected result:
Isn't simple without all the css rules, but the concept is: Create a wrapper floated to right and inside create 2 lines, one for the branding-powered-by-logo and display:block the second line is depend from actual CSS but probably works without modify anything.
If you can post the real page we can help you with more precision.
Hope this help you.
.branding-preview {
display:block;
height: 75px;
margin-left: 15px;
margin-right: 15px;
background-color: #0071bb;
}
.branding-logo {
float: left;
height: 50px;
font-size: 18px;
padding: 15px 15px;
}
.branding-logo img {
width: 300px;
height: 50px;
}
.branding-powered-by-logo {
/* ADDED */
display:block;
text-align:right;
height: 50px;
color: white;
font-size: 15px;
padding: 2px 10px;
}
.preview-menu {
margin: 0px 0 0 0;
}
.preview-menu > li > a {
margin: 0 3px;
color: white;
text-transform: uppercase;
border-bottom: solid 1px transparent;
background-color: transparent !important;
}
/* ADDED */
.wrapper-logo-navbar {
float: right;
}
.preview-menu > li {
display: inline-block;
}
<div class="branding-preview">
<div class="branding-logo">
<img id="branding-logo" src="/path/to/logo">
</div>
<div class="wrapper-logo-navbar">
<div class="branding-powered-by-logo">
<span>Powered By</span>
<img id="branding-powered-by-logo" src="https://cdn.pixabay.com/photo/2012/05/02/19/27/head-46086_960_720.png" height="30">
</div>
<ul class="navbar-nav navbar-right nav preview-menu">
<li><a>Start</a></li>
<li><a>Plan</a></li>
<li><a>Manage</a></li>
<!-- removed some elements for the rendering on StackOverflow -->
</ul>
</div>
</div>
I think you just need add
position:absolute; right:0px;
to your .preview-menu class.

How to make span wrap words without defining a width or max-width on the container div?

I have the following partially generated generated and simplified code which is used to display warnings or errors in Dojo dialogs:
/*Relevant CSS:*/
.l-status-message-wrapper {
height: auto;
margin-left: 5px;
margin-top: 2px;
min-height: 15px;
}
.l-status-message-wrapper--dialog {
margin-left: 0px;
display: block;
word-wrap: break-word;
}
.c-global-message {
min-height: 15px;
color: #a5cf42;
font-size: 11px;
font-weight: bold;
text-transform: uppercase;
}
.c-global-message--error {
color: #e31d25;
}
.dijitDialog {
background: #eee;
border: 1px solid #d3d3d3;
-webkit-box-shadow: 0 5px 10px #adadad;
padding: 0;
}
.dijitDialog {
position: absolute;
z-index: 999;
overflow: hidden;
}
.dijitDialogTitleBar {
background: #C9CFD2 url(../../images/onglet_bg.gif) repeat-x;
vertical-align: middle;
}
.dijitDialogTitleBar {
background: #fafafa url(images/titleBar.png) repeat-x top left;
padding: 5px 6px 3px 6px;
outline: 0;
}
.dijitDialogTitleBar {
cursor: move;
}
form {
width: 200px;
height: 200px;
background-color: green;
}
<div class="dijitDialog dijitDialogFocused dijitFocused" role="dialog" aria-labelledby="machineParameterDialog_title" id="machineParameterDialog" widgetid="machineParameterDialog">
<div data-dojo-attach-point="titleBar" class="dijitDialogTitleBar">
<span data-dojo-attach-point="titleNode" class="dijitDialogTitle" id="machineParameterDialog_title" role="heading" level="1">Edit Machine Parameter</span>
<span data-dojo-attach-point="closeButtonNode" class="dijitDialogCloseIcon" data-dojo-attach-event="ondijitclick: onCancel" title="Cancel" role="button" tabindex="0">
<span data-dojo-attach-point="closeText" class="closeText" title="Cancel">x</span>
</span>
</div>
<div data-dojo-attach-point="containerNode" class="dijitDialogPaneContent" style="width: auto; height: auto;">
<div id="machineParameterDialogContents" class="machineParameterDialogContents">
<span class="l-status-message-wrapper l-status-message-wrapper--dialog">
<span id="machineParameterDialogStatus" class="c-global-message c-global-message--error">
error: <span>Action not successful. Please correct the validation errors</span>
</span>
</span>
<form id="machineParameterDialogForm" name="machineParameterDialogForm" action="/machineParameterAction.action" method="POST" class="c-panel-dialog">
</form>
</div>
</div>
</div>
I'd like long text in .l-status-message-wrapper--dialog to not increase the width of the .machineParameterDialogContents div.
However, I'd rather not give the .machineParameterDialogContents div or any of the parent divs a width or max-width. I want the container to adjust the width based on the widest element AFTER the component with long text, which can vary on a page by page basis and sometimes even be different on the same page for the same dialog depending on what action is being performed. To clarify: It's the outside .machineParameterDialogContents div I don't want to widen, not the .l-status-message-wrapper--dialog span. That span should widen to at most the size of any other components in the page. Also, everything inside the machineParameterDialogContents div is loaded through Ajax, in case it's relevant.
So in the above example, I don't want the span to be more than 200px, and the rest should automatically wrap, but I want this without defining a max-width on the span or the machineParameterDialogContents div. Note that I have given the form a fixed width, but in reality this width can change between dialog loads and is pretty dynamic.
Is this at all possible? I need to support Chrome, Firefox and IE11.
The simplest add to what you already had is to just add
max-width: fit-content to .l-status-message-wrapper--dialog
and it makes the text fit the available width and doesn't add to the overall width
/*Relevant CSS:*/
.l-status-message-wrapper {
height: auto;
margin-left: 5px;
margin-top: 2px;
min-height: 15px;
}
.l-status-message-wrapper--dialog {
margin-left: 0px;
display: block;
max-width: fit-content;
}
.c-global-message {
min-height: 15px;
color: #a5cf42;
font-size: 11px;
font-weight: bold;
text-transform: uppercase;
}
.c-global-message--error {
color: #e31d25;
}
.dijitDialog {
background: #eee;
border: 1px solid #d3d3d3;
-webkit-box-shadow: 0 5px 10px #adadad;
padding: 0;
}
.dijitDialog {
position: absolute;
z-index: 999;
overflow: hidden;
}
.dijitDialogTitleBar {
background: #C9CFD2 url(../../images/onglet_bg.gif) repeat-x;
vertical-align: middle;
}
.dijitDialogTitleBar {
background: #fafafa url(images/titleBar.png) repeat-x top left;
padding: 5px 6px 3px 6px;
outline: 0;
}
.dijitDialogTitleBar {
cursor: move;
}
form {
width: 200px;
height: 200px;
background-color: green;
}
<div class="dijitDialog dijitDialogFocused dijitFocused" role="dialog" aria-labelledby="machineParameterDialog_title" id="machineParameterDialog" widgetid="machineParameterDialog">
<div data-dojo-attach-point="titleBar" class="dijitDialogTitleBar">
<span data-dojo-attach-point="titleNode" class="dijitDialogTitle" id="machineParameterDialog_title" role="heading" level="1">Edit Machine Parameter</span>
<span data-dojo-attach-point="closeButtonNode" class="dijitDialogCloseIcon" data-dojo-attach-event="ondijitclick: onCancel" title="Cancel" role="button" tabindex="0">
<span data-dojo-attach-point="closeText" class="closeText" title="Cancel">x</span>
</span>
</div>
<div data-dojo-attach-point="containerNode" class="dijitDialogPaneContent" style="width: auto; height: auto;">
<div id="machineParameterDialogContents" class="machineParameterDialogContents">
<span class="l-status-message-wrapper l-status-message-wrapper--dialog">
<span id="machineParameterDialogStatus" class="c-global-message c-global-message--error">
error: <span>Action not successful. Please correct the validation errors</span>
</span>
</span>
<form id="machineParameterDialogForm" name="machineParameterDialogForm" action="/machineParameterAction.action" method="POST" class="c-panel-dialog">
</form>
</div>
</div>
</div>
You can use flex and add another div on the right. Then set flex-grow: 1 for both. If the right div have more content it will take the rest of the screen, if not, the left div will stretch. I think it's the best you can do without defining any width.
/*Relevant CSS:*/
.l-status-message-wrapper {
height: auto;
margin-left: 5px;
margin-top: 2px;
min-height: 15px;
}
.l-status-message-wrapper--dialog {
margin-left: 0px;
display: block;
word-wrap: break-word;
}
.c-global-message {
min-height: 15px;
color: #a5cf42;
font-size: 11px;
font-weight: bold;
text-transform: uppercase;
}
.c-global-message--error {
color: #e31d25;
}
.dijitDialog {
background: #eee;
border: 1px solid #d3d3d3;
-webkit-box-shadow: 0 5px 10px #adadad;
padding: 0;
}
.dijitDialog {
position: absolute;
z-index: 999;
overflow: hidden;
}
.dijitDialogTitleBar {
background: #C9CFD2 url(../../images/onglet_bg.gif) repeat-x;
vertical-align: middle;
}
.dijitDialogTitleBar {
background: #fafafa url(images/titleBar.png) repeat-x top left;
padding: 5px 6px 3px 6px;
outline: 0;
}
.dijitDialogTitleBar {
cursor: move;
}
form {
width: 200px;
height: 200px;
background-color: green;
}
.dijitDialogPaneContent{
display: flex;
}
.machineParameterDialogContents{
flex-grow: 1;
}
.more-content{
flex-grow: 1;
}
<div class="dijitDialog dijitDialogFocused dijitFocused" role="dialog" aria-labelledby="machineParameterDialog_title" id="machineParameterDialog" widgetid="machineParameterDialog">
<div data-dojo-attach-point="titleBar" class="dijitDialogTitleBar">
<span data-dojo-attach-point="titleNode" class="dijitDialogTitle" id="machineParameterDialog_title" role="heading" level="1">Edit Machine Parameter</span>
<span data-dojo-attach-point="closeButtonNode" class="dijitDialogCloseIcon" data-dojo-attach-event="ondijitclick: onCancel" title="Cancel" role="button" tabindex="0">
<span data-dojo-attach-point="closeText" class="closeText" title="Cancel">x</span>
</span>
</div>
<div data-dojo-attach-point="containerNode" class="dijitDialogPaneContent" style="width: auto; height: auto;">
<div id="machineParameterDialogContents" class="machineParameterDialogContents">
<span class="l-status-message-wrapper l-status-message-wrapper--dialog">
<span id="machineParameterDialogStatus" class="c-global-message c-global-message--error">
error: <span>Action not successful. Please correct the validation errors</span>
</span>
</span>
<form id="machineParameterDialogForm" name="machineParameterDialogForm" action="/machineParameterAction.action" method="POST" class="c-panel-dialog">
</form>
</div>
<div class="more-content">
“Such a little helpless creature will only be in the way,” I said; “you had better pass him up to the Indian boys on the wharf, to be taken home to play with the children. This trip is not likely to be good for toy-dogs. The poor silly thing will be in rain and snow for weeks or months, and will require care like a baby.” But his master assured me that he would be no trouble at all; that he was a perfect wonder of a dog, could endure cold and hunger like a bear, swim like a seal, and was wondrous wise and cunning, etc., making out a list of virtues to show he might be the most interesting member of the party.
</div>
</div>
</div>
After some investigating, our webdesigner has found a solution involving putting a flexbox around the span. I'm sharing the solution below for anyone else with this problem.
/*Relevant CSS:*/
.l-status-message-wrapper {
height: auto;
margin-left: 5px;
margin-top: 2px;
min-height: 15px;
}
.l-status-message-wrapper--dialog {
margin-left: 0px;
display: block;
word-wrap: break-word;
}
.c-global-message {
min-height: 15px;
color: #a5cf42;
font-size: 11px;
font-weight: bold;
text-transform: uppercase;
}
.c-global-message--error {
color: #e31d25;
}
.dijitDialog {
background: #eee;
border: 1px solid #d3d3d3;
-webkit-box-shadow: 0 5px 10px #adadad;
padding: 0;
}
.dijitDialog {
position: absolute;
z-index: 999;
overflow: hidden;
}
.dijitDialogTitleBar {
background: #C9CFD2 url(../../images/onglet_bg.gif) repeat-x;
vertical-align: middle;
}
.dijitDialogTitleBar {
background: #fafafa url(images/titleBar.png) repeat-x top left;
padding: 5px 6px 3px 6px;
outline: 0;
}
.dijitDialogTitleBar {
cursor: move;
}
form {
width: 200px;
height: 200px;
background-color: green;
}
/* Limits the width of an element so it does not exceed the width of the largest element
* on the same DOM level. It will adjust the width of its contents in cases where the parent
* element has no width value set. (e.g. A dialog message span that may not exceed the width of a accompagnied c-panel-dialog)
*
* Always use in a hierarchical markup combination (l-dynamic-width-wrapper > l-dynamic-width-wrapper-items)
*/
.l-dynamic-width-wrapper {
display: flex;
}
.l-dynamic-width-wrapper > .l-dynamic-width-wrapper-items {
flex-grow: 1;
width: 0;
}
<div class="dijitDialog dijitDialogFocused dijitFocused" role="dialog" aria-labelledby="machineParameterDialog_title" id="machineParameterDialog" widgetid="machineParameterDialog">
<div data-dojo-attach-point="titleBar" class="dijitDialogTitleBar">
<span data-dojo-attach-point="titleNode" class="dijitDialogTitle" id="machineParameterDialog_title" role="heading" level="1">Edit Machine Parameter</span>
<span data-dojo-attach-point="closeButtonNode" class="dijitDialogCloseIcon" data-dojo-attach-event="ondijitclick: onCancel" title="Cancel" role="button" tabindex="0">
<span data-dojo-attach-point="closeText" class="closeText" title="Cancel">x</span>
</span>
</div>
<div data-dojo-attach-point="containerNode" class="dijitDialogPaneContent" style="width: auto; height: auto;">
<div id="machineParameterDialogContents" class="machineParameterDialogContents">
<div class="l-dynamic-width-wrapper">
<div class="l-dynamic-width-wrapper-items">
<span class="l-status-message-wrapper l-status-message-wrapper--dialog">
<span id="machineParameterDialogStatus" class="c-global-message c-global-message--error">
error: <span>Action not successful. Please correct the validation errors</span>
</span>
</span>
</div>
</div>
<form id="machineParameterDialogForm" name="machineParameterDialogForm" action="/machineParameterAction.action" method="POST" class="c-panel-dialog">
</form>
</div>
</div>
</div>

Edit Spaces Between Elements

I have a pill / tab navigation menu, and I need to connect the menu to the rest of the body and the underline of the divs in order to make the menu look nice.
I need to color the space between the black and yellow and connect the underlined divs
.tab {
display: inline-block;
text-align: center;
border-bottom: 1px solid white;
width: 75px;
}
.selected {
border: 1px solid white;
border-bottom: none;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
background-color: rgba(0,0,0,1);
}
.createScreen {
display: block;
background-color: yellow;
width: 985px;
height: 500px;
}
.personalContainer {
margin-left: 5px;
}
.personalContainer, .shippingContainer, .billingContainer, .cardContainer {
margin-top: 5px;
display: inline-block;
background-color: rgba(0,0,0,0.25);
height: 400px;
width: 240px;
}
<div class="billingNav">
<div id="#createTab" class="tab selected">Create</div>
<div id="#editTab" class="tab notSelected">Edit</div>
<div id="#deleteTab" class="tab notSelected">Delete</div>
</div>
<div class="createScreen show">
<div class="personalContainer">
</div>
<div class="shippingContainer">
</div>
<div class="billingContainer">
</div>
<div class="cardContainer">
</div>
</div>
<div class="editScreen">
</div>
<div class="deleteScreen">
</div>
If you meant to the small gap between your selected tab and the menu, you can't make its border-bottom: none;.
Instead, I suggest you just override the tab preferences, so the bottom-border of the selected tab is black:
.selected {
border: 1px solid white;
border-bottom: 1px solid black;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
background-color: rgba(0,0,0,1);
}
This might get you closer to the result you need , before replacing these codes pls remove .selected from css.
.billingNav {
padding: 5px;
background-color: #444;
}
.tab {
display: inline-block;
margin-bottom: 5px;
text-align: center;
width: 75px;
color: #fff;
}
.tab:hover {
border-bottom: 2px solid #fff;
}
To connect the tabs together (no gap between tabs) you can see this question. there are several methods like as remove the whitespace in the HTML between the inline-block elements (no new line between of prev item and of next item). You may also use negative letter-spacing for parent and reset it to normal on cild (tab) elements.
The small white gap below the menu items are produced by the .tab {... border-bottom: 1px solid white;} style you set for tabs but border-bottom: none; on selected tab. to remove that space simply remove the border-bottom from tab.
Here is a working sample:
.billingNav {letter-spacing: -1em;}
.tab {
display: inline-block;
text-align: center;
letter-spacing: normal;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
width: 75px;
/*border-right: 1px solid white;
background-color: rgba(200,200,200,1);*/
}
.selected {
/*border: 1px solid white;*/
/*border-bottom: none;*/
background-color: rgba(0,0,0,1);
color: white;
}
.createScreen {
display: block;
background-color: yellow;
width: 985px;
height: 500px;
}
.personalContainer {
margin-left: 5px;
}
.personalContainer, .shippingContainer, .billingContainer, .cardContainer {
margin-top: 5px;
display: inline-block;
background-color: rgba(0,0,0,0.25);
height: 400px;
width: 240px;
}
<div class="billingNav">
<div id="#createTab" class="tab selected">Create</div>
<div id="#editTab" class="tab notSelected">Edit</div>
<div id="#deleteTab" class="tab notSelected">Delete</div>
</div>
<div class="createScreen show">
<div class="personalContainer">
</div>
<div class="shippingContainer">
</div>
<div class="billingContainer">
</div>
<div class="cardContainer">
</div>
</div>
<div class="editScreen">
</div>
<div class="deleteScreen">
</div>
Another appearance could be achieved by adding a background and small right border to (non-selected) tabs:
.billingNav {letter-spacing: -1em;}
.tab {
display: inline-block;
text-align: center;
letter-spacing: normal;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
width: 75px;
border-right: 1px solid white;
background-color: rgba(200,200,200,1);
}
.selected {
/*border: 1px solid white;*/
/*border-bottom: none;*/
background-color: rgba(0,0,0,1);
color: white;
}
.createScreen {
display: block;
background-color: yellow;
width: 985px;
height: 500px;
}
.personalContainer {
margin-left: 5px;
}
.personalContainer, .shippingContainer, .billingContainer, .cardContainer {
margin-top: 5px;
display: inline-block;
background-color: rgba(0,0,0,0.25);
height: 400px;
width: 240px;
}
<div class="billingNav">
<div id="#createTab" class="tab selected">Create</div>
<div id="#editTab" class="tab notSelected">Edit</div>
<div id="#deleteTab" class="tab notSelected">Delete</div>
</div>
<div class="createScreen show">
<div class="personalContainer">
</div>
<div class="shippingContainer">
</div>
<div class="billingContainer">
</div>
<div class="cardContainer">
</div>
</div>
<div class="editScreen">
</div>
<div class="deleteScreen">
</div>
Getting rid of the whitespace in between the underlined elements connected their borders
<div id="#createTab" class="tab selected">Create</div><div
id="#editTab" class="tab notSelected">Edit</div><div id="#deleteTab"
class="tab notSelected">Delete</div>
I personally would adjust the vertical-align so that the tabs do not have a gap in-between the values they already have a parent div container so the css would be
.tabSelected {
vertical-align: -4px; // or however many you need so that there is no gap

CSS- can't resize text input

It was probably asked before / someone had a similar problem, but I have been searching for a long time and couldn't find any solution to my problem.
I have a div called loginBox that is centred, and has a form in it. I want the text boxes in the form to take almost the entire width of the form (It should look like google's new sign in form).
I am setting the input's margin to auto and the width to 90% using css, but for some reason it has no effect. Even when I set the width to a number (i.e 200px), the width remains unchanged.
The only way I could make it work is increase the padding of the input to 100px, but this is both not responsive, and not a good practice.
This is the code I am using:
body {
margin: 0;
background-color: #EEEEEE
}
.menu {
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;
z-index: 1000;
}
.menu a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
.active {
background-color: #4CAF50;
}
.pageMain {
width: 100%;
padding: 16px;
margin-top: 70px;
height=1500px;
}
.loginBox {
display: table;
margin: auto;
width: 50%;
background-color: white;
box-shadow: 2px 2px lightgrey;
padding: 25px;
}
input {
margin: auto;
width=90%;
padding: 12px 20px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
<div class="menu">
<a class="active" href="index.html">Home</a>
Grades
Behavior
Homework
Learning Enviroments
Time Table
People
<a style="float: right" href="contact.html">Contact</a>
<a style="float:right" href="contact.html">Login</a>
</div>
<div class="pageMain">
<div class="loginBox">
<h3>Sign in</h3>
<h4>With your RSIS account</h4>
<form>
<input type="text" size="300" name="username" value="Email, RSIS username or id">
</form>
</div>
</div>
Screenshot of what I get right now
Fix your width. Instead of = it should be :. Your code seems fine otherwise. And width: 100% works just the way you intended.
Also, as mentioned in the comments, It should be height: 1500px; in .pageMain
body {
margin: 0;
background-color: #EEEEEE
}
.menu {
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;
z-index: 1000;
}
.menu a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
.active {
background-color: #4CAF50;
}
.pageMain {
width: 100%;
padding: 16px;
margin-top: 70px;
height: 1500px;
}
.loginBox {
display: table;
margin: auto;
width: 50%;
background-color: white;
box-shadow: 2px 2px lightgrey;
padding: 25px;
}
input {
margin: auto;
width:100%;
padding: 12px 20px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
<div class="menu">
<a class="active" href="index.html">Home</a>
Grades
Behavior
Homework
Learning Enviroments
Time Table
People
<a style="float: right" href="contact.html">Contact</a>
<a style="float:right" href="contact.html">Login</a>
</div>
<div class="pageMain">
<div class="loginBox">
<h3>Sign in</h3>
<h4>With your RSIS account</h4>
<form>
<input type="text" size="300" name="username" value="Email, RSIS username or id">
</form>
</div>
</div>
the first look into your css file
height=1500px; // Why =, not :? <----- PageMain class
width=90%; // <---- same here in input class
change:
width=90%;
height=1500px;
to:
width:90%;
height:1500px;
also use * { box-sizing: border-box;} for remove scrollbars.