Reputation: 41909
I'm using GWT.
Is it possible with CSS to do the following if/else statement?
.unseen-activity div.unseen-label {
display: inline;
if using chrome { left: 510px; }
else { left: 470px; }
margin: 0 auto;
}
Or would it be better for my GWT Java code to check for browsers, and then add style accordingly?
Note - I'm not sure if it's possible in GWT to check the browser.
Thanks, Kevin
Upvotes: 3
Views: 2359
Reputation: 64541
GWT's CssResource
can do:
@if user.agent safari {
.unseen-activity div.unseen-label {
left: 510px;
}
}
@else {
.unseen-activity div.unseen-label {
left: 470px;
}
}
.unseen-activity div.unseen-label {
display: inline;
margin: 0 auto;
}
See https://developers.google.com/web-toolkit/doc/latest/DevGuideClientBundle#Conditional_CSS
Note: the safari
user agent matches all webkits; if you need something else, use a static method as your @if
test.
Upvotes: 5
Reputation: 5681
CSS is a pure style sheet language and has no options for decision making integrated. You will need to do it in java when using GWT, or using javascript.
Upvotes: 0