通过css标签选择器,id选择器,class选择器设置html的行高为100px
时间: 2024-04-29 09:21:46 浏览: 9
可以使用以下CSS代码来设置HTML文档的行高为100px:
```css
/* 使用标签选择器设置行高 */
html {
line-height: 100px;
}
/* 使用ID选择器设置行高 */
#html-id {
line-height: 100px;
}
/* 使用class选择器设置行高 */
.html-class {
line-height: 100px;
}
```
请注意,标签选择器会将整个HTML文档的行高都设置为100px,而ID选择器和class选择器只会将具有相应ID或class属性的元素的行高设置为100px。
相关问题
通过class选择器,设置以下样式: 1、设置 class 为 title 的 p 标签内文字样式:字体加粗、字体大小:18px。 2、设置 class 为 head 的 p 标签内文字样式:字体加粗、字体大小:18px、高:40px、行高:40px、颜色:#F39F18。以下是部分代码: <body> <div class="div1" > <p class="title">公司长期招聘以下岗位:</p> <p class="h
ead">职位名称</p> </div> </body> 相应的CSS代码如下:
.title {
font-weight: bold;
font-size: 18px;
}
.head {
font-weight: bold;
font-size: 18px;
height: 40px;
line-height: 40px;
color: #F39F18;
}
注意,CSS代码中的 ".title" 和 ".head" 分别对应 HTML 代码中的 class 名称。
要使表格行高为18px,正确的写法是
可以使用CSS的属性`line-height`设置表格行的高度,正确的写法是:
```css
tr {
line-height: 18px;
}
```
需要注意的是,这样设置会将表格中所有行的高度都设置为18px,如果只想针对某些特定的行生效,可以给这些行添加class或者id,并在CSS中使用相应的选择器。