I was using inline-block to display a bunch of columns next to one another, but Safari was adding a white space between them no matter what. (though not Chrome even though they are both webkit). so i switched to floating the items and wrapping them in an inline-float element.
in my fiddle this seems to work in IE7-8, chrome, FF and safari.
the markup looks like:
<div id="wrapper" >
<div id="center">
<span> Foo </span>
<span> Bar </span>
</div>
</div>
and CSS:
#wrapper{
background: pink;
text-align: center;
font-size: 0; }
#center {
background: yellow;
display:inline-block;
*display: inline;
zoom: 1; }
span {
float: left;
width:100px;
background:blue;
font-size:30px;
line-height: 1;
color:white;
text-align:center; }
http://jsfiddle.net/KKzuz/10/
but on my live site IE8 rains on my parade and only displays 1 column. ie7 of all things, manages to not muck it up.
http://donutsites.com/sandbox01/portfolio/print/logos/
the CSS selectors are different, but the markup is pretty similar... as far as i can tell anyway. though the fiddle is more simplified b/c i'm not trying to run the smoothdivscroll plugin there.
<div class="scrollWrapper">
<div class="clearfix scrollableArea">
<span class="scrollblock col">
<img width="175" height="345" src="http://localhost/multi/wp-content/uploads/arb_2010_formula_back-175x345.jpg" class="fluid attachment-digital-thumb wp-post-image" alt="arbor snowboard" title="" />
<img width="345" height="345" src="http://localhost/multi/wp-content/uploads/JGWI_03-345x345.jpg" class="fluid attachment-digital-thumb wp-post-image" alt="JGWI_03" title="" />
</span><!--.col-->
<span class="scrollblock col">
<img width="345" height="345" src="http://localhost/multi/wp-content/uploads/BMS-POSTERS-13.5x20_1-345x345.jpg" class="fluid attachment-digital-thumb wp-post-image" alt="BMS POSTERS 13.5x20_1" title="" />
<img width="345" height="345" src="http://localhost/multi/wp-content/uploads/BATTLE_LA_Wall_1-345x345.jpg" class="fluid attachment-digital-thumb wp-post-image" alt="BATTLE_LA_Wall_1" title="" />
</span><!--.col-->
</div><!--.scrollableArea-->
</div><!--.scrollWrapper-->
and the CSS:
div.scrollWrapper {
position: relative;
overflow: hidden;
width: 100%;
height: 100%;
text-align: center;
font-size: 0;
clear: both;
}
div.scrollableArea {
position: relative;
width: auto;
height: 100%;
overflow-y:hidden;
overflow-x: auto;
display: inline-block;
zoom: 1;
*display: inline;
}
.js div.scrollableArea {
overflow: hidden;
}
.makeMeScrollable {
width:100%;
position: relative;
height: 690px;
}
.makeMeScrollable .scrollableArea .scrollblock {
float: left;
vertical-align: top;
position: relative;
max-height: 100%;
}
.scrollableArea img {
height: 100%;
max-height: 100%;
width: auto!important;
max-width: none;
display: block;
}
/* digital taxonomy */
.col {
max-width: 345px;
max-height: 690px;
width: auto;
}
.col a {
display: block;
max-height: 345px;
height: 50%;
width: auto;
}
can anyone see what i'm missing?
It's the display:inline-block on div.scrollableArea. IE8 is not calculating the width correctly - it thinks it should be only one column wide.
If you are using the inline-block just to center the div, there are better cross-browser ways to do that. One way would be to give div.scrollableArea a width and use margin:0 auto;
Related
I've got a little bug in my website I'm hoping someone can help me out with.
I am using 'Hover' to make my logos flash when someone hovers their mouse over it. I have two logos in my navigation header bar on my site, one on the left side and one on the right. Left side works fantastically always and right side doesn't. Right side logo hover is very temperamental and doesn't always work like the hover over the left logo. Have I done something to my coding to make it jam like it's doing?
I'm fairly new to CSS, so I'm sure I have not done my coding as correctly as I should have.
Website is http://www.willothewisp.com.au/aboutkate/
div#wrapperHeader div#header {
width:0px;
height:40px;
margin:0 auto;
}
div#wrapperHeader div#header .upperlogo {
width:250px;
height:80px;
position: fixed;
top: 0;
left: 0;
border: 0;
}
div#wrapperHeader div#header .upperlogob {
width:250px;
height:80px;
position: fixed;
top: 0;
left: 0;
border: 0;
}
div#wrapperHeader div#header .lowerlogo {
width:78px;
height:78px;
position: fixed;
top: 0;
right: 0;
border: 0;
}
div#wrapperHeader div#header .lowerlogob {
width:78px;
height:78px;
position: fixed;
top: 0;
right: 0;
border: 0;
}
#media screen and (min-width: 1181px) {
div#wrapperHeader div#header:hover .lowerlogo {
display: none;
}
div#wrapperHeader div#header:hover .upperlogo {
display: none;
}
}
<div id="wrapperHeader">
<div id="header">
<a href="http://www.willothewisp.com.au/home-page">
<img class="upperlogob" img src="https://static1.squarespace.com/static/57662f1ce4fcb52666c35448/t/59800933b3db2babbb993c09/1501563188704/2.png?format=1000w" />
</div>
</a>
<div id="header">
<a href="https://www.willothewisp.com.au/home-page">
<img class="upperlogo" img src="https://static1.squarespace.com/static/57662f1ce4fcb52666c35448/t/596c65c6c534a563924187a6/1500276173924/?format=1000w" />
</div>
</a>
<div id="header">
<a href="http://www.willothewisp.com.au/home-page">
<img class="lowerlogob" img src="https://static1.squarespace.com/static/57662f1ce4fcb52666c35448/t/59b7669ba803bbc8f65ad97f/1505191581265/favcon+2.png?format=300w" />
</div>
</a>
<div id="header">
<a href="http://www.willothewisp.com.au/home-page">
<img class="lowerlogo" img src="https://static1.squarespace.com/static/57662f1ce4fcb52666c35448/t/596c67766b8f5bacd67d9504/1500276683429/?format=300w" />
</div>
</a>
Your technique is wrong in my opinion. The issue with your code is that you are hiding/showing divs which cause the issue when hovering. Also, your HTML had issues.
Please use this technique to get better results.
div#wrapperHeader div#header {
height: 40px;
display: flex;
justify-content: space-between;
}
.logo1 {
background: url('https://static1.squarespace.com/static/57662f1ce4fcb52666c35448/t/596c65c6c534a563924187a6/1500276173924/?format=1000w');
width: 250px;
height: 80px;
display: block;
background-size: contain;
}
.logo1:hover {
background-image: url('https://static1.squarespace.com/static/57662f1ce4fcb52666c35448/t/59800933b3db2babbb993c09/1501563188704/2.png?format=1000w');
}
.logo2 {
background: url('https://static1.squarespace.com/static/57662f1ce4fcb52666c35448/t/59b7669ba803bbc8f65ad97f/1505191581265/favcon+2.png?format=300w');
background-repeat: no-repeat;
width: 80px;
height: 80px;
display: block;
background-size: contain;
}
.logo2:hover {
background-image: url('https://static1.squarespace.com/static/57662f1ce4fcb52666c35448/t/596c67766b8f5bacd67d9504/1500276683429/?format=300w');
}
<div id="wrapperHeader">
<div id="header">
<a href="https://www.willothewisp.com.au/home-page" class="logo1">
</a>
<a href="https://www.willothewisp.com.au/home-page" class="logo2">
</a>
</div>
</div>
#hunzaboy has already explained well just if u wana get the concept on similar notes
div#wrapperHeader div#header {
height: 40px;
display: flex;
justify-content: space-between;
}
.logo1 {
background: url('http://www.supercoloring.com/sites/default/files/styles/coloring_full/public/cif/2016/07/batman-logo-coloring-page.png');
width: 115px;
height: 78px;
display: block;
background-size: contain;
}
.logo1:hover {
background-image: url('http://www.vectortemplates.com/raster/batman-logo-big.gif');
}
<html>
<div id="wrapperHeader">
<div id="header">
<a href="http://www.dccomics.com/characters/batman" class="logo1">
</a>
</div>
</div>
</html>
We try to center a CSS circle with a image and a label overlaying the circle. The circle should be horizontally centered in a bootstrap column. Goal is to have this circle always in the horizontal center. Any advise is welcome.
Please see following JSFIDDLE
<div class="container">
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<div class="circle1Wrapper">
<div class="circle-textSmall bubble1outer">
<div> <span class="bubbleIconSmall">
<img src="http://lorempixel.com/40/40/" />
</span><span class="bubbleHeadSmall">label</span>
</div>
</div>
</div>
</div>
<div class="col-md-4"></div>
</div>
CSS:
.circle1Wrapper {
position: relative;
width: 100%;
height: 100%;
z-index: 9999;
margin: auto;
border: 1px solid;
}
.bubble1outer {
position: absolute;
}
.circle-textSmall div {
width: 125px;
}
.circle-textSmall div {
float: left;
width: 250px;
padding-top: 15%;
line-height: 1em;
margin-top: -0.5em;
text-align: center;
color: #000;
}
span.bubbleIconSmall > img {
width: 45%;
height: auto;
}
.circle-textSmall:after {
width: 125px;
padding-bottom: 125px;
margin-left: 50%;
}
.circle-textSmall:after {
content:"";
display: block;
width: 250px;
height: 0;
padding-bottom: 250px;
background: #ccc;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border-radius: 50%;
}
It should look like this:
#metaxos, I wanted to put this as a comment, but it is a bit long.
Even when you found a solution that works for you, I think that you may want to consider cleaning that code a bit; look how the original example got rid of most of the code and just kept one div:
.innerwrapper is unnecessary (why not put that style directly on #myCircleDiv?);
Same thing for the div that holds the image (you could put that style directly on the image!);
And the img itself can go too (and use it as background of #myCircleDiv).
This is my opinion (feel free to ignore it), but I think you should aim for something cleaner and easier to maintain, rather than a more complex and elaborated (but unnecessary) structure (unless it is required by the user/customer). The simpler, the better.
In that sense, this (you can see it working on this jsfiddle):
<!-- HTML -->
<div id="myCircleDiv">LABEL</div>
/* CSS */
#myCircleDiv {
width:250px;
height:250px;
border-radius:50%;
display:inline-block;
line-height:375px;
text-align:center;
color:white;
background:url("http://lorempixel.com/50/50/") #ccc no-repeat 50% 38px;
}
Looks beter than this:
<!-- HTML -->
<div id="myCircleDiv">
<div class="innerWrapper">
<div>
<img src="http://lorempixel.com/50/50/" />
</div>
<div>LABEL</div>
</div>
</div>
/* CSS */
#myCircleDiv {
width:250px;
height:250px;
border-radius:50%;
display:inline-block;
background-color:#ccc;
background-size:250px 250px;
line-height:250px;
text-align:center;
color:white;
}
.innerWrapper {
width: 100%;
height: 250px;
}
.innerWrapper div {
float: left;
height: 125px;
width: 100%;
line-height: 125px;
}
.innerWrapper div img {
margin-top: 38px;
}
And the result is exaclty the same. But again... that's my opinion :)
I'm having a rough time trying to position things in CSS. I understand padding,margin,height,width which to me seems like it should be enough to organize nested div boxes, but unfortunately it doesn't seem to be that easy for me.
Anyway, in my example below, the profile picture is bigger than the actual div it's contained in.
What am I doing wrong here?
CSS
.mailcontainer{
top: 40px;
width:600px;
height: 100%;
width: auto;
position: relative;
background-color:green;
}
.mail {
margin: 5px auto;
width: 700px;
height: 40px;
z-index: 100px;
overflow: hidden;
background-color: #d3d3d3;
position: relative;
border-radius: 6px;
}
.leftprofileimage img {
float: left;
max-height: 100%;
width: auto;
position: absolute;
border-radius: 90px;
}
.snippet {
float: right;
top: 10px;
width: 55%;
margin-left:26%;
position: absolute;
}
.sendername {
font-size: 1.0em;
width: 26%;
padding: 9px 0;
margin-left: 15%;
position: absolute;
}
HTML
<div class="mailcontainer">
<div class="mail">
<div class="leftprofileimage"><img src="https://s3.amazonaws.com/BodegaMagazine/StaffPhotos/Small/eric-small-profile-photo.jpeg" alt="" /></div>
<div class="sendername"><a href="/">Jeff
</a></div>
<div class="snippet">
Hello this is a test message</div>
<div class="delete"><p>DELETE</p></div>
</div>
<div class="mail">
<div class="leftprofileimage"><img src="https://s3.amazonaws.com/BodegaMagazine/StaffPhotos/Small/eric-small-profile-photo.jpeg" alt="" /></div>
<div class="sendername"><a href="/">Jeff
</a></div>
<div class="snippet">
Hello this is a test message</div>
<div class="delete"><p>DELETE</p></div>
</div>
http://codepen.io/pen/
Your profile picture is 40x40, and the nearest positioned parent is .mail, which is also 40px. The profile pics immediate parent (.leftprofileimage) was not explicitly positioned, so that's probably where the confusion lays. This codepen simply adds rules to .leftprofileimage to make it the element that profile pic conforms to:
http://codepen.io/sean9999/pen/xypBb
I'm having many issues regarding the positioning of div boxes in HTML and CSS. I have got a wrapper and 2 boxes. I want one box on the left and the other on the right, however the box on the right appears under the others. Why is this? I don't want to use "top" as it messes with a few other things. What do I do?
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title>Harry Kitchener - Home</title>
</head>
<body>
<div id="wrapper">
<div id="navbar"></div>
<div id="newsbar"></div>
</div>
</body>
</html>
#wrapper
{
position: relative;
height: 100%;
min-height: 100%;
min-width: 1000px;
background-color: #ccc;
}
#navbar
{
position: relative;
height: 100%;
width: 15%;
background-color: #A13927;
}
#newsbar
{
position: relative;
margin-left: auto;
height: 100%;
width: 15%;
background-color: #A13927;
}
FIXED:
#wrapper
{
height: 100%;
min-height: 100%;
min-width: 1000px;
background-color: #ccc;
}
#navbar
{
float: left;
height: 100%;
width: 15%;
background-color: #A13927;
}
#newsbar
{
float: right;
height: 100%;
width: 15%;
background-color: #A13927;
}
The default display for a div is: "display: block".
Blocks don't obey "width" style and span as 100%. The following elements are put below the block-displayed div.
Try adding the style to your divs as "display: inline-block" (i.e. to those divs you want to see consecutive).
EDIT: did not fully understand the question fully. BESIDES doing what i told, you can put "float: left" and "float: right" to those divs if you want them to stick to the left and right respectively.
add Float:left and float:right:
#navbar
{
position: relative;
height: 100%;
width: 15%;
background-color: #A13927;
float:left;
}
#newsbar
{
position: relative;
margin-left: auto;
height: 100%;
width: 15%;
background-color: #A13927;
float:right;
}
The answer to your question is because the elements are position relative to each other.
You have multiple "solutions":
1) float your elements. See JSFiddle
E.g.
#newsbar
{
float: right;
width: 15%;
background-color: #A13927;
}
2) Change your positioning to be fixed, but likely you want absolute. See JSFiddle
E.g.
#newsbar
{
position: absolute;
right:0;
width: 15%;
background-color: #A13927;
}
3) Other options as well (display: table-cell, et cetera)
You have a ton of solutions for this one. Here are three ways of doing it, each method will produce slightly different results. jsFiddle
HTML:
<div class="method-1">
<div class="left">
</div>
<div class="right">
</div>
</div>
<div class="method-2">
<div class="left">
</div>
<div class="right">
</div>
</div>
<div class="method-3">
<div class="left">
</div>
<div class="right">
</div>
</div>
CSS:
div div {
height: 10em;
width: 15%;
border: 1px solid red;
}
div.method-1 div {
display: inline-block;
}
div.method-2 {
height: 10em;
}
div.method-2 div {
position: absolute;
display: block;
}
div.method-2 div.right {
left: 15%;
margin-left: 1em;
}
div.method-3 {
display: table;
width: 30%;
}
div.method-3 div {
display: table-cell;
}
From everything I've read, my CSS should have the left hand text resize to fit the remaining space, but it doesn't seem to work in Chrome (ironically IE9 renders something right for once).
Bit of a noob with CSS so there's undoubtedly something I'm missing (and stuff that I don't need).
The website can be seen here;
baradineholdings.com.au
HTML;
<div id="internal">
<div id="image">
<img src="" alt="" width="563" height="422"/>
</div> <!-- end #image -->
<div id="content">
<p> A whole heap of content goes here. </p>
</div> <!-- end #content -->
</div> <!-- end #internal -->
CSS;
#internal {
width: 100%;
height: auto;
margin: 0;
padding: 0;
}
#image {
width: 563px;
height: auto;
float: right;
right: 0px;
top: 0px;
margin: 0;
}
#content {
display: block;
height: auto;
background-color: #f1f1f1;
float: left;
margin-right: auto;
position: relative;
}
The issue appears to be with the
float: left;
in #content. If you remove this you get the desired effect in all browsers. You'll also need to set the display on #content to be:
display: inline;
Otherwise your backround-color will cause issues.
Hope this helps.
#content {
clear: both;
display: block;
height: auto;
background-color: #f1f1f1;
float: left;
margin-right: auto;
position: relative;
}
Try to add
clear: both;