This question already has answers here:
How to remove the space between inline/inline-block elements?
(41 answers)
Closed 6 years ago.
In the following code, I am not able to understand that why is there a small margin between the green li's Home , Products , Services , About Us, Contact
I have set the margin and padding to 0px in both .ul and .li properties. Then why is there a gap between the green li's?
*{
box-sizing:border-box;
}
html,body {
margin: 0px;
height: 100%;
width: 100%;
left: 0px;
top: 0px;
background-color: rgba(173,192,241,1);
}
.wrapper {
height: 725px;
max-width: 960px;
margin-left: auto;
left: 0px;
top: 0px;
/* [disabled]background-color: rgba(15,26,155,1); */
margin-right: auto;
position: relative;
}
.topimage {
width: 100%;
max-width: 960px;
height: 100%;
max-height: 175px;
/* [disabled]background-color: rgba(0,102,204,1); */
position: absolute;
/* [disabled]border: thin solid rgba(255,0,0,1); */
}
.topimage img{
max-width: 100%;
max-height: 100%;
/* [disabled]margin-bottom: -9px; */
display: block;
margin-right: auto;
margin-left: auto;
border-radius: 15px 15px 0px 0px;
}
.menu {
background-color: rgba(15,26,155,1);
height: 100%;
max-height: 50px;
max-width: 960px;
position: relative;
top: 175px;
}
.list {
color: rgba(0,0,0,1);
text-decoration: none;
margin-right: auto;
margin-left: auto;
background-color: rgba(255,0,0,1);
padding: 0px;
}
.list li {
display: inline-block;
margin-right: 0px;
margin-left: 0px;
width: auto;
text-align: center;
background-color: rgba(204,255,0,1);
position: relative;
padding: 0px;
}
.content {
width: 100%;
height: 500px;
background-color: rgba(20,35,214,1);
position: relative;
top: 175px;
padding-right: 0.5%;
padding-left: 0.5%;
}
.leftcontent {
background-color: rgba(210,238,252,1);
float: left;
height: 100%;
max-height: 500px;
width: 100%;
max-width: 85%;
top: 0px;
position: relative;
border-left-color: rgba(205,205,205,1);
/* [disabled]margin-left: 0.3%; */
}
.rightcontent {
background-color: rgba(51,177,236,1);
float: right;
height: 100%;
max-height: 500px;
width: 100%;
max-width: 15%;
position: relative;
top: 0px;
/* [disabled]margin-right: 0.3%; */
}
.footer {
}
<div class="wrapper">
<div class="topimage">
</div>
<div class="menu">
<ul class="list">
<li>Home</li>
<li>Products</li>
<li>Services</li>
<li>About Us</li>
<li>Contact</li>
</ul>
</div>
<div class="content">
<div class="leftcontent">
</div>
<div class="rightcontent">
</div>
</div>
</div>
If you have no new lines between the list elements then it works. So you could put all on one line (see snippet) or add font-size: 0; to the <ul>
ul {font-size:0;}
*{
box-sizing:border-box;
}
html,body {
margin: 0px;
height: 100%;
width: 100%;
left: 0px;
top: 0px;
background-color: rgba(173,192,241,1);
}
.wrapper {
height: 725px;
max-width: 960px;
margin-left: auto;
left: 0px;
top: 0px;
/* [disabled]background-color: rgba(15,26,155,1); */
margin-right: auto;
position: relative;
}
.topimage {
width: 100%;
max-width: 960px;
height: 100%;
max-height: 175px;
/* [disabled]background-color: rgba(0,102,204,1); */
position: absolute;
/* [disabled]border: thin solid rgba(255,0,0,1); */
}
.topimage img{
max-width: 100%;
max-height: 100%;
/* [disabled]margin-bottom: -9px; */
display: block;
margin-right: auto;
margin-left: auto;
border-radius: 15px 15px 0px 0px;
}
.menu {
background-color: rgba(15,26,155,1);
height: 100%;
max-height: 50px;
max-width: 960px;
position: relative;
top: 175px;
}
.list {
color: rgba(0,0,0,1);
text-decoration: none;
margin-right: auto;
margin-left: auto;
background-color: rgba(255,0,0,1);
padding: 0px;
}
.list li {
display: inline-block;
margin-right: 0px;
margin-left: 0px;
width: auto;
text-align: center;
background-color: rgba(204,255,0,1);
position: relative;
padding: 0px;
}
.content {
width: 100%;
height: 500px;
background-color: rgba(20,35,214,1);
position: relative;
top: 175px;
padding-right: 0.5%;
padding-left: 0.5%;
}
.leftcontent {
background-color: rgba(210,238,252,1);
float: left;
height: 100%;
max-height: 500px;
width: 100%;
max-width: 85%;
top: 0px;
position: relative;
border-left-color: rgba(205,205,205,1);
/* [disabled]margin-left: 0.3%; */
}
.rightcontent {
background-color: rgba(51,177,236,1);
float: right;
height: 100%;
max-height: 500px;
width: 100%;
max-width: 15%;
position: relative;
top: 0px;
/* [disabled]margin-right: 0.3%; */
}
.footer {
}
<div class="wrapper">
<div class="topimage">
</div>
<div class="menu">
<ul class="list">
<li>Home</li><li>Products</li><li>Services</li><li>About Us</li><li>Contact</li>
</ul>
</div>
<div class="content">
<div class="leftcontent">
</div>
<div class="rightcontent">
</div>
</div>
</div>
Try this -
.list li {
float: left;
list-style: none;
width: auto;
text-align: center;
background-color: rgba(204,255,0,1);
position: relative;
}
Replace with above css with your existing .list li class
You can remove space created by inline-block element as with following trick.
Or you can use float instead of inline-block.
.list {
letter-spacing: -4px;
font-size: 0;
}
.list li {
display: inline-block;
vertical-align: top;
letter-spacing: 0;
font-size: 14px;
}
Or you can use float:
.list {
overflow: hidden;
}
.list li {
float: left;
}
Just add this into your code,
.list{
font-size:0;
}
.list li{
font-size:20px;
padding:0px 0px 0px 10px;
}
I want div in div height set auto.
http://bit.ly/rubikss1
at the bottom of the div inside is coming out. I want the bottom div to extend to.
Please Help!
body,html{height:100%}
.wrapper{
width: 700px;
height: 100%;
margin: 25px auto;
overflow:hidden;
position: relative;
}
.inner-container{
width: 100%;
height: 100%;
float: left;
border-radius: 5px;
background: rgba(255,255,255,.5);
position: relative;
}
.button-container{
float: left;
width: 100%;
height: 35px;
position: absolute;
z-index: 2;
}
#prev, #next{
border: 0;
background: #5CB85C;
padding: 5px 10px;
color: #fff;
border-radius: 2px;
cursor: pointer;
font-size: 18px;
}
#next{
float: right;
}
#prev{
float: left;
}
#verilistesi{
float: left;
width: 700px;
height: 100%;
position: relative;
overflow: hidden;
}
#verilistesi .item-container{
width: 100%;
float: left;
}
#verilistesi .item-container .item{
width: 500px;
height: 100%;
background: rgba(0,0,0,.3);
margin-bottom: 35px;
margin-top: 50px;
position: relative;
overflow: hidden;
}
My css.
How i do set auto height two div? Please give help?
I think that is what you want:
body,html{height:100%}
.wrapper{
width: 700px;
height: auto;
margin: 25px auto;
overflow:hidden;
position: relative;
}
.inner-container{
width: 100%;
height: auto;
float: left;
border-radius: 5px;
background: rgba(255,255,255,.5);
position: relative;
}
.button-container{
float: left;
width: 100%;
height: 35px;
position: absolute;
z-index: 2;
}
#prev, #next{
border: 0;
background: #5CB85C;
padding: 5px 10px;
color: #fff;
border-radius: 2px;
cursor: pointer;
font-size: 18px;
}
#next{
float: right;
}
#prev{
float: left;
}
#verilistesi{
float: left;
width: 700px;
height: auto;
position: relative;
overflow: hidden;
}
#verilistesi .item-container{
width: 100%;
float: left;
}
#verilistesi .item-container .item{
width: 500px;
height: 100%;
background: rgba(0,0,0,.3);
margin-bottom: 35px;
margin-top: 50px;
position: relative;
overflow: hidden;
}
Really simple issue. Fished around the site a bit, nothing seems to work.
I have a sticky navigation on the bottom of my site that isn't sticking to the bottom! It isn't respecting my height rules and is overflowing without regards.
Things I've tried:
Clearfix
Overflow
Table display
Tried everything i know of honestly.
What i'm aiming for visually:
Fiddle Link
CSS / HTML / Demo
.fn {
width: 100%;
height: 100%;
max-height: 41px;
bottom: 0;
left: 0;
position: absolute;
background-color: #fff;
}
.fn ul {
text-align: center;
margin: 0;
padding: 0;
list-style: none;
}
.fn li {
display: inline-block;
}
.fn a {
display: block;
padding: 10px 5px 10px 30px;
text-decoration: none;
font-family: "Raleway", sans-serif;
font-size: 1.15em;
letter-spacing: 0.05em;
color: #000;
}
.fn .first {
margin-right: 45.5px;
background-image: url(http://s28.postimg.org/f3f2a8mnd/fi2.png);
background-repeat: no-repeat;
background-position: left center;
background-size: 25px 25px;
top: -14px;
position: relative;
}
.fn .mid {
height: 55px;
bottom: 0;
margin: 0 auto;
z-index: 9998;
}
.fn .mid img {
height: 100%;
display: inline-block;
}
.fn .second {
margin-left: 45.5px;
background-image: url(http://s28.postimg.org/ag908gzah/fi1.png);
background-repeat: no-repeat;
background-position: left center;
background-size: 25px 25px;
top: -14px;
position: relative;
}
<div class="fn">
<ul>
<li> Resume
</li>
<li class="mid">
<img src="http://s18.postimg.org/v70ga0bvt/image.png"></img>
</li>
<li> Contact
</li>
</ul>
</div>
You have to change absolute position to fixed and vertical align li elements top.
.fn {
width: 100%;
height: 100%;
max-height: 50px;
bottom: 0;
left: 0;
position: fixed;
background-color: #fff;
}
.fn ul {
text-align: center;
margin: 0;
padding: 0;
list-style: none;
}
.fn li {
display: inline-block;
vertical-align: top;
}
.fn a {
display: block;
padding: 10px 5px 10px 30px;
text-decoration: none;
font-family:"Raleway", sans-serif;
font-size: 1.15em;
letter-spacing: 0.05em;
color: #000;
}
.fn .first {
margin-right: 45.5px;
background-image: url(http://s28.postimg.org/f3f2a8mnd/fi2.png);
background-repeat: no-repeat;
background-position: left center;
background-size: 25px 25px;
position: relative;
}
.fn .mid {
height: 55px;
bottom: 0;
margin: 0 auto;
z-index: 9998;
}
.fn .mid img {
height: 100%;
display: inline-block;
}
.fn .second {
margin-left: 45.5px;
background-image: url(http://s28.postimg.org/ag908gzah/fi1.png);
background-repeat: no-repeat;
background-position: left center;
background-size: 25px 25px;
position: relative;
}
.fn li:first-child, .fn li:last-child {
padding-top: 10px;
}
Fiddle: http://jsfiddle.net/mcwo8qvz/7/
hello just make your fn class div to position fixed and expand your max-height to 55 px
here is jsfiddel = http://jsfiddle.net/mcwo8qvz/2/
.fn {
width: 100%;
height: 100%;
max-height: 55px;
bottom: 0;
left: 0;
position: fixed;
background-color: #fff;
}
When I re-size the footer, i.e. make the window browser smaller the page gives me the option to scroll. However, when I scroll the background image of the footer does not display past the original window, leaving a huge white gap...
This is the original footer - no edits
Minimizing the browser shows scrolling (which is fine)
If I then scroll, the background does not render...
HTML:
<div id="footerfix" class="grid_12">
<div id="insidefooterfix" class="grid_12margin">
</div>
</div>
CSS:
#footerfix {
color: #C9C9C9;
width: 100%;
background-color: #2d2d2d;
list-style: none;
height: 460px;
padding-bottom: 0;
background-image:url(http://i.imgur.com/yb7j6PD.png);
background-repeat:repeat;
}
#insidefooterfix {
margin-top: 20px;
text-align: center;
height: 380px;
margin-bottom: 0;
}
.grid_12margin {
display:inline;
float: left;
position: relative;
margin-left: 1%;
margin-right: 1%;
}
.grid_12 {
display:inline;
float: left;
position: relative;
/*margin-left: 1%;
margin-right: 1%;*/
}
.container_12 .grid_12 {
width:100%;
/*width:98.0%;*/
}
Code here (simplified without information but all CSS): http://jsfiddle.net/UVvM2/ (but doesn't show any problems here?)
Here is FULL which does show problem: http://jsfiddle.net/UVvM2/2/
The 100% width is relative to your screen, try to add the background-color in your body :
<body clas="gray-bg">
<div id = "footer-fix"> , etc .
CSS :
.gray-bg{
background-color:#2D2D2D;
}
Looking likes see this Below link..
Reference link
#insidefooterfix, #disclaimerfix {
width: 960px;
max-width: 100%;
margin-right: auto;
}
#footerfix {
color: #C9C9C9;
width: 100%;
background-color: #2d2d2d;
list-style: none;
height: 460px;
padding-bottom: 0;
background-image:url(../img/index/footer/pixelpatterns.png);
background-repeat:repeat;
}
#insidefooterfix {
display: block;
float: none;
margin: 20px auto;
text-align: center;
height: 380px;
}
/*settings for social media buttons*/
#insidefooterfixtermsplusbuttons li {
display: inline;
color: #C9C9C9;
}
#insidefooterfixone h5, #insidefooterfixtwo h5, #insidefooterfixthree h5, #insidefooterfixfour h5 {
text-align:left;
margin-bottom: 0;
color:#FFFFFF;
}
#insidefooterfixone ul, #insidefooterfixtwo ul, #insidefooterfixthree ul, #insidefooterfixfour ul {
list-style: none;
text-align: left;
margin-left: 0;
color: #C9C9C9;
}
#insidefooterfixone li, #insidefooterfixtwo li, #insidefooterfixthree li, #insidefooterfixfour li {
list-style: none;
text-align: left;
margin-left: 0;
color: #C9C9C9;
}
#disclaimerfix {
position: relative;
top: 0px;
font-size: 9px;
text-align: center;
margin: 0 auto;
float: none;
}
#disclaimerfix p {
text-align:center;
color: #C9C9C9;
}
#insidefooterfixone {
position: relative;
top: 0px;
left: 200px;
width: 150px;
}
#insidefooterfixtwo {
position: relative;
top: 0px;
left: 200px;
width: 150px;
}
#insidefooterfixthree {
position: relative;
top: 0px;
left: 200px;
width: 150px;
}
#insidefooterfixfour {
position: relative;
top: 0px;
left: 200px;
width: 150px;
}
.container_12 .grid_12 {
width:100%;
/*width:98.0%;*/
}
.grid_12margin {
display:inline;
float: left;
position: relative;
margin-left: 1%;
margin-right: 1%;
}
.grid_12 {
display:inline;
float: left;
position: relative;
/*margin-left: 1%;
margin-right: 1%;*/
}
IE7 z-index doesn't work even if I add position: absolute or relative
Is there any other solution ? I add other divs lower z-indexes but doesn't work
.gallery {
background-color: #F4F4F4;
display: block;
min-height: 300px;
padding: 20px 10px;
position: absolute;
right: -44px;
top: 70px;
width: 980px;
z-index: 3000;
display: none;
}
.sub_menu {
background-color: #F4F4F4;
float: left;
height: 21px;
padding: 40px 35px;
position: relative;
top: 10px;
width: 930px;
z-index: 1000;
}
With z-index and IE it is sometimes required to use !important
.gallery {
background-color: #F4F4F4;
display: block;
min-height: 300px;
padding: 20px 10px;
position: absolute;
right: -44px;
top: 70px;
width: 980px;
z-index: 3000 !important;
display: none;
}
.sub_menu {
background-color: #F4F4F4;
float: left;
height: 21px;
padding: 40px 35px;
position: relative;
top: 10px;
width: 930px;
z-index: 1000 !important;
}
!important
Should be used as a last result.
Try the following before hand
body{
z-index: -1
}
.gallery {
background-color: #F4F4F4;
display: block;
min-height: 300px;
padding: 20px 10px;
position: absolute;
right: -44px;
top: 70px;
width: 980px;
z-index: 2;
display: none;
}
.sub_menu {
background-color: #F4F4F4;
float: left;
height: 21px;
padding: 40px 35px;
position: relative;
top: 10px;
width: 930px;
z-index: 1;
}