IE strange behavior on textarea and select? - css

I have strange IE behavior on cursor property css?
Here is the code, this is just simple inline style to show what is the problem?
<div style="width:100%;">
<select>
<option value="">Select</option>
<option>John</option>
<option>John</option>
<option>John</option>
<option>John</option>
<option>John</option>
<option>John</option>
</select>
</div>
<textarea style="cursor:not-allowed;"></textarea>
All i working OK in Firefox and Google Chrome, only in IE is the problem, when option get over textarea cursor change style to not allowed? Please take a look at fiddle here but only in IE?
Working fiddle
http://jsfiddle.net/f6paL8sc/

It seems this is a IE related Bug. I've made a solution and it works *(*IE required a .cur file to work ); but lets check the DEMO first.
In this example I used disabled attribute to disabled the textarea because you are using cursor:not-allowed which gives a impresson of that field is disabled.
Download this PNG image and convert it into (.cur) using this Online tool
Here is the CSS used.
textarea[disabled]
{
display:block;
cursor:url('http://www.dolliehost.com/dolliecrave/cursors/cursors-cute/cute25.gif'), url('cute25.cur'), wait;
background:gold;
}
In HTML code I disabled the textarea which makes more sense here.
<textarea disabled>This TextArea is disabled</textarea>
NOTE: I haven't got chance to test on IE but it must work.

Related

css Select-Option with margin-top

I'm trying to make dropbox or comboBox with select-option
I want to put space between select and first child(option).
I tried
<select>
<option style={{ marginTop: "100px" }} value="Test">test</option>
<option value="Test">test</option>
</select>
But failed.
Any ideas?
There are only a few style attributes that can be applied to an element.
This is because this type of element is an example of a "replaced element". They are OS-dependent and are not part of the HTML/browser. It cannot be styled via CSS.
Unfortunately, webkit browsers do not support styling of option tags yet.
you may find similar question here
How to style a select tag's option element?
Styling option value in select drop down html not work on Chrome & Safari
The most widely used cross browser solution is to use ul li
Hope that helps!!!!

select element not showing well formed in web page

I'm having a graphical problem with a select box in a page of my website.
The problem is that the option elements of the select is showing inline instead as a drop-down selection. This strange behaviour becomes only if I render the select element inside a form element. (??I don't know why??)
The HTML output produces:
<form name="add-user-form" method="POST" action="/index.php/admin/happen/add"><p><select name="day" required><option value>d</option>
<option value="a">a</option>
<option value="b">b</option>
</select>
</p>
</form>
is a valid html5 markup, checked on w3c website.
this is an image showing the problem..
I omit the php code for now, somebody know this problem?
As we said in the comment, the issue is due to a CSS class using the following :
form[name] * {
display: inline-block;
}

Use image instead of radio button not working with form tag in IE [duplicate]

The problem
In IE11 the image in the following code is clickable to activate/toggle the input in the label:
<label>
<input type="checkbox"> some text
<img src="http://placeimg.com/100/100/any" alt="some img">
</label>
While the image in the this exactly same code but inside of a <form> is not clickable to activate/toggle the input:
<form>
<label>
<input type="checkbox"> some text
<img src="http://placeimg.com/100/100/any" alt="some img">
</label>
</form>
(Demo at jsfiddle)
Note that in the example animation above I'm clicking the second image, which doesn't work, but clicking on the text works (just did that to demonstrate).
This was tested and reproduced on:
IE 11.0.9600.16428 on Windows 7 Pro SP1 x64.
IE 11.0.9600.16438 on Windows RT 8.1 tablet.
IE 11.0.9600.17105 on Windows 7 Pro SP1 x64.
IE 11.0.10240.16431 on Windows 10
This issue does not occur in IE9, IE10, Microsoft Edge, and other browsers.
Questions:
Can this be solved without JS while still using image tags?
If not, what other possible solutions are there?
(Optional) Why doesn't the image in the second example trigger the input element (while doing it in the first)?
One way to fix this is with pointer-events: none on the image, and adjusting the label with for example display: inline-block. (pointer-events is supported in IE11.)
label{
display: inline-block;
}
label img{
pointer-events: none;
}
(Demo at jsFiddle)
Is a bit older question, but as its pretty high in google search, I'll post here one more answer that fixes this in all IE versions.
.
The checkbox/radio has to be outside of label, it has to have own unique ID and label has to have attribute for which contains the ID of checkbox/radio its related to:
<label for="my_lovely_checkbox">Hello good friend</label>
<input type="checkbox" value="Hello" id="my_lovely_checkbox">
If you done that and if you use PHP (which you probably are), you can use this piece of code:
if (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) || (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false)) {
?>
<script>
$(document).ready(function() {
$("label img").on("click", function() {
$("#" + $(this).parents("label").attr("for")).click();
});
});
</script>
<?
}
I know its JS, but there is actually no other fix for =< IE10 without JS usage.
It detects all IE, versions (IE10 and 11 included, have no idea about Spartan tho, i think it does not detect that one).
Ps.: Answer above me does not actually work for IE8, IE9 and IE10. Just so you know.

Override default css stylings for validation in IE9 +

http://jsfiddle.net/4LXkE/
The code:
<form>
<input type="text" name="name" id="name" placeholder="Name*" required="required" />
<input type="submit" />
</form>
In the above fiddle, you can see that in IE9+ (that's what my target browser is) the input box is surrounded by an ugly red highlight and a popup message to show it is a required field.
I found the following question which is close, but doesn't give a full answer to my specific question:
override css for html5 form validation/required popup
In my application I have my own stylings (twitter bootstrap defaults) but they are hidden behind these styles which show up.
While I tried to debug the app in Developer tools, i couldn't find what CSS classes were being added or how.
Any help turning these off would be much appreciated, thanks!
IE9 does not support the "required" attribute natively, and it is not part of the UA stylesheet.
Are you using Modernizr or something similar along with Bootstrap? In IE9, the "required" attribute is useless without a polyfill. (see caniuse or this article for more information) Please look at Modernizr for a solution to this problem. If you're using a polyfill already, you should be able to style the shim element to get the appearance you want.

Is there a way to enhance by CSS an HTML <select> and its <option> on IE 6?

Internet explorer 6 seems totally ignore CSS classes or rules on select, option or optgroup tags.
Is there a way to bypass that limitation (except install a recent version of IE) ?
Edit : to be more precise, I'm trying to build a hierarchy between options like that example:
Here's the HTML snippet :
<select name="hierarchicalList" multiple="multiple">
<option class="group niv0">Os developers</option>
<option class="group niv1">Linux</option>
<option class="user niv2">Linus Torvald</option>
<option class="user niv2">Alan Cox</option>
<option class="group niv1">Windows</option>
<option class="user niv2">Paul Allen</option>
<option class="user niv2">Bill Gates</option>
<option class="group niv1">Mac Os</option>
<option class="user niv2">Steve Wozniaz</option>
</select>
And here's CSS rules, that works fine on a recent browser (like FF3) but not working at all on IE6 :
select option {
line-height: 10px;
}
select option.group {
font-weight: bold;
background: url(path_to_group_icon.gif) no-repeat;
padding-left: 18px;
}
select option.user {
background: url(path_to_user_icon.gif) no-repeat;
padding-left: 18px;
}
select option.niv0 { margin-left: 0px; }
select option.niv1 { margin-left: 10px; }
select option.niv2 { margin-left: 20px; }
A very detailed guide to what does and does not work with form element styling is in the articles here and here. From my commercial experience cross-browser form layouts that work on IE6 are not imposssible (although you do need to test carefully). An executive summary is that you can control sizes and colours but trying to micro-manage things like text alignment is a losing battle.
This won't do exactly what you want, but rather than using CSS, you could just use a number of
&nbsp ;
for the indents, or dashes so:
Level 1
-Level 2
--Level 3
etc.
If you don't particularly like that, you could surround them with
<!--[if lt IE 7]><![endif]-->
or
<!--[if IE 6]><![endif]-->
So it would look like
Level 1
<!--[if lt IE 7]>-<![endif]-->Level 2
<!--[if lt IE 7]>--<![endif]--> Level 3
Then you could have the CSS for modern browsers.
Take a look at the optgroup tag to group entries inside a select tag.
Look here: http://www.netmechanic.com/news/vol4/html_no20.htm for an example
From MSDN reference :
Except for background-color and color,
style settings applied through the
style object for the option element
are ignored. In addition, style
settings applied directly to
individual options override those
applied to the containing SELECT
element as a whole.
Ok, so... There's no way to get that working on IE...
Thanks Matt for the nbsp; idea. I will surely use that work-around.
IE6 css implementation for options is buggy (as is the css implementation as a whole for IE6) But you CAN style options with css. I just tested changing option and select tags bgcolor and it worked as expected. The only component I know of that can not be styled is the file input.
Yes you can style them (to some extent). I sometimes change the font, background-color and color styles.
What were you trying to achieve?
CSS and HTML snippets would be useful.
You could emulate the whole thing using a drop-down menu script instead. It would give you complete control.

Resources