I cannot figure out why the height of this container(summaryBox) is not changing. I have tried setting the min-height, max-height and changing some other things but nothing is working. I wanted the height of the container to be 20% of the screen, but its not working. Everything else works fine and I am scratching my head.
CSS:
.summaryBox {
border: 1px solid green ;
width: 80%;
margin: auto;
overflow: hidden;
min-height: 20%;
}
.summaryBox .img1 {
width: 21%;
float: left;
color: white;
padding: 0px .5% 0px .5%;
}
.summaryBox .img2 {
width: 21%;
float: left;
color: white;
padding: 0px .5% 0px .5%;
}
.summaryBox .sum1 {
width: 21%;
float: left;
color: white;
padding: 0px .5% 0px .5%;
}
.summaryBox .sum2 {
width: 21%;
float: left;
color: white;
padding: 0px .5% 0px .5%;
}
.summaryBox .arrowPanelLeft {
float: left;
width: 6%;
color: white;
text-align: center;
}
.summaryBox .arrowPanelRight {
float: right;
width: 6%;
color: white;
text-align: center;
}
HTML:
<div class="summaryBox">
<div class="arrowPanelLeft">
<p><</p>
</div>
<div class="img1">
<p>dasfafgafdgdafgdfsgdsfgdfsgdsfg</p>
</div>
<div class="sum1">
<p>dasfafgafdgdafgdfsgdsfgdfsgdsfg</p>
</div>
<div class="img2">
<p>dasfafgafdgdafgdfsgdsfgdfsgdsfg</p>
</div>
<div class="sum2">
<p>dasfafgafdgdafgdfsgdsfgdfsgdsfg</p>
</div>
<div class="arrowPanelRight">
<p>></p>
</div>
</div>
You need to set the height of the html and body elements, as well. This is something 'CSS resets' (such as Eric Meyer's) will usually do for you. Append this code to your css file:
html, body {
height: 100%;
width: 100%;
padding: 0;
margin: 0;
}
You have set .summeryBox height to a percentage.. of what?
You need to add this to your css:
html, body {
height: 100%;
width: 100%;
padding: 0;
margin: 0;
}
Then the .summeryBox will be set relative to the body tag.
Alternatively you can set the outer container (.summeryBox) dimensions in pixels.
Related
I am using float: left to stack two divs side by side. I am then using clear: block to clear the float, but a small white space appears between the floated divs and the next div.
I have added overflow: none to every element on the page because I saw that as the solution that worked for other people with a similar issue, but that didn't fix the issue.
#featured-container {
position: relative;
width: 100%;
text-align: center;
margin-top: -60px;
}
#featured-header {
display: inline-block;
width: 240px;
height: 30px;
}
#featured-label {
float: left;
width: 160px;
height: 30px;
line-height: 30px;
text-align: center;
background: #EEEEEE;
font-weight: 700;
}
#featured-point {
float: left;
width: 0;
height: 0;
border-bottom: 30px solid #EEEEEE;
border-right: 30px solid transparent;
}
#featured {
display: inline-block;
width: 220px;
min-height: 220px;
padding: 10px;
background: #EEEEEE;
}
.clear {
clear: left;
}
<div id="featured-container">
<div id="featured-header">
<div id="featured-label">FEATURED</div>
<div id="featured-point"></div>
</div>
<div class="clear"></div>
<div id="featured">
</div>
</div>
EDIT: I know I can add a negative margin-top to the '#featured' box, but I would really like to understand why this problem exists.
Try changing the inline-block to inline-flex
#featured-header {
display: inline-flex;
width: 240px;
height: 30px;
}
Set font-size: 0; on the parent element. The space is a character space, so setting the font-size to zero makes the size of the space zero as well. But, you'll need to set the font size of the inline-block child elements back to your desired size.
#featured-container {
position: relative;
width: 100%;
text-align: center;
margin-top: 0px;
font-size:0px;
}
#featured-header {
display: inline-block;
width: 240px;
height: 30px;
}
#featured-label {
float: left;
width: 160px;
height: 30px;
line-height: 30px;
text-align: center;
background: #EEEEEE;
font-weight: 700;
font-size:18px;
}
#featured-point {
float: left;
width: 0;
height: 0;
border-bottom: 30px solid #EEEEEE;
border-right: 30px solid transparent;
}
#featured {
display: inline-block;
width: 220px;
min-height: 220px;
padding: 10px;
background: #EEEEEE;
font-size:16px;
}
.clear {
clear: left;
}
<div id="featured-container">
<div id="featured-header">
<div id="featured-label">FEATURED</div>
<div id="featured-point"></div>
</div>
<div class="clear"></div>
<div id="featured">
</div>
</div>
I'm trying to get the #footer div to stay at the bottom of the #content div and the #sidebar div, but what once worked elsewhere, doesn't seem to want to work anymore and I'm at a loss.
Works here: http://wiki.tf-575.com/index.php?title=RBL_Store
But not here: http://beta.tf-575.com/index.php?title=RBL_Store
body {
background: #020B12;
font: x-small sans-serif;
color: B3DFFC;
margin: 0;
padding: 0;
text-align: center;
}
#container {
background: #020B12 url(background-tile.png) top left repeat-y;
font: normal;
width: 100%;
margin: 0 auto;
text-align: left;
}
#header {
background: #020B12;
color: B3DFFC;
padding-top: 1px;
padding-bottom: 67px;
}
#sidebar {
background: none;
float: left;
margin-bottom: 84px;
padding: 0 1px;
width: 164px;
top: 80px;
position: absolute;
}
#content {
color: #446C90;
margin-top: -48px;
min-width: 960px;
font-size: 120%;
text-align: left;
padding: 0 20px 0 165px;
}
#footer {
background: url("footer.png") no-repeat scroll left bottom transparent;
clear: both;
color: #446C90;
font-size: 90%;
min-height: 82px;
margin: 0;
padding: 82px 0 0 165px;
text-align: center;
}
<body>
<div id="container">
<div id="header">
<snip />
</div>
<div id="sidebar">
<snip />
</div>
<div id="content">
<snip />
</div>
<div id="footer">
<snip />
</div>
</div>
</body>
Your problem is that on the beta site the sidebar is positioned absolute, so the float is ignored and the clear:both; doesn't push down the footer anymore
try setting the width of the footer to 100%
I am making website in html and css and I have a problem. In my css file I made id "full" which set wooden background after sidebar and it should continue on all page. In my class "picture" I made 80% width white panel - so there should be 80% white background in the middle and 10% edges should be wooden. It works correctly untill my article section, where I added some images of pizzeria. Immediately there is no wooden edges, only white. I don´t understand because my "full" id and "picture" class continue untill end of the body. Could somebody see where is error please?
Image showing error
* {
padding: 0;
margin: 0;
border: 0;
}
.container {
margin: auto;
overflow: hidden;
width: 100%;
}
#full {
background-image: url("http://newallpaper.com/wp-content/uploads/2014/01/Dark-Wood-620x387.jpg");
}
.picture {
margin: auto;
width: 80%;
background: white;
}
#pizzaObrazok {
background-image: url("img/pizzaCompleted.png");
width: 100%;
height: 210px;
margin: 0px;
}
nav {
float: left;
margin-left: 2px;
width: 100%;
height: 32px;
}
ul {
float: left
}
li {
display: inline;
border: 4px solid black;
font-size: 24px;
padding: 10px 64px;
background-color: #990000;
color: #ffffff;
}
li a {
color: #ffffff;
text-decoration: none;
padding-top: 8px;
padding-bottom: 5px;
vertical-align: middle;
}
#imgPizza {
width: 59%;
height: 270px;
padding-left: 190px;
padding-top: 30px;
padding-bottom: 30px;
}
article p {
font-size: 120%;
font-family: fantasy;
text-align: center;
margin-right: 160px;
}
#imgPizza2 {
width: 30%;
height: 270px;
position: absolute;
transform: rotate(345deg);
margin-top: 100px;
margin-left: 50px;
border: 6px solid red;
}
#imgPizza3 {
width: 30%;
height: 270px;
position: absolute;
margin-left: 390px;
margin-top: 100px;
transform: rotate(15deg);
border: 6px solid red;
}
#phone {
border: 2px solid black;
margin-top: 150px;
margin-right: 180px;
padding: 5px;
position: absolute;
display: inline;
text-align: center;
background: #ff4d4d;
}
<header>
<div id="pizzaObrazok">
</div>
</header>
<div id="full">
<section id="navigation">
<div class="container">
<nav>
<ul>
<li>ÚVOD</li>
<li>FOTO</li>
<li>JEDÁLNY LÍSTOK</li>
<li>KDE NÁS NÁJDETE</li>
<li>NÁZORY</li>
</ul>
</nav>
</div>
 
</section>
<div class="picture">
<img id="imgPizza" src="img/pizzacheese.jpg">
<aside id="phone">
<h2>Telefónne číslo:</h2>
<h2> 0905 741 963</h2>
</aside>
</div>
 
<div class="picture">
<article>
<p>U nás dostanete najchutnejšiu pizzu z výlučne kvalitných surovín</p>
<img id="imgPizza2" src="https://cdn.vox-cdn.com/uploads/chorus_image/image/50289897/pizzeria_otto.0.0.jpg">
<img id="imgPizza3" src="https://media-cdn.tripadvisor.com/media/photo-s/09/bc/74/79/pizzeria-du-drugstore.jpg">
</article>
</div>
</div>
You have your elements "#imgPizza2" and "#imgPizza3" whit position absolute outside your "#full" wrapper. You can do various things to achive the effect you are looking for but depends of many others things.
I think the simpliest way is to put your background image in to the body and not in the warpper "#full" or change the postion of your images among others.
body {
background-image: url("http://newallpaper.com/wp-content/uploads/2014/01/Dark-Wood-620x387.jpg");
}
It looks like the wood background is 620 x 387, so my first thought is that it is big enough to cover the first section but not the articles. Maybe add background-repeat: repeat-y; to your #full class and see if the wood border spreads further down the page.
I'm not an expert using css, after 1 hour of time spent on this problem I will ask the community.
my html code:
<div class="content2">
<div class="Menu">
All Investments (3)
Payouts (0)
</div>
...some other code
</div>
my css code:
.content2 {padding: 10px 30px; color: #fff}
.Menu {background: #022000; width: 1000px; height: 50px; margin: 20px auto; text-align: center}
.Menu a {float: left; height: 26px; width: 313px; padding: 12px 10px; color: #fff}
.Menu a:hover {background: #277521}
I would like the two items in my Menu class full fill the width of the navbar. Currently they don't take the complete width of the navbar.
Use width: 50%; and modify the padding as padding: 12px 0px;.
Explanation:
width: 50% : As there are 2 elements, this will enable each element to take 50% of the parent's width.
padding: 12px 0px : padding 0px for right and left helps remove the extra space required for each element.
.content2 {
padding: 10px 30px;
color: #fff
}
.Menu {
background: #022000;
width: 1000px;
height: 50px;
margin: 20px auto;
text-align: center
}
.Menu a {
float: left;
height: 26px;
width: 50%;
padding: 12px 0px;
color: #fff;
background-color: yellow;
}
.Menu a:hover {
background: #277521
}
<div class="content2">
<div class="Menu">
All Investments (3)
Payouts (0)
</div>
...some other code
</div>
Try following way.
Give width:50% and box-sizing: border-box; to a. And change height:50px;
.content2 {
padding: 10px 30px;
color: #fff
}
.Menu {
background: #022000;
width: 1000px;
height: 50px;
margin: 20px auto;
text-align: center
}
.Menu a {
float: left;
height: 50px;
width: 50%;
padding: 12px 10px;
color: #fff;
box-sizing: border-box;
}
.Menu a:hover {
background: #277521
}
<div class="content2">
<div class="Menu">
All Investments (3)
Payouts (0)
</div>
...some other code
</div>
Working Fiddle
Try it with flex. Add these styles:
.Menu {display: flex;}
.Menu a {flex: 1;}
This will work with any number of menu items, not only 2.
Tip: flex is a very powerful property and I suggest you research it a little if you are interested why my code works.
.content2 {
padding: 10px 30px;
color: #fff
}
.Menu {
background: #022000;
width: 1000px;
height: 50px;
margin: 20px auto;
text-align: center
}
.Menu a {
float: left;
height: 26px;
width: 50%;
padding: 12px 0px;
color: #fff;
background-color: yellow;
}
.Menu a:hover {
background: #277521
}
<div class="content2">
<div class="Menu">
All Investments (3)
Payouts (0)
</div>
...some other code
</div>
I have the following code:
<div id="conteudo">
<img id="logo" height="137" width="327" />
<div id="data_hora">
</div>
<div id="nome_patio">
<div id="cor_patio"></div> #NOME_PATIO#
</div>
</div>
css:
body
{
background-color: #000000;
margin: 0;
padding: 0;
font-family:Arial;
}
#conteudo
{
height: 100%;
width: 100%;
}
#data_hora
{
float: right;
font-size: 50px;
color: #E0E428;
margin-top: -90px;
margin-right: 40px;
}
#nome_patio
{
text-align: center;
font-size: 80px;
color: #E0E428;
width: 100%;
font-weight: bold;
}
#cor_patio
{
border: solid 1px #FFFFFF;
height: 10px !important;
width: 80px;
background-color: #E0E428;
margin-right: 20px;
}
So, i'm trying to change the div cor_patio height, but nothing happens... why?
OBS: when i remove font-size from nome_patio, it works fine.
try to set position:absolute; to home_patio, if it doesn't work, also set to cor_patio.
Set position:relative; to #nome_patio and position:absolute; to #cor_patio;
Hope it help.
You need to set your height on #nome_patio to 100%.
Working example: http://jsfiddle.net/aYnyk/
I solve the solution with this:
<div id="patio">
<span id="cor_patio"></span><span id="nome_patio">#NOME_PATIO#</span>
</div>
css:
#patio
{
text-align: center;
width: 100%;
}
#cor_patio
{
height: 63px;
width: 63px;
background-color: #E0E428;
margin-right: 30px;
}
#nome_patio
{
font-size: 80px;
color: #E0E428;
font-weight: bold;
}