how to add multiple box inside a box - html

i was trying to add multiple box inside another but i am not getting as i want please help!why i am getting line only?i added display and overflow attributes still i am getting so
style.css
#charset "utf-8";
body {
margin:0;
padding:0;
background:url(../images/back1.png);
background-repeat:repeat;
}
.logomainbox {
width: 100%;
height: 50px;
margin: 10px;
background: linear-gradient(#FC8E03, #FF9801);
}
.menubar {
width: 100%;
height: 50px;
margin: 10px;
background: linear-gradient(#DADADA,#C8C6C6);
}
.imageslide {
width: 100%;
height: 275px;
margin: 10px;
background: linear-gradient(#FC8E03, #FF9801);
}
.textdiscription {
width: 60%;
height: 400px;
margin-left:20%;
margin-right:20%;
border:3px solid red;
}
.textare {
width: 100%;
height: 100px;
border: 1px solid blue;
}
.box {
height: 250px;
wedith: 30%;
border: 1px solid green;
display:inline-block;
overflow:auto;
}
index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="css/style.css">
<title>Home</title>
</head>
<body>
<div class="logomainbox">
</div>
<div class="menubar">
</div>
<div class="imageslide">
</div>
<div class="textdiscription">
<div class="textare">
</div>
<center>
<div class="box">
</div>
<div class="box">
</div>
<div class="box">
</div>
</center>
</div>
</body>
</html>
what i want
what i am getting

The problem is that you have wedith instead of width. Change your code to:
.box {
height:250px;
width:30%;
border: 1px solid green;
display:inline-block;
overflow:auto;
}

You have a spelling issue,
.box
wedith:30%

Related

How to draw responsive rectanges inside fixed size rectangle in HTML and CSS?

I can draw such inner rectanges inside fixed size rectange but these are not responsive.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Test div dimension</title>
<style>
#main {
width: 640px;
height: 360px;
border: 1px solid black;
}
#content {
width: 100%;
}
#slide {
border: 1px solid red;
width: calc(640*0.75px);
height: calc(360*0.75px);
float: right;
}
#camera {
border: 1px solid red;
width: calc(640 * 0.25px);
height: calc(360 * 0.25px);
float: left;
}
</style>
</head>
<body>
<div id="main">
<div id="content">
<div id="slide">
Rectange 1
</div>
<div id="camera">
Rectange 2
</div>
</div>
</div>
</body>
</html>
How can I create such responsive inner rectanlges inside fixed size rectangle?
height: 100%; is also required in #content
#content {
width: 100%;
height: 100%;
}
#slide {
border: 1px solid red;
width: 75%;
height: 75%;
float: right;
}
#camera {
border: 1px solid red;
width: 25%;
height: 25%;
float: left;
}

CSS media queries assistance

I'm working on a practice project to learn some of the core foundations of CSS, and HTML. Currently I'm having trouble getting my webpage to become responsive, with media queries, I have other projects that media queries work with, but this one in specific isn't, any solutions?
<!DOCTYPE html>
<link rel="stylesheet" href="resumecss.css">
<meta name="viewport" content="width=device-width">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<body>
<title></title>
<meta name="description" content="Our first page">
<div class="box">
<img class="chung" src="chungus.png">
<h1 class="top">Cameron Marshall</h1>
</div>
<div class="container">
<div class="a">Contact Info:</div>
<div class="b">Skills:</div>
<div class="c">Objective:</div>
<div class="d">Work Experience:</div>
<div class="e"></div>
</div>
</body>
</head>
</html>
body{
margin:0;
padding:0;
height:100%;
}
.box{
background-color:lightblue;
height:350px;}
img{
height:200px;width:200px;
border-radius:50%;
border:solid 2px black;
display: block;
margin-left: auto;
margin-right: auto;
background-color:white;
position:relative;
top:20px;}
.top{
text-align:center;
font-size:4rem;
position:relative;
top:20px;}
.container{
max-width:100%;
margin-left: auto;
margin-right: auto;}
.container{
width:50%;
height:100%;
border: 8px solid black;
display:flex;
flex-wrap: wrap;
}
.a{
width:100%;
height:200px;
background-color:grey;}
.a {text-align:center;}
.b{
width:50%;
height:600px;
background-color:lightgrey;}
.c{
width:50%;
height:600px;
background-color:lightgrey
;}
.d{
width:100%;
height:400px;
background-color:white;}
.e{
width:100%;
height:200px;
background-color:grey;}
#media screen and(max-width:500px){
h1{color:blue;}}
***I'm attempting to just change the color of the title text when minimized below 500 px, I cant seem to get any media queries to work even with a basic design. ***
Turns out to be a missing blank space here:
#media screen and (max-width:500px) {
^
You had:
#media screen and(max-width:500px) {
Notice no space between and(.
Sometimes it's the little things...
body {
margin: 0;
padding: 0;
height: 100%;
}
.box {
background-color: lightblue;
height: 350px;
}
img {
height: 200px;
width: 200px;
border-radius: 50%;
border: solid 2px black;
display: block;
margin-left: auto;
margin-right: auto;
background-color: white;
position: relative;
top: 20px;
}
.top {
text-align: center;
font-size: 4rem;
position: relative;
top: 20px;
}
.container {
max-width: 100%;
margin-left: auto;
margin-right: auto;
}
.container {
width: 50%;
height: 100%;
border: 8px solid black;
display: flex;
flex-wrap: wrap;
}
.a {
width: 100%;
height: 200px;
background-color: grey;
}
.a {
text-align: center;
}
.b {
width: 50%;
height: 600px;
background-color: lightgrey;
}
.c {
width: 50%;
height: 600px;
background-color: lightgrey;
}
.d {
width: 100%;
height: 400px;
background-color: white;
}
.e {
width: 100%;
height: 200px;
background-color: grey;
}
#media screen and (max-width:500px) {
h1 {
color: blue;
}
}
<!DOCTYPE html>
<link rel="stylesheet" href="resumecss.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<body>
<title></title>
<meta name="description" content="Our first page">
<div class="box">
<img class="chung" src="chungus.png">
<h1 class="top">Cameron Marshall</h1>
</div>
<div class="container">
<div class="a">Contact Info:</div>
<div class="b">Skills:</div>
<div class="c">Objective:</div>
<div class="d">Work Experience:</div>
<div class="e"></div>
</div>
</body>
</head>
</html>

Why is there a gap when I use float right? [duplicate]

This question already has answers here:
What is a clearfix?
(10 answers)
What methods of ‘clearfix’ can I use?
(29 answers)
Closed 2 years ago.
I am trying to make two divs one div takes up 1/3 of the page and the other takes up 2/3 of the page but when I use float:left and float:right the div on the right has a strange gap above it. I am trying to make the width 1440px for now and transform it the percentage later. Does anyone know why it's doing this?
HTML:
main{
width: 1440px;
margin: 0px auto;
float: left;
}
header{
height: 80px;
background-color: cadetblue;
}
nav{
background-color: darkslategray;
height: 50px;
margin: 20px;
width: 200px;
}
.row1{
margin: 0px auto;
}
.height1{
height:400px;
}
.height2{
height: 300px;
}
.height3{
height:420px;
}
.column1{
width: 480px;
background-color: #000;
}
.column2{
width: 960px;
background-color: coral;
}
.float-left{
float:left;
}
.float-right{
float: right;
}
.red{
background-color: #d11242;
}
.blue{
background-color: #00447c;
}
.gray{
background-color: #717073;
}
<!DOCTYPE html>
<html>
<head>
<title>Untitled Document</title>
<meta charset="UTF-8">
<meta name="description" content="" />
<meta name="keywords" content="" />
<link href="CSS/reset.css" rel="stylesheet" type="text/css">
<link href="CSS/main.css" rel="stylesheet" type="text/css">
</head>
<body>
<main>
<header>
<nav class="float-right">
</nav>
</header>
<div class="height1 row1 red">
<div class="height1 column1 float-left"></div>
<div class="height1 column2 float-right"></div>
</div>
<div class="height2 row1 blue"></div>
<div class="height3 row1 gray"></div>
</main>
</body>
</html>
Your header nav element is causing the displacement.
Check your nav styles and remove either the margin or the fixed height. Another option would be to change the height to 100% and remove the margin and use padding with a box-sizing change.
<main>
<header>
<nav class="float-right">
</nav>
</header>
<div class="height1 row1 red content-wrapper">
<div class="height1 column1 float-left"></div>
<div class="height1 column2 float-right"></div>
</div>
<div class="height2 row1 blue"></div>
<div class="height3 row1 gray"></div>
</main>
main{
width: 1440px;
margin: 0px auto;
float: left;
}
header{
height: 80px;
background-color: cadetblue;
}
nav{
background-color: darkslategray;
height: 50px;
margin: 20px;
width: 200px;
}
.row1{
margin: 0px auto;
}
.height1{
height:400px;
}
.height2{
height: 300px;
}
.height3{
height:420px;
}
.column1{
width: 480px;
background-color: #000;
}
.column2{
width: 960px;
background-color: coral;
}
.float-left{
float:left;
}
.float-right{
float: right;
}
.red{
background-color: #d11242;
}
.blue{
background-color: #00447c;
}
.gray{
background-color: #717073;
}
.content-wrapper{
position: relative;
display: block;
width: 100%;
background: red;
overflow: hidden;
}
I guess the problem is with your height pixels. You should not give height as pixels. Instead of pixels try using in %. I have made some changes in CSS, can try that.
main{
width: 1440px;
margin: 0px auto;
float: left;
}
header{
height: 30%;
background-color: cadetblue;
}
nav{
background-color: darkslategray;
height: 50px;
margin: 20px;
width: 200px;
}
.row1{
margin: 0px auto;
}
.height1{
height:100%;
}
.column1{
width: 480px;
background-color: #000;
}
.column2{
width: 960px;
background-color: coral;
}
.float-left{
float:left;
}
.float-right{
float: right;
}
.red{
background-color: #d11242;
}
.blue{
background-color: #00447c;
}
.gray{
background-color: #717073;
}
Can you please check the below code link? Hope it will work for you. This issue occurs as you have given fixed height in header and more margin to nav so, nav overflows outside of the header.
Please refer to this link: https://jsfiddle.net/yudizsolutions/8gxLu2mn/1/
main {
width: 1440px;
margin: 0px auto;
float: left;
}
header {
height: 80px;
background-color: cadetblue;
}
nav {
background-color: darkslategray;
height: 50px;
margin: 15px;
width: 200px;
}
.row1 {
margin: 0px auto;
}
.height1 {
height: 400px;
}
.height2 {
height: 300px;
}
.height3 {
height: 420px;
}
.column1 {
width: 480px;
background-color: #000;
}
.column2 {
width: 960px;
background-color: coral;
}
.float-left {
float: left;
}
.float-right {
float: right;
}
.red {
background-color: #d11242;
}
.blue {
background-color: #00447c;
}
.gray {
background-color: #717073;
}
<!DOCTYPE html>
<html>
<head>
<title>Untitled Document</title>
<meta charset="UTF-8">
<meta name="description" content="" />
<meta name="keywords" content="" />
<link href="CSS/reset.css" rel="stylesheet" type="text/css">
<link href="CSS/main.css" rel="stylesheet" type="text/css">
</head>
<body>
<main>
<header>
<nav class="float-right">
</nav>
</header>
<div class="height1 row1 red">
<div class="height1 column1 float-left"></div>
<div class="height1 column2 float-right"></div>
</div>
<div class="height2 row1 blue"></div>
<div class="height3 row1 gray"></div>
</main>
</body>
</html>

Div 100% height inside Div is not working

I am designing a dashboard interface for myself. I am having some problems with inner divs, my leftpane div is set to 100% height inside the parent but it is overflowing parent div by the amount of 50px which is the height of topbar. Please suggest me why it is overflowing, 100% should mean whatever available space there is, isn't it?
here is my css and html
html, body {
height:100%;
margin: 0px;
}
.wrapper {
width: 100%;
height: 700px;
margin: auto;
border: 1px solid black;
display: table;
}
.topbar {
height: 50px;
background: #353535;
background-color: #353535;
clear:both;
color: white;
width: 100%;
position:relative;
}
.leftpane {
width: 20%;
height: 100%;
background-color: #eee;
float: left;
border-right: 2px solid #353535;
}
.content {
width: 79%;
height: 100%;
float:right;
border: 2px solid red;
}
.content-header {
height: 50px;
background-color: #353535;
width: 100%;
}
.content-area {
height:100%;
width: 100%;
border: 2px solid green;
}
<html>
<head>
<title>GUYACOM - Suivi de la connectivité</title>
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/style2.css" />
<!-- <link rel="stylesheet" href="css/bootstrap.css" /> -->
<!--<link rel="stylesheet" href="css/colorbox.css" /> -->
<!-- <script type="text/javascript" src="js/tinybox.js"></script> -->
</head>
<body>
<div class="wrapper">
<div class="topbar"><h1>
</h1></div>
<div class="content-area">
<div class="leftpane">
</div>
<div class="content">
<div class="content-header">
</div>
</div>
</div>
</div>
</body>
</html>
Try this it may help you...
<html>
<head>
<title>GUYACOM - Suivi de la connectivité</title>
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/style2.css" />
<style>
html, body {
height:100%;
margin: 0px;
}
.wrapper {
width: 100%;
height: 100%;
margin: auto;
border: 1px solid black;
display: table;
}
.topbar {
height: 50px;
background: #353535;
background-color: #353535;
clear:both;
color: white;
width: 100%;
position:absolute;
}
.leftpane {
width: 20%;
height: 100%;
background-color: #eee;
float: left;
border-right: 2px solid #353535;
}
.content {
width: 79.5%;
height: 100%;
float: left;
border: 2px solid red;
}
.content-header {
height: 50px;
background-color: #353535;
width: 100%;
}
.content-area {
height:100%;
width: 100%;
border: 2px solid green;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="topbar"><h1>
</h1></div>
<div class="content-area">
<div class="leftpane">
</div>
<div class="content">
<div class="content-header">
</div>
</div>
</div>
</div>
</body>
</html>

html select droplist not working inside div

I've been working on a webpage but due to some problems I don't know why my drop list is not working. However when placed outside the div it does work. I would be grateful if someone can help me please. The html and the css files are attached below.
below is the html codes:
#charset "utf-8";
/* CSS Document */
body {
padding: 0;
margin: 0;
background-image: url("background.jpg");
background-repeat: no-repeat;
}
canvas {
border: 1px dashed rgb(200, 200, 200);
}
.outer {
display: table;
position: absolute;
height: 100%;
width: 100%;
}
.middle {
display: table-cell;
vertical-align: middle;
}
#div_canvas {
float: left;
width: 900px;
height: 600px;
background-color: #FFF;
margin-left: 50px;
padding: 0;
}
#div_menu {
background-color: rgba(255, 255, 255, 0.4);
border-radius: 10px;
border: 1px solid gray;
float: right;
width: 300px;
height: 600px;
word-wrap: break-word;
margin-right: 50px;
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="mycss.css">
</head>
<body>
<!--Menu-->
<div class="outer">
<div class="middle">
<div id="div_menu">
<br/>
<center>
<select id="action">
<option value="1">Line</option>
<option value="2">Freehand</option>
</select>
</center>
</div>
</div>
</div>
<!--Canvas-->
<div class="outer">
<div class="middle">
<center>
<div id="div_canvas">
<canvas id="canvas" width="899" height="599"></canvas>
</div>
</center>
</div>
</div>
</body>
</html>
Your second .outer Is in front of your selectbox.
Give the first .outer a z-index: 1;
They are overlapping, don't open new divs for the canvas like this:
#charset "utf-8";
/* CSS Document */
body {
padding: 0;
margin: 0;
background-image: url("background.jpg");
background-repeat: no-repeat;
}
canvas {
border: 1px dashed rgb(200, 200, 200);
}
.outer {
display: table;
position: absolute;
height: 100%;
width: 100%;
}
.middle {
display: table-cell;
vertical-align: middle;
}
#div_canvas {
float: left;
width: 900px;
height: 600px;
background-color: #FFF;
margin-left: 50px;
padding: 0;
}
#div_menu {
background-color: rgba(255, 255, 255, 0.4);
border-radius: 10px;
border: 1px solid gray;
float: right;
width: 300px;
height: 600px;
word-wrap: break-word;
margin-right: 50px;
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="mycss.css">
</head>
<body>
<!--Menu-->
<div class="outer">
<div class="middle">
<div id="div_menu">
<br/>
<center>
<select id="action">
<option value="1">Line</option>
<option value="2">Freehand</option>
</select>
</center>
</div>
</div>
</div>
<!--Canvas-->
<center>
<div id="div_canvas">
<canvas id="canvas" width="899" height="599"></canvas>
</div>
</center>
</div>
</div>
</body>
</html>