I've been looking for a way to make my div be on top of all div's (covering them all). In fact i think i could solve this hiding the other div's but i think there should be another solution.
I'm using bootstrap to make a 3x3 grid. So, i have one row and inside it i have 9 div's with the class "col-md-4" (i just want this to work with this size.)
Z-position isn't working with me.
HTML
<div class="row ">
<div id="cube1" class="col-md-4 ">
<h1>The Company</h1>
<p><i class="fa fa-building-o fa-9x"></i></p>
</div>
<div id="cube2" class="col-md-4">
<h1>Our People</h1>
<p><i class="fa fa-heart fa-9x"></i></p>
</div>
<div id="cube3" class="col-md-4">
<h1>Code</h1>
<p><i class="fa fa-code fa-9x"></i></p>
</div>
<div id="cube4" class="col-md-4">
<h1>Our Brand</h1>
<p><i class="fa fa-barcode fa-9x"></i></p>
</div>
<div id="cube5" class="col-md-4">
<h1>Our Technology</h1>
<p><i class="fa fa-connectdevelop fa-9x"></i></p>
</div>
<div id="cube6" class="col-md-4">
<h1>What Moves Us</h1>
<p><i class="fa fa-cogs fa-9x"></i></p>
</div>
<div id="cube7" class="col-md-4 ">
<h1>Our Clients</h1>
<p><i class="fa fa-exclamation fa-9x"></i></p>
</div>
<div id="cube8" class="col-md-4">
<h1>Contact Us</h1>
<p><i class="fa fa-envelope-o fa-9x"></i></p>
</div>
<div id="cube9" class="col-md-4">
<h1>Address</h1>
<p><i class="fa fa-compass fa-9x"></i></p>
</div>
</div>
CSS
.row {
float: left;
height: 100%;
color: #fff;
width:calc(100% - 250px); /*250px is the size of left menu */
}
.cube {
height: calc(100%/3);
}
.teste {
z-index: 300 !important;
}
js
$(document).ready(function(){
var cores = Please.make_color({
base_color:'aliceblue',
colors_returned:9
})
cores[4]='#32BAD3';
for (i=0; i<10; i++)
{
$('#cube'+ (i+1)).css('background-color',cores[i])
}
$('.cube').click(function() {
$( this ).addClass( "teste", 1000, "easeOutBounce" );
$(this).width($('#rightmenu').width()-280);
$(this).height($('#rightmenu').height());
});
});
What i want to achieve is when a user click on one of the divs, it will expand covering all the viewport.
I read some posts here and they said that Z-index only work when i have a non-static non static positioning scheme. Can i consider that using the bootstrap classes "col-md-4" it makes my website a static scheme?
Sources:
CSS I want a div to be on top of everything
Z-Index with different parents
CSS Z-Index with Gradient Background
I have similiar problems with bootstrap but usually it has to do with the way css files are arranged in your site.
A dirty solution is
z-index: 300 !important;
to make sure other css rules get overwritten but I would avoid that when possible.
Where exactly did you put the z-index rules?
Related
I am trying to get my column padding closer together however I have padding set to 0 and theres still a gab in between. I want to make it so the columns are close to eachother no matter what screen sizer and theres 2 items per row. Doesnt even show the words of second row
<body>
</body>
<div class="pimg3">
<div class="row">
<div class="ptext">
<h1><strong>HOW I WORK</strong></h1>
<div class="column">
<i class="fas fa-search" style="color:#1d5ba0; padding: 10px"></i>
<h2>Research</h2>
<p>Understand the problem, empathize with the person. Explore the competitive landscape.
Identify strategic opportunities. Define design goals/requirements.</p>
</div>
<div class="column">
<i class="fas fa-flask" style="color:#1d5ba0; padding: 10px"></i>
<h2>Design</h2>
<p>Combine effective interfaces, smart interactions, and consistent visual language into
a captivating design that resonates with the target audience.
</p>
</div>
<div class="column">
<i class="fas fa-code" style="color:#1d5ba0; padding: 10px"></i>
<h2>Build</h2>
<p>Map design to code. Smooth constraints. Solve edge cases. Move that button 3 pixels to the left. Fill
the gap between functional and delightful.</p>
</div>
<div class="column">
<i class="fas fa-retweet" style="color:#1d5ba0; padding: 10px"></i>
<h2>Refine </h2>
<p>Test prototypes with real people against actual problems. Combine insights with gut intuition and experience.
Iterate and improve in pursuit of perfection.</p>
</div>
</div>
</div>
</div>
</body>
https://jsfiddle.net/kdb4raLx/1/
It could be due to your ptext seems that is a culprit
I have a list of posts that I'm using ng-repeat with bootstrap grid to create seperate rows for each post. Inside of these I have a font-awesome icon bookmark with absolute positioning for text on top of that icon.They all have relative positioning to the div class='image-wrapper' that they are inside. My question is the absolute positioning of the date seems to be different visually even though the css is the same.
<div ng-repeat="post in $ctrl.posts | filter:{category:'tournament'}">
<div class="row">
<div class="col-12 col-sm-6">
<img src="{{post.photo_link}}" class='img-fluid pb-3'></img>
</div><!--End od col-sm-6-->
<div class="col-12 col-sm-6">
<div class="row">
<div class="col-12">
<h2 class='zaffre text-center h5' ng-bind="post.title"></h2>
</div><!--End of col-12-->
<div class="col-12 text-center image-wrapper">
<i class="fa fa-bookmark fa-5x zaffre" aria-hidden="true"></i>
<div class='month-wrapper'><span ng-bind="post.date | date:'MMM'"></span></div>
<div class='date-wrapper'><span ng-bind="post.date | date:'dd'"></span></div>
<p class='text-sm-left mt-2' ng-bind="post.body"></p>
</div>
</div><!--End of row-->
</div><!--End od col-sm-6-->
</div><!--End of row-->
</div><!--End of ng-repeat-->
CSS
.image-wrapper{
position:relative;
}
.month-wrapper{
position:absolute;
top:4%;
left:45%;
color:white;
}
.date-wrapper{
position:absolute;
top:12%;
left:48%;
color:white;
}
The problem is that your top value (12%) varies depending on the height of the box. Percentage values are unreliable for that reason. Instead, use pixel values or rework the layout to use padding or another mechanism for positioning.
Change the HTML structure like below:
<div class="col-12 text-center image-wrapper">
<div class='date-panel'>
<i class="fa fa-bookmark fa-5x zaffre" aria-hidden="true"></i>
<div class='month-wrapper'><span ng-bind="post.date | date:'MMM'"></span></div>
<div class='date-wrapper'><span ng-bind="post.date | date:'dd'"></span></div>
</div>
<p class='text-panel' ng-bind="post.body"></p>
</div>
Change CSS like below:
.date-panel{
position:absolute;
left:0;
top:0;
}
.text-panel{
padding-left:100px;
}
I write these code and made 2 grid using bootstrap.Now i want to the backgound image in the wrapper class.I tried it but i din't get success. Any idea about this?
.wrapper {
background-image: url(http://www.steamatic.com/images/footer-pattern-grey.jpg);
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
}
<div class="wrapper">
<div class="col-md-6">
<div class=" flex">
<div class="media-left"> <i class="fa fa-home fa-3x"></i></div>
<div class="media-body">
<h4>Resenditial Services</h4>
</div>
</div>
<p class="para">Steamatic knows that the health and safety of your family is your first concern. Our restoration and cleaning services are all about providing you with the healthiest indoor environment possible.</p>
</div>
<div class="col-md-6">
<div class=" flex">
<div class="media-left"> <i class="fa fa-building fa-3x"></i></div>
<div class="media-body">
<h4>Commercial Services</h4>
</div>
</div>
<p class="para">We've been providing commercial clients money-saving and asset-protecting services for nearly five decades. Steamatic's full range of restoration and cleaning services means we have your business covered.</p>
</div>
</div>
I get the image in my background but i want to get full width image what i do?
U can show the image i upload
If you read the documentation of bootstrap, the cols are always wrapped in a row , if you want to wrap it in your own .wrapper class, then add
.wrapper{
overflow: hidden;
}
or you can try float: left; to .wrapper , its your choice
Add overflow: auto; to your .wrapper element.
You have to add overflow: hidden to your .wrapper class parent element of the two floating elements inside of it. So that if you add background image on your .wrapper it will show. Because, bootstrap grid classes are using float.
I have a div inside another div and the effect that I'd like to achieve is the classic three products icons next to each other with some explanatory text underneath.
The content of a the text div doesn't push down the following content and overlaps it. I've tried many different solutions but i didn't find anything that works in this case.
I'm afraid that the absolute positioning and negative margin of the inner div makes it harder.
I would appreciate any suggestions. Thanks!
HTML
<div class="icon-group">
<div class="icon">
<i class="fa fa-book fa-4x" aria-hidden="true"></i>
<div class="icon-caption">Astonishment tendrils of gossamer clouds the carbon in our apple pies made in the interiors of collapsing stars.</div>
</div>
<div class="icon">
<i class="fa fa-plane fa-4x" aria-hidden="true"></i>
<div class="icon-caption">Astonishment tendrils of gossamer clouds the carbon in our apple pies made in the interiors of collapsing stars.</div>
</div>
<div class="icon">
<i class="fa fa-quote-right fa-4x" aria-hidden="true"></i>
<div class="icon-caption">Astonishment tendrils of gossamer clouds the carbon in our apple pies made in the interiors of collapsing stars.</div>
</div>
</div>
<div class="clear"></div>
<h3 class="after-icons">What people say about me</h3>
CSS
.icon-group, icon-caption-group {
height: 100px; display: table; width:100%; table-layout: fixed}
.icon, .icon-caption {
display: table-cell;
text-align: center;
vertical-align: middle;
position: relative;}
.icon-caption {
border-bottom: 3px solid #E8EAF6;
vertical-align: middle;
position: absolute;
top: 50%;
left: 50%;
width: 50%;
margin: -15% 0 0 -25%;
margin-top: 20%;
}
.after-icons {
margin-top: 30px
}
You don't need to positioning the content you can simply do like this way, check with the below snippet
.icon-group, icon-caption-group {height: 100px; display: table; width:100%; table-layout: fixed}
.icon, .icon-caption {
display: table-cell;
text-align: center;
vertical-align: middle;
position: relative;}
.icon-caption {
border-bottom: 3px solid #E8EAF6;
vertical-align: middle;
display: block;
margin: 0 auto;
width: 50%;
}
.after-icons {
margin-top: 30px
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<div class="icon-group">
<div class="icon">
<i class="fa fa-book fa-4x" aria-hidden="true"></i>
<div class="icon-caption">Astonishment tendrils of gossamer clouds the carbon in our apple pies made in the interiors of collapsing stars.</div>
</div>
<div class="icon">
<i class="fa fa-plane fa-4x" aria-hidden="true"></i>
<div class="icon-caption">Astonishment tendrils of gossamer clouds the carbon in our apple pies made in the interiors of collapsing stars.</div>
</div>
<div class="icon">
<i class="fa fa-quote-right fa-4x" aria-hidden="true"></i>
<div class="icon-caption">Astonishment tendrils of gossamer clouds the carbon in our apple pies made in the interiors of collapsing stars.</div>
</div>
</div>
<div class="clear"></div>
<h3 class="after-icons">What people say about me</h3>
How about increasing the top margin of the after-icons class? I've increased it to 130, and this pushes the text below the div.
Your css leads to a very difficult situation of trying to expand the parent (icon class) based on an the size of an absolute positioned child which is better avoided Make absolute positioned div expand parent div height
keep you html markup the same and erasing your clear div and your css becomes very simple
All you need to do is apply padding or margin to icon class to space the icons
.icon {
float: left;
width: 33%;
}
.clearfix:after {
content: "";
display: table;
clear: both;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<div class="icon-group">
<div class="icon clearfix">
<i class="fa fa-book fa-4x" aria-hidden="true"></i>
<div class="icon-caption">Astonishment tendrils of gossamer clouds the carbon in our apple pies made in the interiors of collapsing stars.</div>
</div>
<div class="icon clearfix">
<i class="fa fa-plane fa-4x" aria-hidden="true"></i>
<div class="icon-caption">Astonishment tendrils of gossamer clouds the carbon in our apple pies made in the interiors of collapsing stars.</div>
</div>
<div class="icon clearfix">
<i class="fa fa-quote-right fa-4x" aria-hidden="true"></i>
<div class="icon-caption">Astonishment tendrils of gossamer clouds the carbon in our apple pies made in the interiors of collapsing stars.</div>
</div>
</div>
<h3 class="after-icons">What people say about me</h3>
NOTE: clearfix is usually needed for older browsers and I chose the simplest implementation of it but if you want to support very old browsers do a search for clearfix
Here is a working jsfiddle https://jsfiddle.net/GiorgosK/x3evnxpn/
I am using Bootstrap and Font Awesome to make a table like the one from FAQ zalando.
So on the left side, there should be an icon, and on the right side, there should be text.
I want the text to be exactly under each other, they should not be out of alignment with each other. If I give the icons a span, then it will be ignored.
Here is my code:
<div class="row">
<i class="span2 icon-user "></i>
<div value='register' class="span4">
Registrierung
</div>
<i class="icon-mobile-phone span2"></i>
<div id='Newsletter' class="span4">
Newsletter
</div>
</div>
<div class="row">
<i class="icon-euro span2"></i>
<div value='kost' class="span4">
Kosten
</div>
<i class="icon-phone span2"></i>
<div id='probleme' class="span4">
Probleme
</div>
</div>
As an update to this, FontAwesome now has fixed-width support built in.
<i class="fa fa-fw fa-user"></i>
The fa-fw class supplies the fixed-width style.
Put your icon inside the element and make it behave as an inline-block so you can change its width and margin.
http://jsfiddle.net/LeBen/B9yjd/
Both, the original code of the Zalando website and the Fiddle by LeBen, are not "ideal" - espacially when it comes to HTML semantics.
Why having empty elements if you only want a background image for an element?
Just add the icon as background-image and set the padding-left for all these elements to the required value.
Just target the icons classes directly adding your styles in css:
[class*="btn-"]:before,
[class^=" btn"]:before {
margin-right: 1em;
}
And there's no need for an empty , just use:
<div class="row">
<div value='register' class="icon-user span4">
Registrierung
</div>
<div id='Newsletter' class="icon-mobile-phone span4">
Newsletter
</div>
</div>
just had this issue playing around with the options after not wanting to bang all my FontAwesome icons in spans/divs. Adding class 'fa-fw' did indeed solve it, but so does simply adjusting the width of the icon with CSS (maybe a new thing as this is an old post), so no extra classes needed if you have many icons. 'svg-inline--fa' was a common class for all my icons - see example
.item{
padding: 5px;
}
.svg-inline--fa{
font-size: 20px;
width: 40px !important;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/js/all.min.js" defer></script>
<div class="item">
<i class="fas fa-bolt"></i>
Fast, local and friendly team
</div>
<div class="item">
<i class="fas fa-tags"></i>
Honest and transparent pricing
</div>
<div class="item">
<i class="fas fa-handshake"></i>
All our work is guaranteed
</div>
<div class="item">
<i class="fas fa-clipboard-check"></i>
Trained to the highest UK standards
</div>