在一个班级中选择一个班级,使其有自己的一行

时间:2018-08-30 03:14:46

标签: html css tags

如何在班级中选择班级? CSS

需要这样做: 在“按钮”中选择“ fourthRow”,使类出现在自己的行上 另外,如果有人知道如何使此代码更有效,将不胜感激。代码很潮湿。

HTML:

<!DOCTYPE html>
    <html>
    <head>
    	<title>Calculator</title>
    	<link rel="stylesheet" type="text/css" href="style.css">
    </head>
    <body>
    <div class="buttons">
    	<div class="fourthRow">
    		<div>
    			<button class="7">7</button>
    		</div>
    		<div>
    			<button class="8">8</button>
    		</div>
    		<div>
    			<button class="9">9</button>
    		</div>
    		<div>
    			<button class="divide">&#247;</button>
    		</div>
    	</div>
    	<div class="thirdRow">
    		<div>
    			<button class="4">4</button>
    		</div>
    		<div>
    			<button class="5">5</button>
    		</div>
    		<div>
    			<button class="6">6</button>
    		</div>
    		<div>
    			<button class="multiplicaton">x</button>
    		</div>
    	</div>
    	<div class="secondRow">
    		<div>
    			<button class="1">1</button>
    		</div>
    		<div>
    			<button class="2">2</button>
    		</div>
    		<div>
    			<button class="3">3</button>
    		</div>
    		<div>
    			<button class="subtract">-</button>
    		</div>
    	</div>
    	<div class="firstRow">
    		<div>
    			<button class="0">0</button>
    		</div>
    		<div>
    			<button class="dot">.</button>
    		</div>
    		<div>
    			<button class="equal">=</button>
    		</div>
    		<div>
    			<button class="add">+</button>
    		</div>
    	</div>
    
    </div>
    
    </body>
    </html>

............................................... ......................

1 个答案:

答案 0 :(得分:0)

  • 在“按钮”中选择“ xRow”,并使该类显示在自己的行上:

-

.fourthRow, .thirdRow, .secondRow, .firstRow {
  display: flex;
}