I have a survey on Qualtrics and I would like to find a way of hiding the radio buttons using CSS; is this possible?
Thanks!
if you want all radiobuttons hidden then you can use
input [type="radio"] { display:none; }
if you want only some radiobuttons hidden then you must give a css class for them for example "hiddenRadioButton" and this css class is
.hiddenRadioButton{ display:none; }
Edit: [input type="radio"] {display:none} should be input [type="radio"] { display:none; }
If you want to hide a certain radio button, then use this:
HTML:
<!-- Example with two radio buttons -->
<input type="radio" id="first-button" name="button"> <input type="radio" id="second-button" name="button">
CSS:
#first-button {
display: none;
}
If you want to hide all the radio buttons then User Vecihi Baltacl's answer will not work, you need to use this CSS:
input[type="radio"]{
visibility:hidden;
}
There are several way of hiding stuff it depending of what you want achieve:
hide because you don't need it or you will show it from js when some condition will be met. For this you should use display: none;. That elements are not in the DOM.
hide because you will do some crazy hack for eg. because you are lazy and you don want to modify POST or deal with date on backend. Then you should use visibility: hidden; that element are in the DOM.
-hide because you want to style it differently (and stupid :D browsers don't allow you to do that). This days is not recommended
because be have so many devices which behave in many different ways
that will cause some problem for eg. on mobile (of course not
always). For that you should use opacity: 0;. They render on page in place where they should be but are just not visible.
My personal favourite for this:
.container{
overflow: hidden;
position: relative;
}
.hidden-stuff{
position: absolute;
top: 0;
right: 0;
font-size: 30rem;
opacity: 0;
cursor: pointer;
z-index: 10;
}
There is nice way of styling radio buttons by css ninja http://www.thecssninja.com/css/custom-inputs-using-css
Related
I have a text on which when you hover (or when you click on it on mobile), a picture appear. I used this stackoverflow answer to make it work.
I'm now trying to make the picture change size automatically, so the picture fit both on mobile and computer.
a.hovertext1:after {
content: 'Text that appears before I hover.';
}
a.hovertext1:hover:after,
a.hovertext1:focus:after {
content: url(https://cdn.discordapp.com/attachments/1074330512925143102/1076897722075971675/5226579-le-drapeau-national-de-la-republique-federative-du-bresil-fond-d-ecran-du-drapeau-bresilien-avec-des-styles-de-degrade-d-ombre-gratuit-vectoriel.jpg);
display: block;
}
<a name="return1" id="return1"></a>
I know I need to add width:100%; somewhere in my code, but I have no idea where. I tried putting it in the a.hovertext1:focus:after{...} block, but it didn't do anything.
Hope someone can help me!
Is there any reason for which you want to use pseudo elements ? There is a different approach using simple display property on hover.
img {
display: none;
width: 100%;
}
a:hover + img {
display: block;
}
a:hover {
display: none;
}
Text that appears before I hover
<img class="img" src="https://images.unsplash.com/photo-1506744038136-46273834b3fb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1740&q=80" />
Also I suggest to use buttons instead of links. Buttons are used for actions that affect the website’s front-end; links are used for navigation and actions that don’t affect the website.
Hi guys following is the code I have and I need to change the value 'contact agent' to contact us ,but only using css
<input type="submit" name="submit-cmb" value="Contact Agent" class="button-primary">
Thanks for any help! please let me know if additional details required
Short: It's not possible, use JavaScript instead
document.querySelectorAll('input[type=submit]')[0].setAttribute("value", "Contact Us");
Long: CSS can't modify the DOM at all. You need to use HTML, whatever language is generating that HTML, or JavaScript.
JavaScript will allow you to manipulate the DOM at will, while HTML/PHP/etc will let you manipulate it prior to or at runtime.
This would be trivial with JavaScript (see above), but you can't physically add or remove elements or their attributes with CSS.
The only thing you could really do with CSS is to set set the color of the input to the same color as the background (or transparent) and then use a pseudo-element to put the text "Contact Us" there. It wouldn't modify the value submitted when the form is processed though, and it can't be added to "void elements" such as <input> (anything that self-closes with <element />)
This is the best you could do with CSS:
.parent-element {
position: relative;
}
.parent-element:after {
content: "Contact Us";
color: #000;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
pointer-events: none;
}
[name="submit-cmb"] {
color: transparent;
}
Note, again, that this would not actually change the value of the button, but "hide" the text on the button, and then put some different text over it. You'll have to adjust the positioning based on the actual layout though, but it would get you started if you REALLY can't modify the HTML or use JavaScript.
Also note that the :after element will interfere with clicks, so you need to make sure you can use pointer-events: none; - or use :before, set it below the z-index of the button, change the button background to transparent.... blah blah blah. You see this really can't/shouldn't be done.
.parent-element {
position: relative;
}
.parent-element:after {
content: "Contact Us";
color: #000;
position: absolute;
left: 5px;
top: 1px;
pointer-events: none;
}
[name="submit-cmb"] {
color: transparent;
}
<div class="parent-element">
<input type="submit" name="submit-cmb" value="Contact Agent" class="button-primary">
</div>
I am trying to creatre border to each option element from :
<select multiple class="myScrollDiv" name="selectedGroup" [(ngModel)]="selectedGroup">
<option *ngFor="let group of groupOptions" [ngValue]="group" class="myul-{{group.g}}" >
{{group.g}}
</option>
</select>
my css:
.myExtDialog .myScrollDiv
{ display: block;
height: 234px;
width : 100%;
overflow: auto;
border: none;
background-color:whitesmoke;
line-height: 16px;
text-align: left;
}
.myExtDialog .myScrollDiv option
{
border : 1px grey solid ;
}
the css works o.k. in chrome but in i.e. it doesn't show borders for the option tags .
how can i fix this ?
Unfortunately all browsers style their own form components differently so it's very unlikely you'll get the result you want using pure CSS that works across all main browsers.
This article is quite old but the information is still relevant - https://css-tricks.com/dropdown-default-styling/
It's easy to style the select tag itself (easier if you apply appearance: none; which will remove the browser's default styles), but not to style the option tags.
If you really need to style the option tags you might have to consider javascript.
I'm developing a website for mobile phones (mostly Blackberry).
I can't figure out how one develops like this. Some phones don;t support CSS. If I want a button with an up and a down state, how do I do it? I'd usually make an anchor, then put the image in the background, then I could control the background position with pseudo classes link and active.
<a id="btnSearch"></a>
#btnSearch{
height: 16px;
overflow: hidden;
background-image: url(img/btnSearch.png);
}
#btnSearch:link,
#btnSearch:visited,
#btnSearch:hover{
background-position:0 0;
}
#btnSearch:active{
background-position:0 -16px;
}
but I can't do this because some mobile devices will show nothing.
Well, if they don't support CSS, then you obviously can't get button effects such as those you describe. The best you can do is provide alternate text within the anchor:
<a id="btnSearch"><span>some text</span></a>
and hide that text in browsers that do support CSS:
#btnSearch > span {
display: none;
}
I am using the following CSS class to hide a textbox in an asp:UpdatePanel to accept input from a USB card reader.
<style type="text/css">
.USBBox
{
position: absolute;
left: -999em;
}
</style>
When I click an asp:LinkButton control that is configured to be an asp:AsyncPostBackTrigger for the update panel the control appears on the page and the CSS class is not applied to the asp:TextBox control.
This behavior is displayed in IE7. It works as expected in FireFox 3.5.7
What would cause this behavior and how do I resolve it
There my be a specificity issue. Try
input.USBBox{
position:absolute!important;
left:-999px!important;
}
And if it works, back out of the !important tags to see what actually caused the issue.
Also declare display:block; just in case.
I think you should use:
.USBBox
{
display: none;
}
or maybe use a asp:HiddenField instead of a textbox.
try
.USBBox
{
display: block;
width: 100px; /* or however wide you want it */
position: absolute;
left: -999em;
background: #ff0000; /* visually ensure the class style is being applied, remove it later */
}
position should only work on items that are displayed as a block. form items by default are displayed inline.
also just for giggles set the background color just to make sure the input box is taking class.
Could it be that the new control comes with multiple classes ?
Because IE is having issues when combining classes on a single element..