Set text aligment on the right side - css

I have table with left text alignment. How I can only set the checkbox to be with right text alignment?
<h:panelGroup styleClass="table-right">
<h:selectBooleanCheckbox value="#{bean.method}"> </h:selectBooleanCheckbox>
</h:panelGroup>
.table-right {
text-align: right;
}
HTML output:
<tr>
<td>Security Question</td>
<td><textarea id="form:securityquestion" name="form:securityquestion" cols="60" rows="3" onblur="mojarra.ab(this,event,'blur',0,'form:securityquestionvalidator')"></textarea><span id="form:securityquestionvalidator"></span></td>
</tr>
<tr>
<td>Security Answer</td>
<td><textarea id="form:securityanswer" name="form:securityanswer" cols="60" rows="3" onblur="mojarra.ab(this,event,'blur',0,'form:securityanswervalidator')"></textarea><span id="form:securityanswervalidator"></span></td>
</tr>
Is there any solution to change just the cell alignment of the checkbox with CSS?

.table-right input[type="checkbox"] {
float: right;
}
This should align your checkbox to right

This css is not working
.table-right {
text-align: rigth;
}
because you have typo rigth is not word. It must be right.

Use correct typo as in place of [text-align: rigth]
.table-right {
text-align: right;
}

Try to paste styleClass="table-right" to selectBooleanCheckbox section. And Try to use !important rule on css.
Like: <h:selectBooleanCheckbox styleClass="table-right" value="#{bean.method}"> </h:selectBooleanCheckbox>
.table-right {
text-align: right !important;
}

Related

Pinpoint table section within td tr table class

I am wanting to pinpoint the attribute size element which shows 3XL and make the width smaller. But I am struggling to pinpoint it in CSS!
Website screen shot
At the moment I have
table.variations td.value {
}
But this pinpoints the entire section of the column including the "clear" button. I have tried:
table.variations td.value .attribute_size {
}
But this also does not work.
Please help!
Thanks!
Beck
You have to pinpoint the select option within the td.value field. Then you can style it anyway you wish.
HTML
<table class="variations">
<tbody>
<tr>
<td class="value">
<select id="size" name="attribute_size">
<option>Choose an option</option>
<option value="2XL">2XL</option>
<option value="3XL">3XL</option>
</select>
CLEAR
</td>
</tr>
</tbody>
</table>
CSS
table.variations td.value {
font-size: 12px;
}
select#size {
color: white;
background-color: blue;
font-size: 42px;
}
JSFiddle.

Codemirror editor cursor set to the right

I have to align my textarea on the right of the page. So I have my textarea code as follows.
<td align="right" >
<textarea style="align:left" id="scriptevalresult" name="scriptevalresult" cols="64" rows="4"></textarea>
</td>
Because I have align="right" for the , my codemirror editor is set to the right of the editor.
how to resolve this.
You can add a CSS rule like .CodeMirror { text-align: left; } to override this.

Align Checkboxes Horizontally (Table Layout)

I have checkboxes as shown in http://jsfiddle.net/Lijo/Fw3fz/. I need to align the checkboxes horizontally. How to align them using CSS?
Note: The following HTML code is generated from ASP.NET. I cannot change this HTML code.
<table id="Checkboxlist1">
<tr>
<td><input id="Checkboxlist1_0" type="checkbox" name="Checkboxlist1$0" value="red" /><label for="Checkboxlist1_0">Red</label></td>
</tr><tr>
<td><input id="Checkboxlist1_1" type="checkbox" name="Checkboxlist1$1" value="blue" /><label for="Checkboxlist1_1">Blue</label></td>
</tr><tr>
<td><input id="Checkboxlist1_2" type="checkbox" name="Checkboxlist1$2" value="green" /><label for="Checkboxlist1_2">Green</label></td>
</tr>
</table>
Create a CheckBoxList and set the horizontal layout property:
<asp:CheckBoxList ID="cbl" runat="server" RepeatDirection="Horizontal">
<asp:ListItem>Red</asp:ListItem>
<asp:ListItem >Blue</asp:ListItem>
<asp:ListItem>Green</asp:ListItem>
</asp:CheckBoxList>
More info:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.checkboxlist.repeatdirection.aspx
You have to change the trs display property: http://jsfiddle.net/Fw3fz/4/
​#Checkboxlist1 tr{
display:inline-block;
margin-right:20px;
}​
Or, use float: http://jsfiddle.net/Fw3fz/10/
#Checkboxlist1 tr{
float:left;
margin-right:20px;
}​
If you want some space between the checkboxes and the labels, add this snippet:
#Checkboxlist1 tr label{
margin-left:5px;
}
However, it's very uncommon to display table rows inline or to float them. If possible, change the HTML structure.
#Checkboxlist1 tr {
float: left; // or diplay: inline-block
margin-right: 15px;
}
#Checkboxlist1 td label {
margin-left: 5px;
}
DEMO
If you are using ASP.NET Framework 4, you can check following properties:
CheckBoxList.RepeatDirection Property:
Gets or sets a value that indicates whether the control displays vertically or horizontally.
CheckBoxList.RepeatLayout Property (to get rid of table layout)
Gets or sets a value that specifies whether the list will be rendered by using a table element, a ul element, an ol element, or a span element.
Either put them in different cells but in one line (tr), or lose the table and use css float.

jQuery UI - icon alignment

In the following example, I'm trying to get the text, input box and icon to align without over lapping.
http://jsfiddle.net/zGZM7/2/
Is there some css I'm missing?
Thanks
Edit, sadly I need a solution which will work with FF and IE6 :(
You have a lot of irrelevant CSS in your fiddle and the only relevant bit isn't getting called as it in your example requires to be under a ul with id #icons. Removing the ul#icons with the following:
.ui-icon {float: left; margin: 0 4px;}
Should make it work as you described.
example:
http://jsfiddle.net/niklasvh/kTFw7/
Split them in different tds
<table>
<tr>
<td>Foo</td>
<td><input type=text id=Foo class=textInput></td>
<td></td>
</tr>
</table>
or
add style float:left to the input
<td>
<input type=text id=Foo class=textInput style="float:left">
</td>
or like Niklas's idea
.ui-icon {float: right; margin: 0 2px;}

style input tag

ASP.Net has a tag called CheckboxList. The output of this tag looks like this:
<table class="checkbox">
<tbody>
<tr>
<td>
<input id="/*longdynamicstring1*/" type="checkbox" name="/*longdynamicstring2*/" />
<label for="/*longdynamicstring1*/">Label Text</label>
</td>
</tr>
</tbody>
</table>
I want to position the label and the input but I cannot find out how. Tried the following:
.checkbox input{
padding-right: 5px;
}
and
.checkbox input[type='checkbox']
{
padding-right: 5px;
}
but neither of them had any effect. Because it's ASP I cannot set a class for the input elements and I cannot reference the id because it's dynamic.
Your selector works well, it's just that padding has no effect on the check box. Margin will work, for example:
.checkbox input {
margin-right: 50px;
}
See it in action: http://jsbin.com/irari
In addition, take a look at the RepeatLayout property - it can make the generated HTML more CSS friendly.

Resources