el-switch-related style operations in element-ui, scaled down, aligned to the right

scale down

.el-switch {
    
    
  transform: scale(0.5);
}

align right

There is an el-switch switch on the root of the el-tree in element-ui. I want to move the switch to the rightmost side of the outer div and align it. My code framework is roughly as follows:

<div>
	<el-tree>
		<span slot-scope="{node,data}">
			<span> {
    
    {
    
    node.label}} </span>
			<el-switch></el-switch>
		</span>
	</el-tree>
<div>

Implementation method:
add style=" position: relative;" to the outer div,
add el-switch: style=" position: absolute; right: 0;"

<div style="position: relative;">
  <el-tree>
    <span slot-scope="{node,data}">
      <span>{
    
    {
    
    node.label}}<span>
      <el-switch style="position: absolute; right: 0;"> </el-switch>
    </span>
  </el-tree>
</div>

Guess you like

Origin blog.csdn.net/Xidian2850/article/details/130500171