2017-06-17 34 views
0

我需要使用htmlcss創建此種佈局。使用div標籤此佈局如何設計佈局如預期的佈局

enter image description here

我的代碼。

class App extends Component { 
    render() { 
    return (
     <div className="AppTitle"> 
     <b>Score:</b> 
     <div> 
      <button type="button">Rock</button> 
      <button type="button">Paper</button> 
      <button type="button">Scissors</button> 
     </div> 
     </div> 
    ); 
    } 
} 

App.css

.AppTitle { 
    margin: 100px; 
} 

它看起來像這樣

enter image description here

回答

2

使用CSS樣式。給邊界和邊界半徑。你會得到你想要的。

.AppTitle{ 
 
padding:50px; 
 
} 
 

 
button{ 
 

 
padding:20px; 
 
border:1px solid blue; 
 
border-radius:10px; 
 
background-color: Transparent; 
 
}
<div class="AppTitle"> 
 
     <u><b>Score:</b></u> 
 
     <div> 
 
      <button type="button"> 
 
      Rock 
 
      </button> 
 
      <button type="button">Paper</button> 
 
      <button type="button">Scissors</button> 
 
     </div> 
 
     </div>

2

威廉姆斯,這個怎麼樣?

.mainContainer { 
 
    width: 500px; 
 
    height: 200px; 
 
    border: 2px solid black; 
 
    background-color: lightgray; 
 
} 
 

 
.top { 
 
    width: 100%; 
 
    height: 100px; 
 
    background-color: lightgray; 
 
    display: table-cell; 
 
    vertical-align: middle; 
 
    padding-left: 100%; 
 
} 
 

 
#score { 
 
    margin-top: 50px; 
 
    display: inline; 
 
} 
 

 
.third { 
 
    width: 30%; 
 
    height: 100px; 
 
    background-color: lightgray; 
 
    display: inline-block; 
 
} 
 

 
button { 
 
    padding: 20px; 
 
    border: 2px solid blue; 
 
    border-radius: 10px; 
 
    width: 100px; 
 
}
<div class="mainContainer"> 
 
    <div class="top"> 
 
    <span id="score"><b> Score: </b></span> 
 
    </div> 
 
    <center> 
 
    <div class="third"> 
 
     <button type="button"> Rock </button> 
 
    </div> 
 
    <div class="third"> 
 
     <button type="button"> Paper </button> 
 
    </div> 
 
    <div class="third"> 
 
     <button type="button"> Scissors </button> 
 
    </div> 
 
    </center> 
 
</div>