1
<style type="text/css">
    .sf-menu { line-height: 1.0; margin:0px}
    .sf-menu ul { position: absolute; top: -10px; width: 10em;list-style-type: none; }
        .sf-menu ul li { width: 100%; }
    .sf-menu li:hover { visibility: inherit; }
    .sf-menu li { float:; position: relative; }
</style>

In float: how can change to left or right when culture change from rtl to ltr ?

4

1 回答 1

2

The semantically correct way is to set the correct direction attribute and then test it in CSS.

If you already set the direction in the html tag (as this example on W3.org does), then the CSS would look like:

.sf-menu { line-height: 1.0; margin:0px}
.sf-menu ul { position: absolute; top: -10px; width: 10em;list-style-type: none; }
.sf-menu ul li { width: 100%; }
.sf-menu li:hover { visibility: inherit; }
.sf-menu li { float:left; position: relative; }
html[dir="rtl"] .sf-menu li { float: right; } /* <<< here */
于 2012-10-24T08:51:50.137 回答