[英]How to get the accessibility font size for iOS and Android in Xamarin.Forms so I can change font-size in a HTML WebView?
[英]How can I get font-size 0 to work in Android?
我的drupal表單包含以下內容:
$form['update'] = array(
'#type' => 'submit',
'#value' => t('Update cart'),
'#submit' => array('uc_cart_view_form_submit'),
'#attributes'=> array('class' => 'update_cart'),
);
和相關的CSS:
#edit-update.update_cart
{
float : left;
border:0 none;
font-size:0;
cursor:pointer;
}
#edit-update.update_cart {
background: url('/themes/mytheme/images/cart_page/update-cart.png') no-repeat scroll left top transparent;
float: left;
height: 22px;
width: 115px;
}
在Chrome瀏覽器中,字體大小0起作用並且不顯示文本。 這是我想要的行為,因為還有其他CSS添加了背景圖片:
但是,在我的Android平板電腦上,您可以看到文本。 如何使文本不顯示? 我無法更改form元素中的值,因為我需要該值來測試按下了哪個提交按鈕(頁面上有4個)。
如何使用文本縮進?
text-indent:-9999px;
上面的方法對我不起作用,因此我繼續搜索,發現了一個很棒的解決方案。 您必須調用零寬度 字體類型(webfont) ,如下所示:
@font-face{
font-family: 'zero-width';
src: url('//cdn.jsdelivr.net/font-zero-width/1.0.0/zero-width.eot');
font-weight: normal;
font-style: normal;
}
@font-face{
font-family: 'zero-width';
src: url(http://:/) format("No-IE-404"),
url('//cdn.jsdelivr.net/font-zero-width/1.0.0/zero-width.woff') format('woff'),
url('//cdn.jsdelivr.net/font-zero-width/1.0.0/zero-width.svg') format('svg'),
url('//cdn.jsdelivr.net/font-zero-width/1.0.0/zero-width.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
然后將其應用於必要的元素:
.element-to-set-the-font-to-zero{
font-family: 'zero-width';
}
演示: http : //jsfiddle.net/johnslegers/bczxxp6r/
甚至更好的解決方法是: color: transparent;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.