I've looked into this and follow a couple instructions and they don't seem to work.
Follow this link for the code:
https://jsfiddle.net/3h937r1q/7/
I've tried margin: 0 auto;(center-block class) and float: none; on the parent div but I can't seem to get it to work. Can anyone help me center div in the middle of the page and tell me why it isn't working?
Expected outcome: https://jsfiddle.net/3h937r1q/22/
Except I do not want to use margin-left to move it in to the middle
You can use col-offset:
<div class="col-xs-12 col-md-12 home-buttons center-block" >
<a href="#" class="col-xs-6 col-sm-4 col-md-2 HomepageBtn Animate col-sm-offset-2 col-md-offset-4" >
<div class="tile-text">
AP REVIEW
</div>
</a>
<a href="#" class="col-xs-6 col-sm-4 col-md-2 HomepageBtn Animate">
<div class="tile-text">
VAT CHECKER
</div>
</a>
</div>
I have removed height and given padding: 40px 0px to anchor tag
Updated DEMO
.home-buttons .HomepageBtn {
background-color: #4F7F64;
/*height: 140px;*/
padding: 40px 0px;
color: white;
font-size: small;
font-family: "futura-pt-n7", 'futura-pt', Helvetica, Arial, sans-serif;
font-weight: bold;
border-style: solid;
text-align: center;
}
I think you are looking for this. As you are using bootstrap grid in within a tag, you must use bootstrap offset class to center the element.
<div class="col-xs-12 col-md-12 home-buttons">
<a href="#" class="col-xs-6 col-sm-4 col-md-2 col-md-offset-4 col-sm-offset-2 HomepageBtn Animate">
<div class="tile-text">
AP REVIEW
</div>
</a>
<a href="#" class="col-xs-6 col-sm-4 col-md-2 HomepageBtn Animate">
<div class="tile-text">
VAT CHECKER
</div>
</a>
</div>
https://jsfiddle.net/25Lno6n7/
.home-buttons {
width:600px;
display:flex;
flex-direction:column;
align-items:center;
}
.home-buttons .HomepageBtn {
flex:0 0 300px;
}
Related
my webpage
In the link above I have a list where I specify cities of service, and right now the list seems to be condensed. I tried to stretch it out using the font-stretch function using in-line CSS but it doesn't seem to be working. Are there any other ideas anyone has?
<style>
h2 {
padding-top: 50px;
padding-bottom: 50px;
text-align: center;
margin-bottom: 30px;
font-size:50px;
}
h3{
font-size:45px;
}
li{
margin-bottom: 40px;
font-stretch: 100%;
}
</style>
<h1 style='text-align:center' class='tjs-h2'></h1>
<div class="maps container-fluid" style="align-items: center; background: #F3F3F3">
<div class="row">
<div class="col">
<h2 class="font-2">Serving the Greater Twin Cities Area </h2>
</div>
</div>
<div class="row">
<div class="col-md-6 col-12 d-flex justify-content-center pb-4">
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d90327.44687139073!2d-93.2367809086671!3d44.96942454616932!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x87f629fd5bb7538f%3A0xd070c186a8aea420!2sTwin%20Cities%2C%20MN!5e0!3m2!1sen!2sus!4v1639701112792!5m2!1sen!2sus" width="600" height="600" style="border:0;" allowfullscreen="" loading="lazy">
</iframe>
</div>
<div class="col-md-2 col-sm-4 col-
</div>
<div class="col-md-2 col-sm-4 col-12 d-flex justify-content-center">
<h3>
<ul class="cities">
<li >Minneapolis and suburbs 10 minutes in any direction</li>
<li >St. Paul and suburbs 10 minutes in any direction</li>
</ul>
</h3>
</div>
<div class="col-md-2 col-sm-4 col-
</div>
You could widen the div instead. I tried out the code on my computer. The website displayed a bit differently, but this seemed to help.
div#navigation {width: XXXpx; }
<div class="col-md-2 col-sm-4 col-12 d-flex justify-content-center" id="navigation">
Supposed I have a horizontal list:
About Admissions Academics Research News Events
I want them to be n-unit apart from the proceeding word based on their length.
| About | Admissions | Academics | Research | News | Events |
The illustration above is essentially the heart of my question. How can I make the words equidistant from each other? How can I vary the area of the rectangles in order to create equidistance?
For example, "Research" will have a much greater area than "News" but their distance is the same as the words such as "About" and "Admissions" and "Admissions" and "Academics".
.school_info {
background-color: black;
text-align: center;
}
.school_info_row {
margin: 0 10% 0 10%;
width: auto;
padding-bottom: 15px;
}
.public_info_container {
padding-left: 0;
padding-right: 0;
}
.public_info {
font-size: 20;
font-family:'Cinzel', serif;
color: white;
width: 150px;
}
<div class="school_info">
<div class="row school_info_row">
<div class="col-lg-2 col-md-4 public_info_container">
<a class="public_info" href="">About</a>
</div>
<div class="col-lg-2 col-md-4 public_info_container">
<a class="public_info" href="">Admissions</a>
</div>
<div class="col-lg-2 col-md-4 public_info_container">
<a class="public_info" href="">Academics</a>
</div>
<div class="col-lg-2 col-md-4 public_info_container">
<a class="public_info" href="">Research</a>
</div>
<div class="col-lg-2 col-md-4 public_info_container">
<a class="public_info" href="">News</a>
</div>
<div class="col-lg-2 col-md-4 public_info_container">
<a class="public_info" href="">Events</a>
</div>
</div>
</div>
</div>
You almost got it. Bootstrap column totals must add up to 12. Your col-lg-x is correct, it adds up to 12, your col-md-x needs to have value 2 as well. Since both lg and md media-breakpoints use the value 2, you can just replace it with col-2. I'm assuming this is bootstrap because those are bootstrap classes. Bootstrap also has mx-auto class so you can make the margins on the x-axis equidistant.
.school_info {
background-color: black;
text-align: center;
}
.public_info {
font-size: 20;
font-family:'Cinzel', serif;
color: white;
/*width: 150px;*/
}
.hilite {
border-left: 1px solid red;
border-right: 1px solid red;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="school_info">
<div class="row">
<div class="col-2 hilite">
<a class="public_info mx-auto" href="">About</a>
</div>
<div class="col-2 hilite">
<a class="public_info mx-auto" href="">Admissions</a>
</div>
<div class="col-2 hilite">
<a class="public_info mx-auto" href="">Academics</a>
</div>
<div class="col-2 hilite">
<a class="public_info mx-auto" href="">Research</a>
</div>
<div class="col-2 hilite">
<a class="public_info mx-auto" href="">News</a>
</div>
<div class="col-2 hilite">
<a class="public_info mx-auto" href="">Events</a>
</div>
</div>
</div>
</div>
I have a basic thumbnail display using bootstrap. I want to have 3 images in a row and go down to 2 images when making the page smaller. I had this worked out until I added a margin-right to add some space in between thumbnails. Once I did this it pushed that third image down to the next line. I tried playing around with the padding and margin and I just cant get that third thumbnail to stay on the same line. I also tried changing it to col-sm-3 and that did not seem to work either.
HTML:
<div class="work">
<ul>
<li class="thumbnail col-sm-4 col-xs-6"><img src="thumbnails.png"/></li>
<li class="thumbnail col-sm-4 col-xs-6"><img src="thumbnails.png"/></li>
<li class="thumbnail col-sm-4 col-xs-6"><img src="thumbnails.png"/></li>
</ul>
</div>
CSS:
.work {
padding: 0px 40px 0px 0px;
max-width: 100%;
}
.thumbnail {
margin-right: 10px;
}
I'm not 100% if this what you mean, but here it goes:
HTML
<div class="work">
<ul>
<li class="thumbnail col-sm-4 col-xs-6"><img src="thumbnails.png"/></li>
<li class="thumbnail col-sm-4 col-xs-6"><img src="thumbnails.png"/></li>
<li class="thumbnail col-sm-4 col-xs-6"><img src="thumbnails.png"/></li>
</ul>
</div>
CSS
.thumbnail {
border:0;
}
.thumbnail a{
display:block;
padding:10px;
background:red;
}
.thumbnail img{
width:100%;
}
https://jsfiddle.net/ax7wcLo4/2
If you really want to separate the li elements, you should do that without bootstrap's default grid system.
<ul class="list-unstyled list-inline">
Use class .list-inline on th eul element and set the below css for them;
ul {
margin: 0;
padding: 0;
width: 100%
}
li {
width: calc(100% - 10px);
margin: 0 5px;
}
Be Aware: calc has some compatibility issues based on your browser support range.
Can I Use Link for CALC
You should put the thumbnail inside of a column, not combined. If you need this inside a list it can be change to that as well > See Default Bootstrap Example.
See working Snippet at Full Page.
body,
html {
padding-top: 50px;
}
.row.no-list-style {
list-style: none;
margin-left: -55px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<h3>Default</h3>
<div class="row">
<div class="col-sm-4 col-xs-6">
<div class="thumbnail">
<a href="#honey">
<img src="http://placehold.it/350x350/f00" />
</a>
</div>
</div>
<div class="col-sm-4 col-xs-6">
<div class="thumbnail">
<a href="#honey">
<img src="http://placehold.it/350x350/000" />
</a>
</div>
</div>
<div class="col-sm-4 col-xs-6">
<div class="thumbnail">
<a href="#honey">
<img src="http://placehold.it/350x350/f00" />
</a>
</div>
</div>
</div>
</div>
<hr>
<div class="container">
<h3>Inside a List</h3>
<ul class="row no-list-style">
<li class="col-sm-4 col-xs-6">
<div class="thumbnail">
<a href="#honey">
<img src="http://placehold.it/350x350/ff0" />
</a>
</div>
</li>
<li class="col-sm-4 col-xs-6">
<div class="thumbnail">
<a href="#honey">
<img src="http://placehold.it/350x350/000" />
</a>
</div>
</li>
<li class="col-sm-4 col-xs-6">
<div class="thumbnail">
<a href="#honey">
<img src="http://placehold.it/350x350/ff0" />
</a>
</div>
</li>
</ul>
</div>
I have a section that includes three images. It looks perfectly fine on every display except mobile, where the images float right. They seem to align with a starting point at the center. Every other section on my site aligns perfectly as the boostrap rows tell them to.
<section id="press" class="parralax-window img-responsive" data- parallax="scroll" data-image-src="img/dawn.jpg">
<div class="row text-center">
<div class="col-md-12 col-lg-12 col-sm-12 col-xs-12">
<h2><strong>Omtale</strong></h2>
</div>
<div class="companies">
<div class="col-md-4 col-lg-4 col-sm-4 col-xs-12">
<img src="http://i.imgur.com/0ETpuAx.png" class="img-responsive" alt="Iphoneguide - SvampeGuide">
</div>
<div class="col-md-4 col-lg-4 col-sm-4 col-xs-12">
<img src="http://i.imgur.com/8W49tLt.png" class="img-responsive" alt="Politiken - SvampeGuide">
</div>
<div class="col-md-4 col-lg-4 col-sm-4 col-xs-12">
<img src="http://i.imgur.com/pax4KwJ.png" class="img-responsive" alt="Spisesvampe - SvampeGuide">
</div>
</div>
</div>
</section>
I'm using a parralax plugin but I tried it without it and it doesn't seem to be causing anything.
My css:
#press {
color: white;
padding: 8em;
}
#press h2 {
padding-bottom: 5%;
font-size: 5vmax;
}
#press img {
min-height: 30px;
min-width: 150px;
display: inline !important;
}
I also tried removing the img-responsive class but that didn't help.
Do you any idea what's causing this?
http://jsfiddle.net/wyLqa8w5/1/
#press {
padding: 15%;
}
I think you should look into bootstrap a bit more.
For example,
<div class="col-md-12 col-lg-12 col-sm-12 col-xs-12">
can be shortened to just
<div class="col-xs-12">
Also, remember to self-close your image tags:
<img src="" />
<div class="col-md-12 col-lg-12 col-sm-12 col-xs-12">
<h2><strong>Omtale</strong></h2>
</div>
Hej,
I am pretty sure above code is incorrect and you should wrap the div for the col-md-12 around all 3 cols containing the img's - try it. Furthermore can you supply me with the .img-responsive class?
I'd like to see it.
i'm create a little site like a app store page, and cant align all elements in the middle of div .game-dark
<div class="row">
<div class="game-dark col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="number col-lg-1 col-md-1 col-sm-1 col-xs-1">
<p>1</p>
</div>
<div class="col-lg-1 col-md-1 col-sm-2 col-xs-2">
<img src="img/kings-empire.png" alt="Kings Empire" title="Kings Empire" class="thumb img-responsive">
</div>
<div class="col-lg-8 col-md-8 col-sm-7 col-xs-5">
<h2 class="game-name">Kings Empire</h2>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-3">
<button type="button" class="btn btn-default">Скачать</button>
</div>
</div>
How i can vertical align all elements in the middle in my case?
Live example - here
there are multiple ways to realize this.
here a simple way:
add this to your css
.game-dark {
line-height: 100px;
}
no margin on <p>
.number p {
margin: 0;
}
set max-height to the img
.img-responsive {
min-height: 45px;
min-width: 45px;
max-height: 100px;
}
remove margin/padding of h2
h2.game-name {
margin:0;
padding: 0;
line-height: 100px
}
more ways are here http://www.vanseodesign.com/css/vertical-centering/
First set line-height to 98px on .game-dark.col-lg-12.col-md-12.col-sm-12.col-xs-12, and remove display: block style from image. That will align everything except second to last div. With h2 set top and bottom margin to 0, and also set line-height to 98px.