html/css How to aling all pictures with same spaces. - html

I want to make same spacing between all pictures. Their width would be the same only height differs. It should look like in the picture. example: http://prntscr.com/2ugt3z

That kind of layout cannot be done using only floats, your options are:
Use Flex layout (ie10+)
Position each element manually
Use a plugin, if you are using jquery then Isotope (http://isotope.metafizzy.co/) or Masonry (http://masonry.desandro.com/) are what you need, if you're using pure javascript, Salvattore (http://salvattore.com/) will do the trick.

do you mean something like, this will place margin of 5px on every image tag inside #content:
#content img{
margin: 5px;
}
or make:
.image-margin{
margin: 5px;
}
and do something like:
or: http://isotope.metafizzy.co/

Related

How to use bootstrap 4 margin and padding properties with pixels?

I would like to use bootstrap 4 margin and padding properties with pixels instead of rems. For example, I would like the following div to have margin-left of 20 pixels:
<div class="container ml-20">Hi</div>
Is it even possible?
Thanks in advance.
Bootstrap doesn't have anything like this. However, you can create a custom css class to handle this for you:
.ml-20 {
margin-left: 20px;
}
Your options are limitless with how you want to set it up. You could create ml-10, ml-100 or anything you want.
There's nothing like that in Bootstrap, but in CSS, just use the code
div {
margin-left:20px;
}

customize bootstrap widths do not know how

I need to implement the following custom widths for a website I am creating but not clear on how to do this to override the bootstrap defaults:
width of website: 1590px;
container width: 1530px;
column gutters: 30px;
column widths: 230px;
I know that you should not touch the bootstrap default css file, so if I create a custom.css file, what do I put it in it?
I dont know LESS/SASS though.
First I recommand not to use a fixed width in pixels for the container, because then you loose responsive behavior. Use a percentage value instead (default is 100%), define a max-width: 1590px; for container and use a padding: 0 30px; for the left and right spacing.
In Bootstrap all columns use percentage values, too. A column of 230px width you get by using the col classes for 1/6 ( see more here: http://getbootstrap.com/css/#grid-options)
And the gutter-width of 30px is the Bootstrap default gutter-width, 15px left & right.
Rule number one with bootstrap is to never change Something on the files ^^ so if you Want Something like that, the best is to create another CSS file, copy bootstrap on it and make some modification
Simply override the existing bootstrap's class in your custom CSS.
For eg:
CSS:
.container {
width: 1530px;
}
Similarly, other classes can have new values of the existing properties of Bootstrap.

html adding borders

I would like to add some right-positioned borders to my menu.
But the ones that I can use by default are not working for me. Can anyone recommend where to get a bit better looking borders, and how i add them in the css?
the css style you need :
#mymenu
{
border-right:solid 50px red;
}
You could try using jQuery (its more shape than actual border)
There's also a set of jQuery plugins to use on top of that.
Finally, there are some nice and easy css3 border properties that you could use.
I hope this helps.

How to achieve float: top in CSS/HTML

If you can read the Headings ... one's called JWT, the other Alela Diane.. how do I get "Alela Diane" to fill up the space between them ( no puns intended )
The CSS property for these div's is set to display: inline-block.
The HTML - >
<div id="shastra_display">
<div class="shastra_post">
There are multiple div's like this containing the Alela Diane's and JWT's etc.
</div>
</div>
The CSS - >
#shastra_display
{
width: 880px;
}
#shastra_display div
{
display: inline-block;
vertical-align: text-top;
}
.shastra_post
{
width: 270px;
background-color: light-grey;
}
Is it always going to be just two
columns? – thirtydot
It's two columns because the width of
the parent box allows only two to fit.
– Zach
So, the number of columns changes depending on the browser width.
That means you can't "cheat" and do it like this (as suggested by #Stefy):
http://jsbin.com/atimu4
Other than a fixed number of columns, CSS can't do it. See this answer for a comparision of the ideas:
CSS Floating Divs At Variable Heights
You will have to use JavaScript. There's already a convienient jQuery plugin: jQuery Masonry
Some interesting demos:
http://masonry.desandro.com/demos/animating-jquery.html
http://masonry.desandro.com/demos/adding-items.html
You should probably use a 2-column template in order to display the items properly.

How to make pure css floating tooltips (absolutely positioned span) dynamically resize to accommodate text

I recently had an idea for using the CSS pseudo-class :hover to display a styled tooltip when the mouse is hovered over a link.
The basic code for the link looks like this:
.hasTooltip {
position:relative;
}
.hasTooltip span {
display:none;
}
.hasTooltip:hover span {
display:block;
background-color:black;
border-radius:5px;
color:white;
box-shadow:1px 1px 3px gray;
position:absolute;
padding:5px;
top:1.3em;
left:0px;
max-width:200px; /* I don't want the width to be too large... */
}
This link has a tooltip!<span>This is the tooltip text!</span>
The result is exactly what I want, but with one annoying problem: the span does not expand to accommodate text, and if I don't specify a width, the text is squashed.
I did some searching on Google, found a couple examples of work people had done (this example is creepily similar to what I've gotten), but no one seems to have addressed the span width problem I'm having.
I know this answer is extremely late, but it appears the key to your issue would be to use:
white-space: nowrap;
inside of your span, and get rid of any sort of width definition. Of course the drawback to this will be that the tooltip will only be able to support a single line. If you want a multiline solution you will most likely have to use javascript.
Here is an example of of this method:
http://jsbin.com/oxamez/1/edit
An added bonus is that this works all the way down to IE7. If you do not need to support IE7, I would suggest folding the span, and img styles into a :before, and :after for the .tooltip. Then you can populate the text using the data-* attribute.
I don't think there's a perfect solution to this problem with pure CSS. The first problem is that when you place the span inside the a tag the span only wants to expand as far as the width of the link. If you place the span after the the a it's possible to get close to what you're trying to do but you'll have to set the margin-top: 1.3em and then have to set a negative margin to slide the tooltip left. However, it's going to be a fixed setting so it won't sit exactly at the start of each link.
I whipped up a jQuery solution that sets left dynamically (and a nice little fade effect for good measure).
Demo: http://jsfiddle.net/wdm954/9jaZL/7/
$('.hasTooltip').hover(function() {
var offset = $(this).offset();
$(this).next('span').fadeIn(200).addClass('showTooltip');
$(this).next('span').css('left', offset.left + 'px');
}, function() {
$(this).next('span').fadeOut(200);
});
These tool tips can also be integrated into a word press theme easily. Just copy the CSS into your style. Css file and when creating your posts, just take help of the HTML code and create your own tool tips. Rest is all styling, which can be altered according to your own choice. You may also use images inside the tool tip boxes.
http://www.handycss.com/how/how-to-create-a-pure-css-tooltip/
Even though this question is a bit older already, I would suggest the following compromise:
Just use max-width: 200px; and min-width: 300%; or so,
whereas the min-width could result higher than the max-width.
Just figure it out.
This way you could not have entirely liquid tooltips but the width would stand in kind of a correlation with the width of the containing link element.
In terms of optical pleasantness this approach could be of value.
edit:
Well I must admit it is nonsense what I wrote. When the min-width can be higher than the max-width, there is no sense to it.
So just putting the min-width in percent would achieve what I tried to suggest.
Sorry for that.
I found this and it was working for me. It's a good solution when you have a lot of elements and jquery plugins on the same page and you can't work with
Text <span>Tooltip</span>
View pure CSS solution: JS BIN
Credit to trezy.com