Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display "divs" horizontally? [duplicate]

Tags:

html

css

<div id="Content">
    <div id="loginContent"></div>
    <div id="signupContent"></div>
</div>

I have a root div here. I want to display the child divs horizontally. How to do this?

like image 376
Xiaojian Avatar asked Sep 18 '14 18:09

Xiaojian


1 Answers

You mean this?

Flexbox:

#Content {
  display: flex;
}

#loginContent {
  flex: 1;
}

#signupContent {
  flex: 1;
}

Floats:

#loginContent,
#signupContent {
  float: left;
  width: 50%;
}

Inline-block:

#Content {
  text-align: center;
}

#loginContent,
  #signupContent {
  display: inline-block;
}
like image 158
DeFeNdog Avatar answered Oct 19 '22 18:10

DeFeNdog