I'm having a layer problem where this layer content-3f display over all other layers below it:
<div id="content-3f">
<div id="content-3-1f"></div>
<div id="content-3-2f"></div>
<div id="content-3-3f"></div>
</div>
<div class="line"><hr class="top" /></div>
Css:
#content-3f {
float: left;
width: 880px;
height: auto;
padding: 10px 0px 10px 26px;
height: 103px;
clear:both;
}
#content-3-1f
{
float: left;
width: 269px;
height: 202px;
margin:0px 20px 0px 0px;
padding: 0px;
background: url('../images/Guided-tour-logo.png') no-repeat left top;
}
#content-3-1f a
{
width: 269px;
height: 202px;
display:block;
}
#content-3-2f
{
float: left;
width: 269px;
height: 202px;
margin:0px 20px 0px 0px;
padding: 0px;
background: url('../images/Taste-chinatown-logo.png') no-repeat left top;
}
#content-3-2f a
{
width: 269px;
height: 202px;
display:block;
}
#content-3-3f
{
float: left;
width: 269px;
height: 202px;
margin:0px 0px 0px 0px;
padding: 0px;
background: url('../images/Taste-chinatown-logo.png') no-repeat left top;
}
Screenshot:
As you see it goes over the <hr>
How to fix?
the problem is due to the "float:left" on your #content-3f. The float needs to be cleared for this to work. Here's your solution::
HTML
<div id="content-3f">
<div id="content-3-1f"></div>
<div id="content-3-2f"></div>
<div id="content-3-3f"></div>
</div>
<div class="clear"></div>
<div class="line"><hr class="top" /></div>
Notice the additional div with class "clear" This is used to clear the float in your elements.
Now the CSS
#content-3f {
width: 880px;
height: auto;
padding: 10px 0px 10px 26px;
height: 103px;
}
.clear {
clear:both;
}
The rest of the css remains the same. Hope this helps.
Yes, I agree with gapple. I guess I didnt study your css properly. its the "height:103px" that's creating the problem. remove that and it works as it is.
But I would like to point out that its always a good idea to clear floats nonetheless.
Adding the following to your CSS should give you the answer you are looking for.
#content-3-1f,
#content-3-2f,
#content-3-3f {
position:relative;
z-index: 1;
}
Basically z-index tells things which "layer" to live on. The default layer is z-index: 0;
You also need to specify a relative or absolute position for it to take affect.
The more elegant solution is to use display:inline-block rather than float:left on your boxes.
http://www.vanseodesign.com/css/inline-blocks/
Related
I can't seem to make an element move in CSS. It's a form with a background and it's centered. I can't see what I'm doing wrong.
#skyformbox {
width: 50%;
margin: 0 auto;
margin-top: 0px;
clear: both;
border: 3px solid #000000;
padding-top: 20px;
background: #ccc url(http://www.ultraframehomeimprovements.co.uk/wp-
content/uploads/2018/07/Sky-box.png);
overflow: auto;
padding: 5;
left: 2000px;
}
<div align="left">
<div id="skyformbox">
[gravityform id="12" title="false" description="false"]
</div>
</div>
Why are you positioning 2000px left? As far as I know the "left" property will only work if the positioning is set to absolute...
Anyway try this:
#skyformbox {
width: 50%;
margin-left: 0px;
margin-top: 0px;
clear: both;
border: 3px solid #000000;
padding-top: 20px;
background: #ccc url(http://www.ultraframehomeimprovements.co.uk/wp-content/uploads/2018/07/Sky-box.png);
overflow: auto;
padding: 5;
left: 2000px;
}
Setting the margin-left to 0px did the trick for me (assuming that what you're trying to do here is to get the form to align to the left side of the page).
I'm having issue with positioning these boxes. Is there someone that know how to make it exactly same as it's on picture?
https://i.stack.imgur.com/9aW9B.png
Deleted some parts from CSS because they aren't important for this.
CSS & HTML
.aktualita-perex{
float: left;
width: 100%;
padding-bottom: 10px;
color: #4c4c4c;
}
.aktualita-img{
position: relative;
float: left;
}
.aktualita-thumbmail{
width: 100%;
height: 216px;
object-fit: cover;
}
.aktualita-header{
color: #282828;
font-size: 27px;
width: 100%;
padding-bottom: 20px;
}
.aktualita-body{
padding: 15px;
float: left;
}
.aktualita-container{
width: 383px;
border: 1px rgba(125, 125, 125, 0.19) solid;
float: left;
margin: 5px;
border-radius: 5px;
overflow: hidden;
}
<article class="aktualita-container">
<div class="aktualita-thumbmail">
<div class="aktualita-img"><img src="http://i.imgur.com/x3lpHuG.jpg" width="100%" height="100%"></div>
<div class="aktualita-datum">25. Ledna 2017</div>
</div>
<div class="aktualita-body">
<div class="aktualita-header">Aqualand Moravia</div>
<div class="aktualita-perex">SOME TEXT</div>
<div class="aktualita-tlacitko">Číst více</div>
</div>
</article>
Your floats are off because of your container heights. To make it seamless you need to have your heights all be the same id suggest increasing the height or adding a height (if you don't currently have one on your container) until you get the seamless look you are looking for.
Try to float: left and make them display: inline-block.
In this particular situation you can add clear: left to the CSS of the container/article tag which you want to move to the left.
But in general, as #oompahlumpa wrote, you should set all your containers to the same height.
How do I get the logo centered inside the topbar who has a width of 100%? I feel like a complete idiot lol. margin: 0px auto aint working..
HTML
<div id="topbar-fullwidth">
<div class="tb menu" id="unfoldMenu"></div>
<div class="tb logo"></div>
</div>
CSS:
#topbar-fullwidth {
width: 100%;
height: 42px;
background: #000;
border-bottom: 2px solid #000;
position: relative;
overflow: hidden;
}
.tb.menu {
width: 44px;
height: 44px;
float: left;
background: url('../images/icons/unfold_menu#2x.png') no-repeat;
background-size: 22px;
background-position: 10px 13px;
}
.tb.logo {
width: 140px;
height: 44px;
float: left;
margin: 0px auto;
display: block;
background: url('../images/logo#2x.png') no-repeat;
background-size: 125px;
background-position: 10px;
}
Thanks lol.
You can't use margin:0 auto; on a floated element. So you need to remove float:left; on the logo.
FIDDLE
First of all you should not use float: with element that have margin:0 auto set.
Here is an example I hope it will help, changed background: with background-color to make changes visible. I have also removed float:left.
I'm having some serious trouble getting things to float left correctly, or rather getting elements to float "true" left.
This is my current output:
and this is what I am hoping to achieve:
here is a jsfiddle, any help would be greatly appreciated. :)
html:
<div id="content">
<div class="box1">
1
</div>
<div class="box2">
2
</div>
<div class="box1">
3
</div>
<div class="box1">
4
</div>
<div class="box1">
5
</div>
</div>
css:
html, body {
margin: 0px;
padding: 0px;
}
a {
text-decoration: none;
}
#content {
margin: 20px 0px 0px 20px;
width:180px;
background-color: green;
overflow: auto;
padding-left: 10px;
}
.box1 {
margin: 10px 10px 0px 0px;
background-color: red;
position: relative;
float: left;
height: 50px;
width: 50px;
}
.box2 {
margin: 10px 10px 0px 0px;
background-color: blue;
position: relative;
float: left;
height: 110px;
width: 50px;
}
Oh and just a little note, I'd prefer to accomplish this without using javascript but am happy to use it as a last resort.
Floats are not capable of the layout you are looking for. You need something more the columns.
https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_multi-column_layouts
But you have to be careful of the cross browser and they are not great at percentage widths either (from experience).
I got something similar to what you want
Fiddle
.box5 {
margin: 10px 10px 0px 0px;
background-color: red;
position:absolute;
float: right;
height: 50px;
width: 50px;
float:left;
left:150px;
top:80px;
}
I think this can't be done with only css at the moment, maybe in some short future, but there is a lot of javascript solutions to this and making some research i found Masonry, wich i think is the most popular. You should try it.
i have found answer to what you are looking for.... just see this fiddle i have edited...
.box4 {
margin: 10px 10px 0px 0px;
background-color: red;
position: relative;
float:left;
height: 50px;
width: 50px;
margin-top:-50px;
margin-left:3px;
}
http://jsfiddle.net/fWK2A/6/embedded/result/
I would like a two column layout without worrying about the background when one column happens to be tallest than the other.
I have read about faux columns, liquid layout, but I would like to ask you if it may work this way: I have a "main" element with a semi-transparent image as background (16x17px). The main element contains the 2 floating columns, the left floats left and the right one floats right.
.main {
width: 1024px;
background-image: url();
padding:10px 0px 10px 0px;
margin: 0 auto;
}
.colleft {
float: left;
width: 618px;
padding:10px 5px 10px 10px;
}
.rightbar {
margin: 0 auto;
width: 50em;
float: right;
padding:10px 5px 10px 10px;
width: 376px;
}
.titolo {
text-align: center;
font-family: ClaireHandRegular, Helvetica, sans-serif;
font-size: 30px;
color: #35231e;
line-height: 100%;
padding:10px 0px 0px 0px;
}
.contenuto {
text-align: left;
font-family: ClaireHandRegular, Helvetica, sans-serif;
font-size: 25px;
color: #35231e;
line-height: 100%;
padding:20px 0px 0px 0px;
}
There is something wrong in my HTML and I cannot see where.
Am I this far from the solution?
<div class="main">
<div class="colleft">
<div class="titolo">ARTICLES</div>
<div class="contenuto">CONTENT</div>
</div>
<div class="rightbar">
<div class="contenuto">RIGHT BAR CONTENT</div>
</div>
</div>
You may use JSFiddle or similar to test it. As well as Firebug or similar.
When you work with floats, you must contain your floats.
In order to do so, you have several techniques at your disposal.
Among them, a simple one:
overflow:hidden; your float container.
In your case, the element with class .main.
Try this:
.main {
width: 1024px;
background-image: url();
padding:10px 0px 10px 0px;
margin: 0 auto;
background-color: red; //<-- added just to test.
overflow:hidden; //<-- to contain the floats.
}