N Sharma
N Sharma

Reputation: 34487

How to design layout as like expected layout

I need to create this kinda layout using html and css .

enter image description here

I code for this layout using div tag.

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;
}

It is looking like this

enter image description here

Upvotes: 0

Views: 52

Answers (2)

Ricky Dam
Ricky Dam

Reputation: 1895

Williams, how's this?

.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>

Upvotes: 2

Dinesh undefined
Dinesh undefined

Reputation: 5546

Use css to style. give border and border radius. you will get what you want.

.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>

Upvotes: 2

Related Questions