I'm using Chrome and I'm getting a weird display for the primefaces p:selectOneMenu:
And sometimes it is shown correctly like this:
I couldn't find any css rule to override, any one faced this before?
Add this to your css file:
.ui-selectonemenu-label{
width:100% !important;
}
.ui-selectonemenu{
width:100% !important;
}
Related
I'm using Java to create dinamically images and put them into a jsp page.
This works fine in all browsers, except for IE 7.
I'm using Data URIs in my jsp to populate tags (I'm using a base64 string).
I've found many solutions for IE, but no one refers to images dinamically created in Java.
This is one of the solutions found with css:
/*
Content-Type: multipart/related; boundary="MYSEPARATOR"
--MYSEPARATOR
Content-Location: myimage
Content-Transfer-Encoding: base64
iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAIAAAA7ljmRAAAAGElEQVQIW2P4DwcMDAxAfBvMAhEQMYgcACEHG8ELxtbPAAAAAElFTkSuQmCC
--MYSEPARATOR--
*/
#test1 {
width: 100px;
height: 100px;
background-image:url(mhtml:http://......./test.css!myimage);
}
It works but I can't change in css the base64 string dinamically.
How can I solve this problem for explorer 7?
Thanks in advice.
For solution to this problem You can try the following things:-
First of all see that the html version you are using is html4 or html5 because these both support cross browse compatability.
2.Try changing CSS Transparency settings for all browsers.
Try using the following code:-
a.transeffect:hover {
filter:alpha(opacity=50);
-moz-opacity:0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
}
If the above code doesn't work then try by removing the -khtml-opacity: 0.5; line from the code.
I was browsing to find a solution for a long time, but I did not find a suitable answer.
I'm developing a JSF web appication using RichFaces library. Application supports different locales, and user is able to change them by selecting from dropdown list.
I want the items in dropdown list to have a flag icons along the locale name.
Unfortunately, I could not find the way to do it with JSF.
The xthml code for the dropdown list is:
<h:panelGroup>
<h:form id="languageForm" prependId="false">
<h:outputText value="#{usermsg['locale.select.message']}" styleClass="userMessage"/>
<h:selectOneMenu id="dropdown" value="#{localeBean.selectedLocale}" onchange="submit()">
<f:selectItems value="#{localeBean.locales}" />
</h:selectOneMenu>
</h:form>
</h:panelGroup>
Flag icons are simply done with plain HTML and JQuery, like I've found here: http://www.ixtendo.com/polyglot-language-switcher-jquery-plugin/
To put the icon in the dropdown list item, I have to apply the css for each element in list, like:
#en {
background-image: url(/resources/images/flags/gb.png);
}
#fr {
background-image: url(/resources/images/flags/fr.png);
}
The problems here are:
f:selectItems (as well as f:selectItem) does not seem to support style property.
I could apply styles to tags using javascript, but I need to have IDs for tags, which f:selectItem (seems) does not allow as well.
The other thing I thougt is to use JQuery control mentioned in the link above, but here is another problem: how to set the value of the selected option to JSF bean. In other words, can I set #{localeBean.selectedLocale} through JQuery or Javascript and plain HTML?
I have found that PrimeFaces has a selectOneMenu control, which allows adding icons http://www.primefaces.org/showcase/ui/selectOneMenu.jsf (the one named 'Content with Filter')
but I'm affraid we cannot afford to switch from RichFaces to PrimeFaces at the moment.
Any help is appreciated.
I have found a solution myself. I figured that I'm able to add ids or classes to html tags with jQuery, so what I've done, I've added the following script:
<script type="text/javascript">
$(document).ready(function() {
$('option').each(function(){
$(this).addClass(this.value);
});
});
</script>
And css:
option {
background-repeat: no-repeat;
background-position: right;
}
.en {
background-image: url(/resources/images/flags/gb.png);
}
.fr {
background-image: url(/resources/images/flags/fr.png);
}
...
I used classes because I have two menus with flags in my app, but this works with ids as well.
The script adds the class to JSF-generated tags, so there is no longer an issue to send value back to managedBean.
Thanks everyone.
I just faced an interesting thing concerning HTML widget. The thing is...
If a word length is too long per line then HTML widget becomes wider to have it all placed in
so my question is... is it possible to make HTML widget to cut by pieces long words not to getting wider itself?
Comparing to Swing, I mean the effect something like JTextArea does when word wrapping is off (see image)
EDIT
I tried to use css word-break: break-all; here is the code:
composite code:
public MyTestUI(){//constructor
html.setStyleName("my-test");
}
public void setLongWord(String word)//method
{
html.setHTML(word);
}
css
.my-test {
color:gray;
font-family:verdana;
white-space: normal;
word-break: break-all;
}
... the css works in Chrome but doesn't in FF :( How to make the word breaking the crossbrowser one ?
GWT version 2.3
Any useful comment is much appreciated
Use CSS property word-wrap:break-word as described in following link. This will work even if the HTML widget is having static height and width.
http://www.w3schools.com/cssref/css3_pr_word-wrap.asp
Use CSS property word-break:normal; or try word-break:hyphenate;
Add a CSS style to your HTML widget to break long words:
http://www.w3schools.com/cssref/css3_pr_word-break.asp
EDIT:
I stay corrected: word-wrap is a better option. See more:
What is the difference between "word-break: break-all" versus "word-wrap: break-word" in CSS
I tested the following jQuery on a jQueryfied page to inject custom CSS code to the page:
jQuery('head').append('<style type=\"text/css\">body { background: #000; }</style>');
After that, the background of the page immediately turns black, so far so good. But if i try that with Selenium 2 (Java), i do not see any reaction:
((JavascriptExecutor) webDriver).executeScript("jQuery('head').append('<style type=\"text/css\">body { background: #000; }</style>');");
jQuery is loaded correctly. Any ideas why that does not work?
why use an awkward style tag injection that depends on jQuery? Why not use something simple like
document.body.style.backgroundColor = '#000';
Is it possible to change the header style of a rich:simpleTogglePanel ?? The font of the header is always "bold" and I want it to be normal.
I tried with the style attribute this way: style="font-weight:normal" without result.
Any idea?
Have you tried putting the !important at the end of your style definition(i.e. style="font-weight:normal !important;")?
Also, as I'm sure you are aware, it is usually better to specify your style in a separate stylesheet. I've customized the <rich:extendedDataTable in this manner (not sure if this is a hack or not, but it works great for me). Open your page in a browser and then crack open the developer tools (press F12 in Firefox with FireBug installed, or in Chrome right click on the rich:SimpleTogglePanel and click 'Inspect Element'. This will let you see the CSS definition name used by the RichFaces framework. Just create a new .css file and define the style you want using the name you find RichFaces is using.
/*This class defines styles for a table cell.*/
/*tableBorderWidth, tableBorderColor border-bottom*/
/*tableBorderWidth, tableBorderColor border-right*/
.rf-edt-c {
border-bottom: 1px solid #021e2f;
border-right: 1px solid #021e2f;
height: auto !important;
min-height: 26px;
}
As you can see, you may need to specify the !important tag there as well, but it keeps the style outside of your page...
Hope this helps.