I've searched around here and elsewhere to for a solution to this problem, but nothing I've tried has worked. The googleplex abounds with samples, but many just don't seem to fit my needs or depend heavily on tricks I can't understand.
Basically, I am trying to create a dashboard. I gave up on .css when I couldn't get things even. I have 3 rows. The most amount of columns per row is 3, and one row will be 2/3 and 1/3, and another row will be 50/50 (top row is 1/3, 1/3 and 1/3). When I couldn't get .css to have the columns even (the third 1/3 was shifting down, or off center from the rest of the row), I switched to .
When there was limited content in the tiles in the dashboard I was able to get the columns/rows distributed evenly (using width/height: 33.3%). If I resized the browser the tiles shrunk to a point where (as expected) if the window was minimized to much left/right only some of the tiles appeared. Not great - I was hoping that even if the content disappeared that I could minimize left/right as far as the browser would let me and see 3 equal columns || || || like that. But ok, no biggie.
Well, I put content in the bottom left tile (3x3 tile grid) and of course it expanded. Now I tried everything (border-collapse, white-space, overflow: hidden, etc.) and still can't get it the way I want.
I am stumped. I understand that at a certain point the browser is going to force things to overflow (lets say arbitrarily this should happen at 800x600), but I was hoping my display would shrink appropriately (tiles get smaller equally) and that the scrollbars inside the tiles would show up on the y-axis (overflow-y) so the user could scroll the text. I even tried 800x600 min/max width/height, but I couldn't get it to work.
Any advice would be appreciated.
This is my html snippet:
<div id="dashboard">
<table cellpadding="0" cellspacing="10">
<tr>
<td class="dashboard-tile onethird">
<div id="Alerts">
<div class="content">
<header> <span>Alerts</span> </header>
<section> Content Here </section>
<footer> Link </footer>
</div>
</div>
</td>
<td class="dashboard-tile onethird">
<div id="Matters">
<div class="content">
<header> <span>Matters</span> </header>
<section> Content Here </section>
<footer> Link </footer>
</div>
</div>
</td>
<td class="dashboard-tile onethird">
<div id="RecentActivity">
<div class="content">
<header> <span>Recent Activity</span> </header>
<section> Content Here </section>
<footer> Link </footer>
</div>
</div>
</td>
</tr>
<tr>
<td class="dashboard-tile onethird">
<div id="Alerts">
<div class="content">
<header> <span>Alerts</span> </header>
<section> Content Here </section>
<footer> Link </footer>
</div>
</div>
</td>
<td class="dashboard-tile onethird">
<div id="Matters">
<div class="content">
<header> <span>Matters</span> </header>
<section> Content Here </section>
<footer> Link </footer>
</div>
</div>
</td>
<td class="dashboard-tile onethird">
<div id="RecentActivity">
<div class="content">
<header> <span>Recent Activity</span> </header>
<section> Content Here </section>
<footer> Link </footer>
</div>
</div>
</td>
</tr>
<tr>
<td class="dashboard-tile onethird">
<div id="Alerts">
<div class="content">
<header> <span>Alerts</span> </header>
<section> Content HereContent Here Content HereContent Here Content Here Content Here Content Here Content Here Content Here Content Here Content HereContent HereContent HereContent HereContent HereContent Here Content Here Content Here Content Here Content HereContent Here Content HereContent Here Content Here Content Here Content Here Content Here Content Here Content Here Content HereContent HereContent HereContent HereContent HereContent Here Content Here Content Here Content Here Content HereContent Here Content HereContent Here Content Here Content Here Content Here Content Here Content Here Content Here Content HereContent HereContent HereContent HereContent HereContent Here Content Here Content Here Content Here </section>
<footer> Link </footer>
</div>
</div>
</td>
<td class="dashboard-tile onethird">
<div id="Matters">
<div class="content">
<header> <span>Matters</span> </header>
<section> Content Here </section>
<footer> Link </footer>
</div>
</div>
</td>
<td class="dashboard-tile onethird">
<div id="RecentActivity">
<div class="content">
<header> <span>Recent Activity</span> </header>
<section> Content Here </section>
<footer> Link </footer>
</div>
</div>
</td>
</tr>
</table>
</div>
And this is my .css:
#dashboard { height: 100%; }
#dashboard table { height: 100%; width: 100%; border:0; margin: 0px; padding: 0; }
#dashboard table tr { height: 33.3%; }
#dashboard table td { vertical-align: top; height: 33.3%; min-width: 33.3%; min-height: 33.3%; max-width: 33.3%; max-height: 33.3%; overflow: hidden; }
#dashboard table td.onethird { width: 33.3%; }
.dashboard-tile { background-color: #650000; border: 1px solid #790000; }
.dashboard-tile .half {}
.dashboard-tile .twothird {}
.dashboard-tile .full {}
.dashboard-tile .content { margin: 5px 10px; overflow-y: auto; -webkit-overflow-scrolling: touch; color:#fff; }
.dashboard-tile header { font-size: 1.3em; font-weight:bold; width:100%; float:left; padding: 0px 0px 5px 0px; }
.dashboard-tile header span { float: left; text-transform: uppercase; }
.dashboard-tile section { margin-top:35px; }
.dashboard-tile footer{ }
.dashboard-tile footer span { font-weight:bold; }
It's really not clear what you want, but I'm going to try to answer anyway.
It's fairly simple to make a fluid design with thirds and halves.
li{ width:33%; float:left;}
or alternatively,
li{ width:50%; float:left;}
Also, on a small screen, dividing text into three columns is not ideal for legibility. Consider using media queries like this:
#media screen and (max-width:600px){
li{width:100%}
}
To simplify layouts for small screens.
Here is an example of the above concepts.
EDIT:
Here is a slightly different and simplified solution:
html{height:100%;}
body{height:100%;}
div{width:33.333333%; height:33.333333%; float:left; overflow:auto;}
.twothirds{width:66.666666%;}
.half{width:50%;}
Demo
Related
I am trying to make a footer by css and want the footer to be the bottom of page, however, some content are stretch to inside the footer,
the following are my footer css
#footer {
position: fixed;
bottom: 0;
width: 100%;
}
<div id="footer" style="background-color:#0099CC">
<center>
<table style="width:100%">
<tr>
<td valign="top">Copyright © 2016, Chaatz</td>
<td align="right" style="white-space:pre">Terms and Conditions
Privacy Notice</td>
</tr>
</table>
</center>
<br>
<br>
</div>
You can use the height of the footer element as a padding-bottom of the content and negate the same value in margin-top of the footer element.
<div class="wrapper">
page content
</div>
<div class="footer">
footer content
</div>
.wrapper{
height:100%;
padding-bottom:150px;
}
.footer{
height:150px;
margin-top:-150px;
}
I am using bootstrap for responsive design.
I want contents to auto-fill depend on the screen size (Which bootstrap allows in-built). Although it is not working when I am connecting to the big monitor (22 inch)
See as below:
Picture 1 (on my Laptop); Covers the entire screen
Picture 2 on Big Monitor (Notice the empty area in the bottom)
(Between Header 6 and End of Browser window)
I expect Headers and contents will be displayed big to cover the entire screen
HTML as below:
<div class="container-fluid">
<div class="row" >
<table class="table">
<tr>
<td><img alt="Bootstrap Image Preview" src="Images/Logo.png"></td>
<td align="right"><img alt="Bootstrap Image Preview" src="Images/Header_RequestExpress.png"></td>
</tr>
</table>
</div>
<div class="row" style="border:1px solid; color:Red;">
<div class="col-md-4" style="border:1px solid; color:green;">
<h2>Categories</h2>
<!--Images Carousel Here-->
</div>
<div class="col-md-8">
<div class="row" style="border:1px solid; color:blue;">
<div class="col-md-12">
<h2>Locations</h2>
<!--Images Carousel Here-->
</div>
</div>
<div class="row" style="border:1px solid; color:Maroon;">
<div class="col-md-12">
<h2>Location Current Requests</h2>
<h1>Header 1</h1>
<h2>Header 2</h2>
<h3>Header 3</h3>
<h4>Header 4</h4>
<h5>Header 5</h5>
<h6>Header 6</h6>
</div>
</div>
</div>
</div>
Apply height:100vh;to the container div.
In your example, on your laptop it was just lucky to appear that way, with the content you filled as you didn't put any rule for the page to be full-height.
You either have to proportion .table and .row vertically.
Example:
.table {
height: 30vh;
}
.row {
height: 70vw;
}
Or let's say the table height is 100px and you want the other part to be filled for the rest of the screen, you can apply:
.table {
height: 200px;
}
.row {
height: calc(100vh - 200px);
}
NOTE I'd suggest you add another class as well to the div .row as that class can be used other places as well, as the Bootstrap provides it.
I'm creating my first web page and I have 3 boxes with an image and text as contet. How do I make the boxes the same height regardless of the content?
New to css etc so please help.
I have tried padding, margin etc but nothing. My code is as follows:
<!------------------------------ Three Small Span Boxes --------------------------->
<div class="container-full-width" id="boxes_lite_section">
<div class="container" >
<div class="container-fluid" >
<!-- Start of markup for boxes lite element -->
<div id="widget_boxes_container" class="row-fluid" >
<div class="boxes">
<div class="box span4">
<p>
***
</p>
<a class="box-link">
<img class="box-image" src=".jpg" />
</a>
<p align="justify" style="margin-top:20px">
content here funding.
</p>
</div>
<!--end box1-->
<div class="box span4">
<p>
***
</p>
<a class="box-link">
<img class="box-image" src=".jpg" />
</a>
<p align="justify" style="margin-top:20px">
content here
</p>
</div>
<!--end box2-->
<div class="box span4">
<p>
***
</p>
<a class="box-link">
<img class="box-image" src=".jpg" />
</a>
<p align="justify">
content here
</p>
</div>
<!--end box3-->
</div>
<!-- end boxes -->
</div><!-- end row-fluid -->
<!-- End of markup for boxes lite element -->
</div>
<!-- .container-fluid-->
</div>
<!-- .container -->
</div>
<!----------------------------- End Three Small Span Boxes ------------------------->
When you set the height for an element, it will be shown with this regardless of the content.
BUT if the content become taller than height, the result may be very ugly.
so, it's better to set overflow:auto in your case, that will save the box height when content is taller...
div.box {
width: 350px; /*for example*/
height:300px; /*for example*/
background: blue; /*for example*/
color:white; /*for example*/
overflow:auto; /*for example*/
border:4px solid red; /*for example*/
}
You can see result Here and you can find out your last question you mentioned in comment...
If you want to hide overflow, try overflow:hidden instead...
If you are dealing with variable height you can use CSS tables to render your divs.
div.boxes { display:table-row; }
div.box { display:table-cell; }
This jsfiddle should give you an indication of what it will look like with your layout.
Practically every major browser supports CSS tables now, so feel free to use them when necessary. Fixed heights are ok, but can cause issues when your content grows beyond your original expected size.
My float works...kind of..however I'm having a problem when resizing my browser. I would like the text to wrap around the div when the screen gets smaller however it's just squishing to the right in a long line of text to the bottom.
Here are some pics.
This is when it's wider
and then this is what it's doing when I resize the browser
my html kind of looks like this
<div class="info">
<div class="userInfo">
<p>info here</p>
<img>
</div>
<div class="bio">
<p>paragraph</p>
<p>paragraph</p>
<p>paragraph</p>
</div>
</div>
and my css looks like this
.userInfo{
float: left;
}
.bio p{
padding-left: 14em;
}
You will have to move your paragraphs inside the same div as the image, and float the actual image. Something like this:http://jsfiddle.net/cLcJu/
As you can see the code is very simple:
<div class="userInfo">
<p>some content above the image</p>
<img src='path_to_image'>
<p>A bunch of content to the right of and underneath the image</p>
</div>
and the css
.userInfo img {
display: block;
float: left;
padding: 10px;
}
This should work:
HTML
<div class="info">
<div class="userInfo">
<p>info here</p>
<img src="image">
<p>paragraph</p>
</div>
</div>
CSS
.userInfo img { float: left; }
I have this page which is actually rendered fine in all browsers, meaning.. when browser is contracted, to show mobile version of the layout, based on #media query css settings, but not in IE8, as far as I can check. How do I get around of this problem.
Here is all the code btw:
<html>
<head><style>
body{margin:0px; padding:0px;}
#a{height:150px; background-color:#ffffff; border-bottom:1px solid #CCC;}
#x{min-height:350px; margin-top: 10px; background-color:#CCC;}
#y{min-height:30px; margin-top: 10px; background-color:#CCC;}
#media all and (min-width:700px){
#b{width:100%; min-height:400px;}
#sep {
margin: auto;
overflow: hidden;
width: 960px;
}
#x{width:65%; float:left;}
#y{width:32%; float:right; }
#c{background-color:#656565; height:80px;}
.for-mob{display:none;}
.for-desc{background-color:green;}
}
#media all and (max-width:700px){
.for-mob{background-color:green;}
.for-desc{display:none;}
#b{width:100%; min-height:400px; }
#x{width:100%; display:block; }
#y{width:100%; display:block; }
#c{background-color:#656565; height:100px;}
}
</style></head>
<body>
<div id='a'> <h1>I am header </h1>
</div>
<div id='b'>
<div id='sep'>
<div id='x'>
<h1>I am content </h1>
<h1>I am content </h1>
<h1>I am content </h1>
<h1>I am content </h1>
<h1>I am content </h1>
<h1>I am content </h1>
<h1>I am content </h1>
<h1>I am content </h1>
<h1>I am content </h1>
<h1>I am content </h1>
<h1>I am content </h1>
<h1>I am content </h1>
</div>
<div id='y'>
<h1>I am sidebar </h1>
</div>
</div>
</div>
<div class='for-desc'><h1>If you shrink the browser, I become invisible</h1> </div>
<div class='for-mob'><h1>If you maximize the browser, I become invisible</h1></div>
<div id='c'>
<h1> I am a simple footer </h1>
</div>
</body>
Response.js only creates rules on elements, to emulate the media query use
https://code.google.com/p/css3-mediaqueries-js/
It would be better to include a specific css only for IE<9 but it is up to you :)