Making input inside div always scale in one line - html

I would like to scale my input fields better.
When browser is maximized they look like this:
On smaller screens they look like this, the input fields goes to the bottom while it should be on the right:
My code:
.table-body {
width: 100%;
max-width: 952px;
border-spacing: 0px;
border-left: 1px solid #e4e4e4;
border-right: 1px solid #e4e4e4;
}
.table-body div {
padding-top: 3px;
padding-bottom: 3px;
}
.table-field1 {
text-align: center;
float: left;
padding-left: 11px;
padding-right: 11px;
}
.table-field2 {
font-size: 15px;
font-family: 'Roboto', sans-serif;
font-weight: 400;
color: #8f268d;
float: left;
margin-top: -2px;
}
.table-field3 {
color: #323232;
display: inline;
padding-left: 10px;
}
.table-field3 input {
border: 1px solid #e4e4e4;
width: 95%;
max-width: 844px;
color: #333333;
font-family: 'Roboto', sans-serif;
font-weight: 400;
font-size: 15px;
padding-top: 3px;
border-radius: 7px;
padding-left: 4px;
behavior: url(/panel/css/pie/pie.php);
}
<div class="table-body">
<div class="table-header">
<div class="left">
<input type="checkbox" name="usun_wszystkie" id="checkbox_all" class="css-checkbox" onchange="checkAll('checkbox[')">
<label for="checkbox_all" class="css-label"> Zaznacz wszystkie</label>
</div>
</div>
<div class="tabela_0">
<div class="table-field1">
<input type="checkbox" name="usun[438]" id="checkbox[438]" class="css-checkbox">
<label for="checkbox[438]" class="css-label"></label>
<input type="hidden" name="tag[438]" value="test.com">
</div>
<div class="table-field2">
<div>USUŃ</div>
</div>
<div class="table-field3">
<input type="text" name="entry" value="test.com">
</div>
</div>
</div>
<div class="table-end"></div>

If you can use flexbox to support your project, then try this:
.table-body {
width: 100%;
max-width: 952px;
border-spacing: 0px;
border-left: 1px solid #e4e4e4;
border-right: 1px solid #e4e4e4;
}
.tabela_0 {
display:flex;
}
.table-body div {
padding-top: 3px;
padding-bottom: 3px;
}
.table-field1 {
text-align: center;
padding-left: 11px;
padding-right: 11px;
}
.table-field2 {
font-size: 15px;
font-family: 'Roboto', sans-serif;
font-weight: 400;
color: #8f268d;
margin-top: -2px;
}
.table-field3 {
color: #323232;
padding-left: 10px;
flex-grow:1;
}
.table-field3 input {
border: 1px solid #e4e4e4;
width: 95%;
max-width: 844px;
color: #333333;
font-family: 'Roboto', sans-serif;
font-weight: 400;
font-size: 15px;
padding-top: 3px;
border-radius: 7px;
padding-left: 4px;
behavior: url(/panel/css/pie/pie.php);
}
<div class="table-body">
<div class="table-header">
<div class="left">
<input type="checkbox" name="usun_wszystkie" id="checkbox_all" class="css-checkbox" onchange="checkAll('checkbox[')">
<label for="checkbox_all" class="css-label"> Zaznacz wszystkie</label>
</div>
</div>
<div class="tabela_0">
<div class="table-field1">
<input type="checkbox" name="usun[438]" id="checkbox[438]" class="css-checkbox">
<label for="checkbox[438]" class="css-label"></label>
<input type="hidden" name="tag[438]" value="test.com">
</div>
<div class="table-field2">
<div>USUŃ</div>
</div>
<div class="table-field3">
<input type="text" name="entry" value="test.com">
</div>
</div>
</div>
<div class="table-end"></div>

Get the Fiddle: https://jsfiddle.net/z1o0fp1n/
I used tables:
<table><tr><td>
<div class="table-field2">
<div>USUŃ</div>
</div>
</td><td>
<div class="table-field3">
<input type="text" name="entry" value="test.com">
</div>
</td></tr>
</table>
Also you may use float:
<div class="table-field3" style='float:left;display:block'>
<input type="text" name="entry" value="test.com">
</div>

flexbox?
.table-body {
width: 100%;
max-width: 952px;
border-spacing: 0;
border-left: 1px solid #e4e4e4;
border-right: 1px solid #e4e4e4;
}
.table-body div {
padding: 3px;
}
.table-field2 {
font-size: 15px;
font-family: Roboto,sans-serif;
font-weight: 400;
color: #8f268d;
}
.table-field3 input {
border: 1px solid #e4e4e4;
color: #333;
font-family: Roboto,sans-serif;
font-weight: 400;
font-size: 15px;
padding-top: 3px;
border-radius: 7px;
padding-left: 4px;
behavior: url(/panel/css/pie/pie.php);
width: 95%;
}
.tabela_0 {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
padding: 3px;
}
.table-field3 {
width: 100%;
}
<div class="table-body">
<div class="table-header">
<div class="left"> <input type="checkbox" name="usun_wszystkie" id="checkbox_all" class="css-checkbox" onchange="checkAll('checkbox[')"><label for="checkbox_all" class="css-label"> Zaznacz wszystkie</label></div>
</div>
<div class="tabela_0"><div class="table-field1"><input type="checkbox" name="usun[438]" id="checkbox[438]" class="css-checkbox"><label for="checkbox[438]" class="css-label"></label><input type="hidden" name="tag[438]" value="test.com"></div><div class="table-field2"><div>USUŃ</div></div><div class="table-field3"><input type="text" name="entry" value="test.com"></div></div>
</div>

Related

How to put label above range slider

How can I put label "bright" above the range slide, now it's above but not directly above slider. I tried to use label but it didnt't work............................................................................
.popup-btn {
display: flex;
justify-content: left;
}
.panel {
text-align: center;
width: 335px;
height: 150px;
padding: 7px;
margin: 5px;
border: 6px solid gray;
float: left;
border-radius: 5px;
background-color: rgb(53, 96, 99);
opacity: 0.9;
font-size: 24px;
}
button {
background-color: rgb(241, 232, 232);
/* Green */
border: 3px solid gray;
color: white;
width: 85px;
height: 45px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 22px;
border-radius: 5px;
color: black;
font-family: 'Gemunu Libre', sans-serif;
margin-top: 15px;
margin-right: 5px;
}
<div id="panel-led" class="panel">
<img src="swiatlo.jpg" class="obrazki"> LED: <span id="wartosc-led">[stanled]</span>
<br/>
<button id="przycisk-led" style="margin-left: -8%;"></button>
<button id="przycisk-led1"></button>
</br>
<div class="popup-btn">
<button style="margin-left: auto;margin-right: auto;width: 50%;" onclick="show_schedule()">Schedule</button>
<span style="font-size: 12px;">bright</span>
<input style="width: 20%;" type="range" id="rangeinput" min="0" max="255" value="122" onchange="rangevalue.value=value" />
</div>
</div>
You can use flex in CSS:
Wrap a div around the label and the range slider.
Set the display property value of div to flex.
Set flex-direction property to column
For label you should define a name attribute of range slider and use that name in the label as <label for="some-name">Text</label>
Hope it helps.
.popup-btn {
display: flex;
justify-content: left;
}
.panel {
text-align: center;
width: 335px;
height: 150px;
padding: 7px;
margin: 5px;
border: 6px solid gray;
float: left;
border-radius: 5px;
background-color: rgb(53, 96, 99);
opacity: 0.9;
font-size: 24px;
}
button {
background-color: rgb(241, 232, 232);
/* Green */
border: 3px solid gray;
color: white;
width: 85px;
height: 45px;
/*text-align: center;*/
text-decoration: none;
display: inline-block;
font-size: 22px;
border-radius: 5px;
color: black;
font-family: 'Gemunu Libre', sans-serif;
margin-top: 15px;
margin-right: 5px;
}
#przycisk-led {
margin-left: -8%;
}
#schedule-button {
margin-left: auto;
margin-right: auto;
width: 50%;
}
#brightness-label {
font-size: 12px;
color: white;
}
.range-slider-input {
display: flex;
flex-direction: column;
text-align: left;
border: 1px solid white;
padding: 2%;
}
<div id="panel-led" class="panel">
<img src="swiatlo.jpg" class="obrazki" alt="swiatlo.jpg" /> LED: <span id="wartosc-led">[stanled]</span>
<br>
<button id="przycisk-led"></button>
<button id="przycisk-led1"></button>
<div class="popup-btn">
<button id="schedule-button" onclick="show_schedule()">Schedule</button>
<div class="range-slider-input">
<label for="brightness" id="brightness-label">Brightness</label>
<input type="range" id="rangeinput" min="0" max="255" value="122" name="brightness" onchange="rangevalue.value=value" />
</div>
</div>
</div>
I got rid of all the irrelevant code, and here's what I did:
Wrap both label and slider with div and give it style of flex column.
align-items:center is what centering both of them on the main axis.
width:max-content to make it not take the entire row's width.
Now you can put it anywhere you want :)
.special {
display: flex;
flex-direction: column;
align-items: center;
width: max-content;
}
<div class="special">
<span style="font-size: 12px;">bright</span>
<input type="range" id="rangeinput" min="0" max="255" value="122" />
</div>

Element squeezed when width is narrow [duplicate]

This question already has an answer here:
Why is a flex item limited to parent size?
(1 answer)
Closed 3 years ago.
I've been asked to fix a problem that I don't understand. Can someone be kind enough to have a look at this fiddle?
When shrinking the width of the output pane so that the last question is forced to multi line, the accompanied span .checkmark is no longer round but elliptical.
body {
background-color: white;
color: black;
font-weight: 400;
font-family: telesans_text, Arial, Verdana, Helvetica, sans-serif;
margin: 0px;
}
.header-container {
padding: 1px;
text-align: left;
color: white;
}
.header-txt {
font-size: 15px;
margin: 5px 11px 4px 11px;
display: inline-block;
}
/* Format Question text */
.question-container {
flex: 1 1 auto;
margin: auto;
display: flex;
padding-bottom: 5px;
}
.question-text {
font-size: 17px;
font-weight: 600;
line-height: 22px;
text-align: left;
margin-bottom: 3px;
font-family: telesans_head, Verdana, Arial, Helvetica, sans-serif;
}
/* Format pages */
.question-page {
font-size: 12px;
margin: 10px 10px 10px 10px;
padding-bottom: 10px;
}
/* Question options format */
.option-container {
display: flex;
position: relative;
padding-left: 0px;
margin-bottom: 0px;
cursor: pointer;
font-size: 14px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.option-container input {
position: absolute;
opacity: 0;
}
.checkmark {
position: relative;
height: 15px;
width: 15px;
background-color: #D3D3D3;
border-radius: 50%;
margin-top: auto;
margin-bottom: auto;
margin-right: 15px;
}
.option-container:hover input~.checkmark {
background-color: #A9A9A9;
}
.option-container:hover {
background-color: #F8F8F8;
}
.option-container input:checked~.checkmark {
background-color: #dd2a30;
}
<div id="survey">
<div class="header-container">
<span class="header-txt">A question for you...</span>
</div>
<div id="question-body" class="modal-body">
<div id="q1" class="question-page">
<div class="question-container">
<span class="question-text">What is your relationship <br> with [brand]?</span>
</div>
<div class="option-container"><span class="checkmark"></span>Not a brand I'm familiar with
<input class="question-option" type="radio" name="q1" value="1">
</div>
<div class="option-container"><span class="checkmark"></span>I'm familiar, but not interested
<input class="question-option" type="radio" name="q1" value="2">
</div>
<div class="option-container"><span class="checkmark"></span>A brand I would consider purchasing
<input class="question-option" type="radio" name="q1" value="3">
</div>
<div class="option-container"><span class="checkmark"></span>My most preferred [product category]
<input class="question-option" type="radio" name="q1" value="4">
</div>
<div class="option-container"><span class="checkmark"></span>I plan to purchase [brand] when next buying [product category]
<input class="question-option" type="radio" name="q1" value="5">
</div>
</div>
</div>
</div>
That's because when the content is more that the space available, by default the flexbox items tries to shrink to the space available - add flex-shrink: 0 to checkmark - see demo below-
body {
background-color: white;
color: black;
font-weight: 400;
font-family: telesans_text, Arial, Verdana, Helvetica, sans-serif;
margin: 0px;
}
.header-container {
padding: 1px;
text-align: left;
color: white;
}
.header-txt {
font-size: 15px;
margin: 5px 11px 4px 11px;
display: inline-block;
}
/* Format Question text */
.question-container {
flex: 1 1 auto;
margin: auto;
display: flex;
padding-bottom: 5px;
}
.question-text {
font-size: 17px;
font-weight: 600;
line-height: 22px;
text-align: left;
margin-bottom: 3px;
font-family: telesans_head, Verdana, Arial, Helvetica, sans-serif;
}
/* Format pages */
.question-page {
font-size: 12px;
margin: 10px 10px 10px 10px;
padding-bottom: 10px;
}
/* Question options format */
.option-container {
display: flex;
position: relative;
padding-left: 0px;
margin-bottom: 0px;
cursor: pointer;
font-size: 14px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.option-container input {
position: absolute;
opacity: 0;
}
.checkmark {
flex-shrink: 0; /* ADDED */
position: relative;
height: 15px;
width: 15px;
background-color: #D3D3D3;
border-radius: 50%;
margin-top: auto;
margin-bottom: auto;
margin-right: 15px;
}
.option-container:hover input~.checkmark {
background-color: #A9A9A9;
}
.option-container:hover {
background-color: #F8F8F8;
}
.option-container input:checked~.checkmark {
background-color: #dd2a30;
}
<div id="survey">
<div class="header-container">
<span class="header-txt">A question for you...</span>
</div>
<div id="question-body" class="modal-body">
<div id="q1" class="question-page">
<div class="question-container">
<span class="question-text">What is your relationship <br> with [brand]?</span>
</div>
<div class="option-container"><span class="checkmark"></span>Not a brand I'm familiar with
<input class="question-option" type="radio" name="q1" value="1">
</div>
<div class="option-container"><span class="checkmark"></span>I'm familiar, but not interested
<input class="question-option" type="radio" name="q1" value="2">
</div>
<div class="option-container"><span class="checkmark"></span>A brand I would consider purchasing
<input class="question-option" type="radio" name="q1" value="3">
</div>
<div class="option-container"><span class="checkmark"></span>My most preferred [product category]
<input class="question-option" type="radio" name="q1" value="4">
</div>
<div class="option-container"><span class="checkmark"></span>I plan to purchase [brand] when next buying [product category]
<input class="question-option" type="radio" name="q1" value="5">
</div>
</div>
</div>
</div>

Contact form and footer styling issues [duplicate]

This question already has answers here:
What is a clearfix?
(10 answers)
Closed 4 years ago.
I have some styling issues with my contact form and footer: I want a border-top at the top for the footer div to separate the contact form and footer. However, the border-top of the footer is pushed above the top of the contact form rather than the top of the footer
If I delete the contact form, the border-top is where it needs to be... I've attached an image (as the code snippet doesn't do my styling so far any justice)
#contact-text-title {
color: #5CDB95;
}
.left-grid, .right-grid {
width: 49%;
float: left;
margin-top: -2%;
}
.left-grid {
margin-right: 1%;
}
.right-grid {
margin-left: 1%;
}
#mobile-contact-content {
display: none;
}
form {
width: 98%;
}
textarea, input, #contact-text {
font-family: Quicksand;
font-size: 16px;
}
label {
display: block;
padding: 1rem 0 .5rem;
text-transform: uppercase;
font-size: 18px;
font-family: Karla;
}
input, textarea {
display: block;
width: 100%;
border: 1px solid black;
padding: .5rem;
font-family: Montserrat;
font-weight: 300;
}
textarea {
height: auto;
resize: none;
}
button {
font-family: Montserrat;
font-size: 18px;
border: 1px solid #379683;
padding:.5rem;
width: auto;
margin-top: 15px;
background-color: #379683;
color: #FFF;
}
button:hover {
cursor: pointer;
color: #379683;
border-color: #379683;
background-color: #FFF;
}
#contact-text {
display: table-cell;
text-align: center;
vertical-align: middle;
line-height: 48px;
height: 500px;
}
footer {
font-size: 12px !important;
height: 25px;
}
footer p {
border-top: 1px solid black;
}
footer .logo {
font-size: 18px !important;
border: 0px solid black;
text-align: left;
width: 50%;
float: left;
margin-bottom:30px;
}
footer #facebook {
font-size: 18px !important;
text-align: left;
width: 50%;
float: left;
margin-bottom:30px;
margin-top:17px;
color: #05386B;
}
footer #facebook:hover {
cursor: pointer;
}
<div class="col">
<div id="contact-block">
<div id="header">
<h4>Contact.</h4>
</div>
<div id="mobile-contact-content">
<p class="content-text">Do you have an idea for your garden or driveway?</p>
<p class="content-text"><span>We want to hear about it!</span></p>
<p class="content-text">Use the contact form to get in touch with us!</p>
</div>
<div class="left-grid">
<form action="/" id="contact-form" method="post" role="form">
<div class = "label">
<label for="name" class="formText">Name:</label>
</div>
<input id="name" name="name" type="text" placeholder="Your name" required="required">
<div class = "label">
<label for="email" class="formText">Email:</label>
</div>
<input id="email" name="email" type="text" placeholder="Your email" required="required">
<div class = "label">
<label for="message" class="formText">Message:</label>
</div>
<textarea id="message" name="message" placeholder="Enter your message here" rows="10" required="required"></textarea>
<div>
<button type="submit">Send</button>
</div>
</form>
</div>
<div class="right-grid" id="contact-box">
<div id="contact-text">
<p><span id="contact-text-title">Have a new project idea?</span>
<br>Use the contact form to tell us about it and we will get in touch with you</p>
</div>
</div>
</div>
</div>
<div class="col">
<footer>
<p><span class="logo" style="text-align:left;">Rob Moore LTD</span><span id="facebook" style="text-align:right;"><i class="fab fa-facebook-f fa-lg"></i></span>
</p>
</footer>
</div>
Set float:left to .col.
.col {
float: left;
}
And also add a width: 100%; to the last .col which contains the footer.

CSS - Styling a form

I'm styling a form for a site and I need it to look like this -
My coded version, so far, looks like this -
The name & email sections for some reason won't size properly and there seems to be padding or margin properties somewhere which I can't seem to override. Here's my code as it stands -
form {
height: 200px;
width: 400px;
margin-right: 50px;
}
.name {
float: left;
}
input[type=text],
input[type=email] {
background: #F0F0F0;
font-size: 10px;
width: 100%;
height: 20px;
}
input[type=subject] {
background: #F0F0F0;
font-size: 10px;
width: 100%;
height: 20px;
}
textarea {
resize: vertical;
font-size: 10px;
width: 100%;
background: #F0F0F0;
height: 100px;
}
input[type=submit] {
background: #00bfff;
border: none;
color: #ffffff;
cursor: pointer;
font-size: 10px;
font-weight: 700;
width: 100%;
}
<div class="six columns">
<form>
<fieldset>
<div class="name">
<input type="text" required placeholder="NAME">
</div>
<div class="name">
<input type="email" required placeholder="EMAIL">
</div>
<div>
<input type="subject" placeholder="SUBJECT">
</div>
<div>
<textarea placeholder="MESSAGE..."></textarea>
</div>
</fieldset>
<input type="submit" value="SUBMIT">
</form>
</div>
UPDATE - Latest version.
I made a bunch of tweaks and kind of last track as I went, so I hope you're able to read through this and figure it out. If not, please feel free to ask questions!
form {
height: 200px;
width: 400px;
margin-right: 50px;
}
fieldset {
border: none;
padding: 0;
margin: 0;
display: flex;
}
div.row {
display: flex;
width: 100%;
}
div.row input {
margin-left: 5px;
}
div.row input:first-child {
margin-left: 0;
}
input[type=text],
input[type=email] {
background: #E8E8E8;
font-size: 10px;
width: 100%;
box-sizing: border-box;
border: 0;
padding: 0;
margin-bottom: 5px;
padding: 6px 12px;
}
textarea {
resize: none;
font-size: 10px;
background: #E8E8E8;
width: 100%;
box-sizing: border-box;
border: 0;
padding: 6px 12px;
margin-bottom: 5px;
}
input[type=submit] {
background: #1ba4dd;
border: none;
color: #ffffff;
cursor: pointer;
font-size: 10px;
font-weight: 700;
width: 100%;
padding: 8px 0;
}
input[type=submit]:hover {
background: #00bfff;
}
<div class="six columns">
<form>
<fieldset>
<div class="row">
<input name="name" type="text" required placeholder="NAME">
<input name="email" type="email" required placeholder="EMAIL">
</div>
<input name="subject" type="text" placeholder="SUBJECT">
<textarea rows="8" placeholder="MESSAGE..."></textarea>
</fieldset>
<input type="submit" value="SUBMIT">
</form>
</div>

How to style the DIV to display html controls

I have the following HTML:
<div class="dispLoginSearch" style="text-align: left; overflow: hidden;"> <!-- LOGIN AND SEARCH -->
<div class="theLoginBox" style="clear: both;">
<div class="loginTitle">
Log in to <span style="font-family: 'blackjarregular'; font-size: 14pt; color: #FE7816;">My</span> <span style="font-family: 'trajanpro'; font-size: 12pt; color: #00529B;">WD</span> | Sign Up
<br />
<input type="text" value="Username" /> <input type="password" value="Password" /> <input type="button" value="Go" />
<br />
<span style="float: right;">Forgot login/password</span>
</div>
</div>
<div style="z-index: 99999999999;">
<input type="text" value="Search WD" />
</div>
</div> <!-- LOGIN AND SEARCH -->
CSS:
.dispLoginSearch
{
width: 47%;
height: 150px;
line-height: 150px;
vertical-align: middle;
float: right;
padding-right: 2%;
background: #FFFFFF;
border: 1px solid #0026ff;
}
.theLoginBox
{
border: 2px solid #D5D5D5;
border-radius: 4px;
width: 97%;
height: 90px;
padding: 10px;
white-space: nowrap;
background: #ff6a00;
}
.loginTitle
{
height: 88px;
display: block;
vertical-align: top;
white-space: nowrap;
font-weight: bold;
text-align: left;
background: #b6ff00;
}
When I view the website, I see the following:
What I would like it be shown:
How do I fix the issue? It is happening in both IE and other browsers.
UPDATE:
I added overflow: auto in the loginTitle class and this is what is shown:
Each section is taking up a lot of space and showing the scrollbar :/
This is because of line 5 of your CSS : line-height: 150px;.
Just remove it and you should be fine.
If you want it to look like image you attached, see here: http://codepen.io/anon/pen/FothH
html:
<form action="#">
<p>Log in to ###### | Sign up</p>
<input type="text" placeholder="Username"/>
<input type="password" placeholder="Password"/>
<input type="submit" value="Go"/>
Forgot login/password
</form>
css:
form {
border: 1px solid #d4d4d4;
display: block;
width: 375px;
font: 16px sans-serif;
padding: 0 0 0 15px;
border-radius: 5px;
-webkit-font-smoothing: antialiased;
}
form p {
margin: 5px 0 0;
font-size: 20px;
line-height: 35px;
}
input {
display: inline-block;
border-radius: 7px;
}
input[type=text], input[type=password] {
border: none;
background: #ebebeb;
font-size: 16px;
padding: 6px 10px;
width: 180px;
}
input[type=password] {
width: 120px;
}
input[type=submit] {
font-size: 16px;
width: 25px;
padding: 5px 0px;
background: none;
color: red;
border: none;
}
form a {
display: block;
line-height: 25px;
text-align: right;
margin-right: 30px;
color: #d4d4d4;
text-decoration: none;
margin-bottom: 5px;
}