I'm working on a website where is this project https://varincom.purple.md/proiecte/ghefest/. I use Wordpress, and to create interactive map for floors, I use a plugin, but I have a problem. I managed to make floors to be organized linearly as here https://imgur.com/4c2Btpt , editing this file from the plugin https://github.com/siscanu/varincom/blob/master/image-map-pro.min.js , but what I fail is to add a different CSS class to the active floor, (line 1080 of the file .js) to be able to color it differently.
Thanks in advance to anyone who is available to help me.
You can use the :checked selector for this:
.radio:checked{
width: 40px;
height: 40px;
}
<input class="radio" type="radio" />
<input class="radio" type="radio" />
You can also put some other styling to the radio label, see this.
Is there a way to hide/disable control options for date and time input's types that allow increment/decrement values by clicking on arrows.
<input type='date' />
<input type='time' />
And at the same time have the possibility to provide data for each segment like dd from dd/mm/yyyy (basicly just hide the controls)
Like for example it's possible to set resize: none for textarea.
textarea {
resize: none;
width: 200px;
height: 100px;
}
<textarea />
You can set the input to disabled, or use a <input type="text" /> if those spinners are getting in your way
EDIT
I googled a little and it turns out it can be done on webkit browsers...
https://css-tricks.com/snippets/css/turn-off-number-input-spinners/
input[type=date]::-webkit-inner-spin-button,
input[type=date]::-webkit-outer-spin-button,
input[type=time]::-webkit-inner-spin-button,
input[type=time]::-webkit-outer-spin-button
{
-webkit-appearance: none;
margin: 0;
}
<input type='date' />
<input type='time' />
At this stage, the short answer is that you can’t. The date and time elements aren’t widely supported yet, and any tweaking is, at this stage, still experimental.
There are good reasons to prefer the date and time types over the text type, but you won’t be able to control their appearance on all browsers reliably.
Chrome has some experimental styles: you can read about that at https://www.tjvantoll.com/2013/04/15/list-of-pseudo-elements-to-style-form-controls/. the ::-webkit-inner-spin-button property may help.
Just remember that, at this stage, it is by no means universal.
I'm using normalize.css on a little project I'm working on in Wordpress,but when I use a contact form, normalize is causing the text fields to span outside of the container:
http://notfilc.eu/wordpress/
The offending code is:
button, input, select, textarea {
font-family: inherit;
font-size: 100%;
margin: 0;
}
I could just remove this from normalize but I want to learn why it's going out, and I just can't see it. The HTML is pretty large so a reduced test case is pretty hard to achieve, however I'm willing to produce this afterwards for others to learn from if there's a reasonable answer for this.
It is because you are using size=40
<input type="text" name="your-name" value="" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" size="40" />
and hence it is overflowing.. My Fiddle
Try using size="30" or less and it will decrease..
If you want to limit the characters in the field use maxlength
I'm creating a css template for form types and want to give form inputs a rounded border. This works well with type=text but doesn't work with type=file (for file upload).
What am I doing wrong?
.tempform input[type="text"] {
-moz-border-radius: 10px;
}
.tempform input[type="file"] {
-moz-border-radius: 10px;
}
<div class="tempform">
<label for="textfield">Test Text Field</label>
<input type="text" id="textfield" name="textfield"></div>
</div>
div class="tempform">
<label for="filefield">Test File Field</label>
<input type="file" name="filefield" id="filefield-0">
<input type="file" name="filefield" id="filefield-1">
</div>
Unfortunately, it's impossible to style a file upload input, besides changing the width a little bit. Browsers just don't allow any other change. If you want to style your file upload input, you'll have to use a nasty hack like placing an almost invisible file upload input on top of an image (which only works in some browsers), or a JavaScript solution like ajax-upload.
According to the first Google search result, it's rather involved. See this article on quirksmode.org for information on how to do it.
I'm wondering whether it's acceptable to use tables for forms.
Strictly speaking, name/value pairs are tabular data, aren't they? And a form is just a user customisable set of name/value pairs. So is it right to use tables in this case? Or should I use divs styled with CSS?
Try fieldsets
I prefer to break up the fields into logical <fieldset>s with one <legend> each, because:
The code is less cluttered
The default formatting is user-friendly (I especially like how the legend displays)
It's easy to style with CSS
Here's a code example. Note that the labels' for attribute lets you click that label to move focus to the input specified (it matches the id attribute).
<form>
<fieldset>
<legend>Wombat Statistics</legend>
<ol>
<li>
<label for="punchstrength">Punch Strength</label>
<input id="punchstrength" name="punchstrength" />
</li>
<li>
<label for="beverage">Favorite Beverage</label>
<input id="beverage" name="beverage" />
</li>
</ol>
</fieldset>
<fieldset>
<legend>Questions That Are Too Personal</legend>
<ol>
<li>
<label for="creditcard">What is your credit card number?</label>
<input id="creditcard" name="creditcard" />
</li>
<li>
<label for="gullibility">Did you actually fill that in?</label>
<input id="gullibility" name="gullibility" />
</li>
</ol>
</fieldset>
</form>
For a basic layout, you can use something like:
label, input, textarea, select {
display: inline-block; vertical-align: top; width: 30%;
}
See this article for a more in-depth tutorial.
Both are correct.
I preffer using some div/li, as that allows me to make some different layouts, but tables for forms are not frowned upon.
Actually, by default, Django gives you table formated forms.
A form isn't tabular data.
It's so easy to lay out form elements with CSS, I don't see any value worth obfuscating the markup with tables. Personally, I find that laying out forms with CSS is easier than using tables at this point. For example:
HTML:
<fieldset>
<label for="FirstName">First Name</label>
<input type="text" id="FirstName" />
<label for="LastName">Last Name</label>
<input type="text" id="LastName" />
<label for="Age">Age:</label>
<select id="Age">
<option>18-24</option>
<option>25-50</option>
<option>51-old</option>
</select>
</fieldset>
CSS:
fieldset {
overflow: hidden;
width: 400px;
}
label {
clear: both;
float: right;
padding-right: 10px;
width: 100px;
}
input, select {
float: left;
}
Using simple variations on that theme, you can make great-looking, accessible forms that are actually easier to work with than tables anyway. I've used that basic approach and ramped it up to some fairly complex, multi-column data entry forms too, no sweat.
You can use tables. Simple as that.
Yes
Yes, you may use tables. Div's are supposed to replace tables for page-level layout, but not for, well, tables. Go ahead and use them within pages whenever they solve your problem.
After being the biggest anti table person you can imagine I've started to realize in the end it doesn't matter. Use what's quickest. Of course if you are nesting tables then you have a problem but generally I can't think of a easier way to layout forms. At the end of the day does the client or the visitor give two hoots about whether you used a table or a list?
Some people will say yes, some no.
Here's a way for you to decide: If it truly contains tabular data, then it should, at least according to WCAG, have a summary attribute. The summary attribute should describe the purpose and structure of the table for the benefit of screen reader users. Can you write such an attribute? If so, then you should do so, and include it on your table. If you can't, then it probably isn't a really a table and you should look for another way of laying out your form.
Eric, I would agree with you that form data is tabular data and semantically can live inside a table.
This is the method I use for simple data entry screens.
I wouldn't generally use divs, but possibly an ordered list
<ol>...</ol>
as the form is an ordered list of items also.
I find this method a lot hard to style however.
You'll probably get 50/50 split in answers....
If you're looking for "css purity", you should use something like this:
<form action="http://localhost/Zoleris/" method="post" accept-charset="utf-8">
<ul class="form">
<li>
<label for="username">Username</label>
<input type="text" id="username" name="username">
</li>
<li>
<label for="password">Password</label>
<input type="password" id="password" name="password">
</li>
<li>
<input type="checkbox" id="remember_me" name="remember_me" >
<label class="checkbox" for="remember_me">Remember my username</label>
</li>
<li>
Forgot your password?
</li>
<li>
<button type="submit" id="btnLogin" name="btnLogin" class="button positive" style="float:right"><img src="tick.png">Login</button>
<button type="submit" id="btnRegister" name="btnRegister" style="float: left"><img src="cross.png">I need an account!</button>
</li>
</ul>
</form>
you can use whatever you want,
it just that it is a new standard for making the layout of the html forms, and it's kinda like a rule not use table tags for design, but it's still ok to use tables for displaying a table of data (grid)
It's important to use labels with the 'for' attribute for screen readers (for usability).
That is why I use fieldsets
I never understood why you would use an ordered or unordered list for forms when a definition list seems more semantically appropriate:
<fieldset>
<dl>
<dt><label for="definition">Definition:</label></dt>
<dd><input type="text" name="definition" /></dd>
</dl>
</fieldset>
They can be a wee bit trickier to wrangle format-wise, but it always made a lot more sense to me than lists or tables for the vast majority of forms.
Having said that, tables don't seem inappropriate to me for editable tabular data.
Forms can be or feel tabular, but tables imply a "presentation" along with the semantics. Marking up a form in a table tends to lock the design into a 2-across, field/input layout (assuming you don't want to spend time overriding the table's CSS). Furthmore, you may have to override the styles if you are trying to account for small screens such as mobile phones.
Furthermore, a screen reader will over-announce this form with, "Row 1, column 1, label, 'Name', column 2, input, 'Name'..." instead of simply, "Input, 'Name'..."
My recommendation is to use DIVs, FIELDSETs, or ULs/LIs. This leaves the presentation in the hands of CSS, exactly where it belongs.