How wo...">
All geek questions in one place

Positioning three divs with css

Who likes puzzles?;)

I have three divs:

<div id="login" />
<div id="content" />  
<div id="menu" />  

How would I define CSS styles (without touching HTML) to have the menu-div as the left column as the column, the login-div in the right column, and the content-div also in the right column, cases.

The width of each div is fixed, but the height is not equal.

+3
html css layout
Thomas danecker 25 sept. '08 at 15:47
source share
2 answers
#menu {
  position:absolute;
  top:0;
  left:0;
  width:100px;
}
#content, #login {
  margin-left:120px;
}

Why is that? The menu, the last in the markup, makes it tough. You can also swim with both the right to content and the rights of entry, and have added a clear right to the content, but I think this may be your best choice. Without seeing the bigger picture, it's hard to give a solution that will definitely work in your case.


EDIT: This also works:
#content, #login {
  float:right;
  clear:right
}

</" > : ( ), . , , - , - float, . , , , .

+6
Chris Marasti-Georg 25 . '08 15:54

... . .

#login {
  float: right;
  width: 400px;
  border: 1px solid #f00;
}

#content {
  clear: right;
  float: right;
  width: 400px;
  border: 1px solid #f00;
}

#menu {
  float: left;
  width: 400px;
  border: 1px solid #f00;
}
<div id="login">Login</div>
<div id="content">Content</div>
<div id="menu">Menu</div>
0
enobrev 25 . '08 15:57

Source: https://habr.com/ru/post/1697519/

More articles:

  • Subfolders in CodeIgniter - php
  • Can a TCP / IP stack be killed programmatically? - c #
  • How to execute a dynamic SQL query against MS Access 2003 through VBA? - access-vba
  • Is there a .Net replacement for GetAsyncKeyState? - api
  • Change column length - sql-server
  • PHP log / graph runtime - php
  • fork () as an argument - c
  • How to find out if the maximum file size was reached when using a stream? - c ++
  • Best way to handle multilingual support? - c #
  • How to search archive files using Perl - search

All Articles

Geek Questions | 2019