Trouble with centering columns in this footer - html

I'm using bootstrap and I have this footer that is 4 columns. I have it set to text-center which places everything in the center of the column, but also center justifies everything making it look weird. I would like to keep everything centered in their columns but also left justified, if this isn't possible any suggestions on how to make this look better would be appreciated. it needs to stay 4 columns though.
here is my codepen
https://codepen.io/RobotHead/pen/MWYZBwm
here is the code:
<div class="Layout">
<div>
<div class="row text-center">
<div class="col-xs-12 col-sm-6 col-md-3 footer-column">
<div class="h3 m-20 no-m-lr">Contact Us</div>
<div class="block-center">
<p>MySite</p>
<p class="block">123xyz st</p>
<p class="block">Suite 7</p>
<p class="block">Marklar, Mr 555555</p>
<p>555-555-5555</p>
<p>
MyEmail
</p>
</div>
</div>
<!-- /Column -->
<div class="col-xs-12 col-sm-6 col-md-3 footer-column">
<div class="block-center">
<h3> Company Information
</h3>
<ul>
<li>
About Us
</li>
<li>
Company Policy
</li>
<li>
Privacy Policy
</li>
<li>
About Us
</li>
<li>
Company Policy
</li>
<li>
Privacy Policy
</li>
</ul>
</div>
</div>
<!-- /Column -->
<div class="col-xs-12 col-sm-6 col-md-3">
<div class="block-center">
<h3> Get The Latest Deals
</h3>
<p class="mail-text saleprice">Sign up today for our latest deals!</p>
<p>Sign up here: <input type="text"> </p>
<p>Join our savings club</p>
</div>
</div>
<!-- /Column -->
<div class="col-xs-12 col-sm-6 col-md-3 footer-column">
<div class="block-center">
<h3>We Accept</h3>
<p>Accepted Credit Cards</p>
<p>Amex</p>
<p>Discover</p>
<p>Mastercard</p>
<p>Visa</p>
<div class="paypal-logo">
<br>
<table border="0" cellpadding="10" cellspacing="0" align="center">
<tbody>
<tr>
<td align="center"></td>
</tr>
<tr>
<td align="center">
<a href="https://www.paypal.com/webapps/mpp/paypal-popup" title="How PayPal Works" onclick="javascript:window.open('https://www.paypal.com/webapps/mpp/paypal-popup','WIPaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=1060, height=700'); return false;">
<img src="https://www.paypalobjects.com/digitalassets/c/website/marketing/na/us/logo-center/12_bdg_payments_by_pp_2line.png" alt="Secured by PayPal" data-image="vrtk4rr60c81">
</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- /Column -->
</div>
</div>
</div>

add this style:
.block-center {
text-align: left;
margin: auto;
display: inline-block;
}

Related

How to use inline-block

I have some ads I want placing side by side and making all the same size but, whilst float: left works to get them to float left, display: inline-block, which should stack them in a grid side by side, and max-width doesn't.
Tried Css
#media (min-width: 768px){.box-
layout {max-width: 100%; float:
left; display: inline-block;}}
This, as mentioned, floats left but doesn't place side by side or make all the ads the same size. It also throws up a css lint obstruction that float and display can not be used together.
https://adsler.co.uk/find-an-event/
HTML:
<div class="line-layout"
style="display: none;">
<li class="event_listing post-6985
type-event_listing status-expired
hentry" style="visibility:
visible;" data-latitude="" data-
longitude="">
<div class="event-
info-row-listing">
<a href="https://adsler.co.uk/
event/new-cross-and-deptford-free-
film-festival/">
<div class="row"><div class="col-
md-1">
<div class="organizer-logo">
<img alt="Deptford Film Festival"
src="https://adsler.co.uk/wp-
content/uploads/event-manager-
uploads/event_banner/2019/05/2
456d41f16399aed538d25b1cd32ad1
4.jpg">
</div>
</div><div class="col-md-4">
<div class="event-title">
<h4>New Cross and
Deptford Free Film Festival</h4>
<div class="boxes-view-
listing-
registered-code">
</div>
<div class="event-
organizer-
name">
<normal>Deptford Film Festival
<normal></normal>
</normal>
</div>
</div>
<div class="col-md-2">
<div class="date"
<date>2019-05-26</date>
</div>
</div>
<div class="col-md-3">
<div class="event-
location"><i class="glyphicon
glyphicon-map-
marker"></i> London </div>
</div>
<div class="col-md-2">
<div class="event-
ticket">#free</div>
</div>
<div class="col-md-3">
</div>
</div>
</a>
</div>
</li>
</div>
<!-- Box Layout -->
<a class="event_listing post-6985
type-event_listing status-expired
hentry" href="https://adsler.co.uk
/event/new-cross-and-deptford-free-
film-festival/">
<div class="box-layout">
<div class="event-img"><img
alt="Deptford Film Festival"
src="https://adsler.co.uk/wp-
content/uploads/event-manager-
uploads/event_banner/2019/05/2
456d41f16399aed538d25b1cd32
ad14.jpg"></div>
<div class="boxes-view-box-
registered-code">
</div>
<div class="event-title">
New Cross and Deptford Free Film
Festival
</div>
<div class="event-start-
date">2019- 05-26
</div>
<div class="event-location">
<i class="glyphicon glyphicon-
map-
marker"></i> London </div>
<div class="box-footer">
<div class="event-
ticket">#free</div>
</div>
</div>
</a>
your html and css are quite chaotic.
I made an example how it should be and how it works.
Ps. don't pay attention to
max-width:800px;
thats just for demo purposes.
https://codepen.io/anon/pen/QXWLrg
Hope it helps you out!

divs are not horizantal bootstrap

I want to make 3 columns horizontal and ı use col-md-12 for main column and for child columns col-md-4 but my row have only one columns and sub divs are vertical.My english not good enough but please help me.All divs are under other div and all divs are left side of page.I try my html in other project this is worked but in this projecy one thing corrupted my grid system but ı cant find it.
This is my nested Layout
#model HomeViewModel
#*#{
ViewData["Title"] = "News";
}*#
#section PageTitle{
etwyrjs
}
#section PageDesc{
etwyrjs
}
#*<div class="col-md-12">
<h2>News</h2>
</div>*#
#foreach (var pie in Model.Pies)
{
<div class="col-sm-4 col-lg-4 col-md-4">
<div class="thumbnail">
<img src="#pie.ImageThumbnailUrl" alt="" />
<div class="caption">
<h3 class="pull-right">#pie.Price.ToString("c")</h3>
<h3>
<a asp-controller="Home" asp-action="Details"
asp-route-id="#pie.Id">#pie.Name</a>
</h3>
<p>#pie.ShortDescription</p>
</div>
</div>
</div>
}
This is my nested Layout.
#{
ViewData["Title"] = "LayoutForOthers";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="row">
<div class="col-md-12">
<img src="~/images/büyük foto-1.png" alt="Snow" style="width:100%;">
#*<div class="bottom-left">
</div>*#
<div class="top-left">
<h1 style="text-align:left; color:white">#RenderSection("PageTitle")</h1>
<br />
<br />
<p style="text-align:left; color:white;">#RenderSection("PageDesc") Dijital sağlık alanında dünyanın önde gelen isimlerinden olan ve İngiltere'nin en büyük sağlık teknolojisi topluluğu Health 2.0 London'ı kuran Maneesh Juneja, yapay zekanın geleceği hakkında önemli açıklamalarda bulundu. Kendisini ''dijital sağlık fütüristi'' olarak nitelendiren Juneja, geçtiğimiz hafta İstanbul'da katıldığı etkinlikte yapay zeka ile ilgili soruları yanıtlarken 2040 yılının önemli bir dönüm noktası olabileceğini işaret etti.</p>
</div>
#*<div class="top-right">Top Right</div>
<div class="bottom-right">Bottom Right</div>
<div class="centered">Centered</div>*#
</div>
</div>
<div class="row">
<div class="col-md-12">
#RenderBody()
</div>
</div>
This is from my main layout.
<div class="col-md-12">
#RenderBody()
</div>
Are you looking for something like this? This should work regardless of what your Bootstrap version is. (Open it in fullscreen)
<!-- Include this in your <head> -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="row">
<div class="col-sm-12 bg-primary">
<!-- This is you full width column -->
<p>This is you full width column</p>
</div>
<div class="row">
<div class="col-sm-4 bg-danger">
<!-- This is 1/3 columns -->
<p>Column 1</p>
</div>
<div class="col-sm-4 bg-info">
<!-- This is 2/3 columns -->
<p>Column 2</p>
</div>
<div class="col-sm-4 bg-success">
<!-- This is 3/3 columns -->
<p>Column 3</p>
</div>
</div>
</div>

Stuck trying to align things HTML CSS

So I keep trying to align images and text to the center and they keep appearing on the left side of the screen can someone help.
<div class="container">
<div class="col-md-6 col-sm-6 hidden-xs">
<div class="row">
<p class="borderexample3">
<font color="white" class=> Recent News</font>
</p>
</div>
<h1><font color="white"><font face="roboto-bold,roboto,sans-serif"<h1 align="right">Keep Updated!</font></h1>
<div style="text-align: center"><img src="assets/img/fwah.jpg" /></div>
</div>
</div>
This is what shows up.
http://prntscr.com/kgc5c2
I would like it where my red guidelines are on this image.
http://prntscr.com/kgc5tn
Try pushing your columns using col-sm-push-#.
<div class="col-sm-push-3 col-sm-6 hidden-xs">
try this
<div class="container" align="center">
I guess you have to add the following lines in wherever you want to make it center:
style="text-align:center;"
<div class="container">
<div class="col-md-6 col-sm-6 hidden-xs">
<div class="row">
<p class="borderexample3" style="text-align:center;">
<font color="black" class=""> Recent News</font>
</p>
</div>
<h1 style="text-align:center;"><font color="black"><font face="roboto-bold,roboto,sans-serif"<h1 align="right">Keep Updated!</font></h1>
<div style="text-align: center"><img src="assets/img/fwah.jpg" /></div>
</div>
</div>

resizing social links with media queries

I am having some difficulties. I am developing a website and am having issues with the social link icons going tiny when the screen size is reduced. I'd like to use media queries to specify the size for smaller screens - what I am trying is not working.
Social links at top of page:
`<div class="container">
<div class="row-1">
<!--First column-->
<div class="col-sm-3">
<img src="images/fbGrey.png" class="img-responsive"
style="width:50px" alt="Find us on Facebook">
<hr class="vertical"/>
</div>
<!--Second column-->
<div class="col-sm-3">
<img src="images/twitterGrey.png" class="img-responsive"
style="width:50px" alt="Follow us on Twitter">
<hr class="vertical"/>
</div>
<!--Third column-->
<div class="col-sm-3">
<img src="images/instagramGrey.png" class="img-responsive"
style="width:50px" alt="Follow us on Instagram">
<hr class="vertical"/>
</div>
<!--Fourth column-->
<div class="col-sm-3">
<img src="images/pinterestGrey.png" class="img-responsive"
style="width:50px" alt="Follow us on Pinterest">
<hr class="vertical"/>
</div>
</div>
</div>`
Social links in footer:
`
<!--First column-->
<div class="col-md-3">
<!--Social buttons-->
<!--First column-->
<div class="container">
<div class="row-3">
<div class="col-sm-3">
<img src="images/fbGrey.png" class="img-responsive"
style="width:70px" alt="Find us on Facebook" id="fb">
<img src="images/twitterGrey.png" class="img-responsive"
style="width:70px" alt="Follow us on Twitter">
<img src="images/instagramGrey.png" class="img-responsive"
style="width:70px" alt="Follow us on Instagram">
<img src="images/pinterestGrey.png" class="img-responsive"
style="width:70px" alt="Follow us on Pinterest">
</div>
</div>
</div>`
Additionally, within the footer the height of <div class="footer-copyright">
increases when the screen size is reduced - anybody know why this is happening? I would also like to use media queries to fix this but it doesn't seem to work.
`<!--footer-->
<div class="span4">
<!-- empty, but using spacer to prevent collapse -->
<div class="spacer10"></div>
</div> </div>
<!--Second column-->
<div class="col-md-3">
<h5 class="title">OUR SERVICES</h5>
<p>Treatments</p>
<p>Bookings</p>
<p>Shop</p>
</div>
<!--First column-->
<div class="col-md-3">
<h5 class="title">COMPANY</h5>
<p><a href=index.html>Home</a></p>
<p>Location</p>
<p>Contact</p>
<p>Privacy Policy</p>
</div>
<!--Second column-->
<div class="col-md-3">
<h5 class="title">CONTACT</h5>
<strong>Hands on Sports & Holistic Therapy</strong><br>
50 Westonfields<br>
Bridgetown<br>
Totnes<br>
TQ90 5QX<br>
<abbr title="Phone">P: 07450232531</abbr><br><br>
</address>
<address>
<strong>Email: </strong><br>
jo#handson-therapy.com
</address>
</div>
</div>
</div>
<hr>
<!--Copyright-->
<div class="container">
<div class="row-5">
<div class="col-sm-12">
<div class="footer-copyright">
<div class="container-fluid">
<center>© 2017 Copyright: Hands on Sports & Holistic
Therapy. All rights reserved.</center>
</div>
</div>
</div>
</div>
<div class="span4">
<!-- empty, but using spacer to prevent collapse -->
<div class="spacer40"></div>
</div>
</footer>
<!--/.Footer-->`
Here is my code in JSFiddle - obvs no images present.
https://jsfiddle.net/AnnieWebDev/frrvmpnr/
Thanks for your help :)
have you tried to set min-width: 70px !important; on the img tag. This way the image will not go any smaller than the value which you set in there.
You have several errors in your code. Enter your code here and hit check and then fix the errors. html validator
Take </link> off the end of the <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"></link>
<center> is obscolete, use css. In your css style sheet you can add h1 {
text-align: center;} or inline html do it like this <h1 style="text-align:center;">Centered Heading</h1>
Try adding this in your head tag:
<meta name="viewport" content="width=device-width, initial-scale=1">

Using Bootstrap, insert a vertical line in the middle to separate 3 icons to the left, and 3 icons to the right, and still make it responsive

I'm hoping someone can help solve a problem I've had for the last 2 days. Unfortunately I can't post an image of that here as I'm new, and have no reputation points.
I have a layout with 2 sections.
1st Section
First row: Heading (centered)
Second row: 6 icons spread out across the width of the page, and their relevant 1-2 words description below each of the respective icons.
2nd Section
First row: 2 Headings (one centered on the left, the other centered on the right; separated by a white vertical line in the middle of the page)
Second row: 6 icons spread out across the width of the page as per the 1st section; but this time, the first 3 icons belong to the first Heading, and the last 3 icons belong to the second Heading.... with a vertical line in the middle, to separate out the 1st Heading & 3 icons on the left, and the 2nd Heading & last 3 icons on the right.
I could get the first line (heading, 6 icons and their relevant 1-2 words description) working in CSS. I used container-fluid, row, and the necessary col-sm-2 classes in Twitter-Bootstrap.
But how do I insert a border-right 100% white line (or any other suggestions will be very welcome), and squish it in between the 2nd row's two Headings and divide the icons into 3x3, at the same time?
The code below is what I used for the 1st section:
<div class="container-fluid">
<h5 class="text-center">HEADER 1</h5>
<ul class="row">
<li class="col-xs-4 col-sm-2">
<img src="img/1.png" alt="icon1">
<p class="text-center">2-word description</p>
</li>
<li class="col-xs-4 col-sm-2">
<img src="img/2.png" alt="icon2">
<p class="text-center">2-word description</p>
</li>
<li class="col-xs-4 col-sm-2">
<img src="img/3.png" alt="icon3">
<p class="text-center">2-word description</p>
</li>
<li class="col-xs-4 col-sm-2">
<img src="img/4.png" alt="icon4">
<p class="text-center">2-word description</p>
</li>
<li class="col-xs-4 col-sm-2">
<img src="img/5.png" alt="icon5">
<p class="text-center">2-word description</p>
</li>
<li class="col-xs-4 col-sm-2">
<img src="img/6.png" alt="icon6">
<p class="text-center">2-word description</p>
</li>
</ul>
<hr>
</div><!-- /.container-fluid -->
I need the next section to be somewhat like the 1st section, but have a vertical white line in the middle of the section, separating the 2nd header and 3 icons to the left, and the 3rd header and the last 3 icons to the right.
The code below is for the 2nd section:
<div class="container-fluid">
<ul class="row">
<li class="col-xs-12 col-sm-6">
<h5 class="text-center">HEADER 2</h5>
</li>
<li class="col-xs-12 col-sm-6">
<h5 class="text-center">HEADER 3</h5>
</li>
</ul>
</div><!-- /.container-fluid -->
<div class="container-fluid section2">
<div class="row">
<div class="left col-xs-12 col-sm-6">
<div class="container-fluid">
<ul class="row">
<li class="col-xs-4 col-sm-4">
<img src="img/7.png" alt="icon7">
<p class="text-center">2-word description</p>
</li>
<li class="col-xs-4 col-sm-4">
<img src="img/8.png" alt="icon8">
<p class="text-center">2-word description</p>
</li>
<li class="col-xs-4 col-sm-4">
<img src="img/9.png" alt="icon9">
<p class="text-center">2-word description</p>
</li>
</ul>
</div><!-- /.container-fluid -->
</div><!-- /.left -->
<div class="right col-xs-12 col-sm-6">
<div class="container-fluid">
<ul class="row">
<li class="col-xs-4 col-sm-4">
<img src="img/10.png" alt="icon10">
<p class="text-center">2-word description</p>
</li>
<li class="col-xs-4 col-sm-4">
<img src="img/11.png" alt="icon11">
<p class="text-center">2-word description</p>
</li>
<li class="col-xs-4 col-sm-4">
<img src="img/12.png" alt="icon12">
<p class="text-center">2-word description</p>
</li>
</ul>
</div><!-- /.container-fluid -->
</div><!-- /.right -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
Your invaluable help will be very much appreciated!
Thanks in advance!
new code for the 2nd section
<div class="section2">
<div class="left container-fluid">
<div class="row">
<h5 class="col-xs-12 col-sm-6 text-center">
HEADER2
</h5>
</div>
<ul class="row">
<li class="col-xs-4 col-sm-2">
<img src="img/7.png" alt="icon7">
<p class="text-center"2-word description</p>
</li>
<li class="col-xs-4 col-sm-2">
<img src="img/8.png" alt="icon8">
<p class="text-center">2-word description</p>
</li>
<li class="col-xs-4 col-sm-2">
<img src="img/9.png" alt="icon9">
<p class="text-center">2-word description</p>
</li>
</ul>
</div><!-- /.left .container-fluid -->
<div class="right container-fluid">
<div class="row">
<h5 class="col-xs-12 col-sm-6 text-center">
HEADER3
</h5>
</div>
<ul class="row">
<li class="col-xs-4 col-sm-2">
<img src="img/10.png" alt="icon10">
<p class="text-center">2-word description</p>
</li>
<li class="col-xs-4 col-sm-2">
<img src="img/11.png" alt="icon11">
<p class="text-center">2-word description</p>
</li>
<li class="col-xs-4 col-sm-2">
<img src="img/12.png" alt="icon12">
<p class="text-center">2-word description</p>
</li>
</ul>
</div><!-- /.right .container-fluid -->
</div><!-- /.section2 -->
NEW QUESTION
Hi... I have another small question...
I was working on the big screen and it wasn't obvious to me until now that I've started working on the #mediaqueries, and resizing the screen.
The icons and the the respective 2-word descriptions aren't exactly centered with each other. The 2-word descriptions are slightly to the right of the icons above.
I've tried using the bootstrap class .text-center on the element, it didn't work.
I've also tried giving the a class, and then using "margin: 0 auto" in CSS, and it also did not work.
Where have I gone wrong?
Thanks in advance.
first you should consider .section2 as a row, with two children header1 and header2. so add class="row" to this div, and apply class="col-xs-12 col-sm-6" to each header block.
then consider each header block as a single row, containing 3 images with description. do same action as before.
.container-fluid and .left .right are no longer necessary, as the parent .row and children's .col-* take care of these for you.
Update: sorry for ignoring your problem with the blank in the middle. it is caused by the default style of <ul>, and could be solved by adding ul { padding-left: 0;}.
see this fiddle for example.
In your second section make two main rows, these contain nested rows for your headings and respective icons. On the first row add a border-right.