Jump to content

Two div on the same line/next to each other.


LeonLatex

Recommended Posts

I have two DIV. I want them on the same line next to each other. But no matter what I do, one will move above or below the other. Can anybody help me?

 

@charset "utf-8";
/* CSS Document */
div.wrapper {
    border: 1px solid;
	width: 100%;
	height: 100%;
}
div.top {
	border: thick;
	margin: auto;
	margin-top: 10px;
	width: 62.5%;
	height: 75px;
}
div.logo {
	background-image: url("../image/logo_bg_transp.png");
	width: 362px;
	height: 80px;
	margin-top: 10px;
}
div.bar {
	background-color: #006699;
	margin: medium;
	border-radius: 5px;
	box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
	margin: auto;
	width: 67.5%;
	height: 37.5px;
	padding: 15px;
}
div.main {
	border-radius: 5px;
	box-shadow: rgba(0, 152, 153, 0.2) 0px 2px 8px 0px;
	margin-top: 35px;
	margin: auto;
	width: 66.5%;
	height: 548px;
	padding: 10px;
}
div.menu {
	border: dotted;
	margin-top: 35px;
	margin-left: 15px;
	width: 200px;
	height: 400px;
}
div.footer{
	
}
<!doctype html lang="en">
<html>
<head>
<link rel='stylesheet' href='https://www.w3schools.com/w3css/4/w3.css'>
<link href="css/main.css" rel="stylesheet" type="text/css">
<meta charset="utf-8">
<title></title>
</head>
<body>
	<div class="top"><div class="logo"></div></div>
	<div class="bar"></div>
	<div class="menu"></div>
	<div class="main"></div>
	<div class="footer"></div>
</body>
</html>

 

Edited by LeonLatex
Link to comment
Share on other sites

Tthanks barry. I have tried that one, but ir's not working. I paste my css so you can watch it and maybe tell me whats wrong?, or what i'am doing wrong.

 

div.main {
	display: inline-block;
	border-radius: 5px;
	box-shadow: rgba(0, 152, 153, 0.2) 0px 2px 8px 0px;
	margin-top: 35px;
	margin: auto;
	width: 66.5%;
	height: 548px;
	padding: 10px;
}
div.menu {
	display: inline-block; 
	border: dotted;
	margin-top: 35px;
	margin-left: 15px;
	width: 200px;
	height: 400px;
}

 

Link to comment
Share on other sites

14 hours ago, LeonLatex said:

My screen resolution is 1920X1080

Keep in mind that the 775 (pixels) mentioned by Barand is more than just your monitor's resolution. I also have a monitor with 1920x1080 resolution. When my Chrome browser window is maximized, for example, the window width is 1920 pixels. If you happen to have any browser side panels open, the browser width will be less. The other thing that might be causing an issue with the percentage layout breaking is your browser zoom level.

When my browser window is maximized (1920px wide) and the zoom level is set to 100%, I see 2 columns when testing your CSS code. However, if I bump that zoom level to 300%, the menu column gets shoved to the bottom of the page.

Link to comment
Share on other sites

  • 3 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.