Html 如何使用css更改html列表上的字体大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21059763/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to change font size on html list using css
提问by Siberia
O. Guys. i got an apex app and i am using Jquery Mobile Theme, but basically i got some list items i need to display on my screen, but my screen is a handheld, which has small screen size, so when i display the list item the size is too big, i will like to reduce font size. in my apex html page i got a "CSS Inline"section and actually got some code like this one below in which i reduced the font size of text and number fields, but i don't know how to reduce font size of list item, i guess is easy but actually i am new on html and css stuff..
哦,伙计们。我有一个 apex 应用程序,我正在使用 Jquery 移动主题,但基本上我有一些列表项需要在我的屏幕上显示,但我的屏幕是手持设备,屏幕尺寸很小,所以当我显示列表项时,大小太大了,我想减小字体大小。在我的 apex html 页面中,我得到了一个“CSS Inline”部分,实际上得到了一些像下面这样的代码,其中我减小了文本和数字字段的字体大小,但我不知道如何减小列表项的字体大小,我想这很容易,但实际上我是 html 和 css 方面的新手。
thanks in advance.
提前致谢。
input[type="text"] {font-size:8px}
input[type="number"] {font-size:8px}
回答by Haji
you can apply the font size for list item as below in css file
您可以在 css 文件中应用如下列表项的字体大小
ul li{
font-size:8px;
}
In inline css:
在内联 css 中:
<ul >
<li style="font-size:50px";>item1</li>
</ul>
回答by Damodar Dahal
Give your UL class a name:
为您的 UL 课程命名:
<ul class="bigFont">
Add your <li>
items
添加您的<li>
项目
<li>Hello world</li>
<li>Hello world1</li>
</ul>
add style
添加样式
.bigFont li{
font-size:8px;
}
回答by yeion7
If is a list, you can do
如果是一个列表,你可以做
@media screen and (max-width: 400){
ul li {
font-size: .8em;
}
}
- nested in media query for only apply in small screen
- if you have a link nested in li, select tag a or put class name
- is a good practice use unit relative
- 嵌套在媒体查询中,仅适用于小屏幕
- 如果你有一个嵌套在 li 中的链接,请选择标签 a 或输入类名
- 是一个很好的做法,使用单位相对