I have this div i want to center on my page as shown in the code bellow, the problem is that i am trying to add "class="center"" to each div but i cant center the whole box, anyone know why it wont center?
<div style="text-align: center;" class="pricing-table">
<?php foreach ($days AS $k => $day): ?>
<div class="col-md-5ths col-xs-6">
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="text-center"><strong><?php echo UCWords(t('BUY', 'BUY')); ?></strong><br/><?php echo UCWords(t('SUBDOMAIN', 'SUBDOMAIN')); ?></h3>
</div>
<div class="panel-body text-center">
<p class="lead total-price" style="font-size:40px"><strong><?php echo SITE_CONFIG_COST_CURRENCY_SYMBOL; ?><?php echo number_format(str_replace(",", "", constant('SITE_CONFIG_COST_FOR_' . $day . '_DAYS_PREMIUM')), 2); ?></strong></p>
<p class="lead price-per-day" style="font-size:16px">
</div>
<ul class="list-group list-group-flush text-center">
<li class="list-group-item"><i class="fa fa-lock"></i> <?php echo UCWords(t('secure_payment', 'secure payment')); ?></li>
<li class="list-group-item"><i class="fa fa-eye-slash"></i> <?php echo UCWords(t('safe_and_anonymous', '100% Safe & Anonymous')); ?></li>
</ul>
<div class="panel-footer">
<?php
pluginHelper::outputPaymentLinks($day);
?>
</div>
</div>
</div>
<?php endforeach; ?>
<div class="clear"></div>
</div>
You can try flexbox. Something like the following code.
.center {
display: flex;
justify-content: center;
align-items: center;
}
Your code is already centered, which means the classes you have added but not included in your question are overriding your changes.
I strongly recommend that you use classes for styling and remove all inline styling (style="")as this have higher specificity causing overwrites.
<div style="text-align: center;" class="pricing-table">
<div class="col-md-5ths col-xs-6">
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="text-center"><strong>BUY</strong><br/>SUBDOMAIN</h3>
</div>
<div class="panel-body text-center">
<p class="lead total-price" style="font-size:40px"><strong>SAMPLE</strong></p>
<p class="lead price-per-day" style="font-size:16px">
</div>
<ul class="list-group list-group-flush text-center">
<li class="list-group-item"><i class="fa fa-lock"></i></li>
<li class="list-group-item"><i class="fa fa-eye-slash"></i> </li>
</ul>
<div class="panel-footer">
FOOTER
</div>
</div>
</div>
</div>
MY RECOMMENDED METHOD
.pricing-table {
background: #eee;
}
.panel {
display: flex;
flex-direction: column;
align-items: center;
}
.text-center {
text-align: center;
}
.total-price {
font-size: 40px;
}
.price-per-day {
font-size: 16px;
}
<div class="pricing-table">
<div class="col-md-5ths col-xs-6">
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="text-center"><strong>BUY</strong><br/>SUBDOMAIN</h3>
</div>
<div class="panel-body text-center">
<p class="lead total-price"><strong>SAMPLE</strong></p>
<p class="lead price-per-day">
</div>
<ul class="list-group list-group-flush text-center">
<li class="list-group-item"><i class="fa fa-lock"></i></li>
<li class="list-group-item"><i class="fa fa-eye-slash"></i></li>
</ul>
<div class="panel-footer">
FOOTER
</div>
</div>
</div>
</div>
<div style="text-align: center;"></div>
Or(You need to have a css document)
HTML
<link rel="stylesheet" type="text/css" href="Style.css">
<div class="center">
CSS
.center{
text-align: center;
}
Related
I searched here already and tried some accepted solutions but not worked for my case. I have listed some html and I need these elements both wrapper element and inner elements in single line.
here how it looks now and html;
html;
<div class="container-fluid">
<div class="col-sm-4 col-md-4 col-lg-4">
<div class="well">
<ul class="media-list">
<li class="media">
<a class="toggle-area pull-left" href="javascript:void(0);">
<img class="media-object" alt="Mali Sistemler" src="/Content/img/login/mali_hizmetler.png">
</a>
<div class="media-body">
<h4 class="toggle-area media-heading"><span style="width: 95%;">Mali Sistemler</span><i class="fa fa-parent-container fa-plus-square pull-right"></i></h4>
<div class="container-menus" style="display:none;"></div>
</div>
</li>
</ul>
</div>
<div class="well">... </div>
</div>
<div class="col-sm-4 col-md-4 col-lg-4">
<div class="well">
<ul class="media-list">
<li class="media">
<a class="toggle-area pull-left" href="javascript:void(0);">
<img class="media-object" alt="Denetim Sistemleri" src="/Content/img/login/denetim.png">
</a>
<div class="media-body">
<h4 class="toggle-area media-heading"><span style="width: 95%;">Denetim Sistemleri</span><i class="fa fa-parent-container fa-plus-square pull-right"></i></h4>
<div class="container-menus" style="display:none;"></div>
</div>
</li>
</ul>
</div>
<div class="well">... </div>
</div>
</div>
Sequences of white-space will collapse into a single white-space. Text will never wrap to the next line. The text continues on the same line until a <br> tag is encountered
Use white-space:nowrap
Update css
.media-body, .media-left, .media-right {
display: table-cell;
vertical-align: top;
white-space: nowrap; /* Add this */
}
Working fiddle
fiddle code
I have want the UL to push to the bottom of the container for each item. I have margin-top:auto set for the item but it is not working. I have another demo that works but this is the one that I need to use. Any help?
.featured-products-carousel {
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
margin: 0 auto;
max-width: 1150px;
width: 80%;
}
.featured-products-carousel .item {
background-color: white;
padding: 20px;
align-items: stretch;
display: flex;
flex-direction: column;
margin: 10px;
padding: 0;
flex: 1 1 auto;
flex-wrap: wrap;
}
.featured-products-carousel .item h2 {
text-align: center;
padding: 8px 5px;
}
.featured-products-carousel .item .featured-product-description {
margin-bottom: auto;
}
.featured-products-carousel .item .featured-products-links {
margin-top: auto;
}
.featured-products-carousel .item ul {
margin-top: auto;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="featured-products-carousel" role="listbox">
<div class="item active visible-md visible-sm visible-lg product-item col-xs-12 col-md-3 col-sm-6" id="2">
<span class="h2-span">
<h2 class="h2-height"> [product-id] </h2>
</span>
<div class="product-image">
<a href="/products/[[product-id]]">
<img src="http://placehold.it/400x250" alt="[item-description]" class="img-responsive-center">
</a>
</div>
<p class="featured-product-description"> Description Text. Lots and lots of great content about a particular part. Description Text. Lots and lots of great content about a particular part.</p>
<ul class="list-unstyled">
<li>
<a href="/products/[product-id]">
More About [product-id] »
</a>
</li>
<li>
Datasheet
</li>
</ul>
</div>
<div class="item active visible-md visible-sm visible-lg product-item col-xs-12 col-md-3 col-sm-6" id="2">
<span class="h2-span">
<h2 class="h2-height"> [product-id] </h2>
</span>
<div class="product-image">
<a href="/products/[[product-id]]">
<img src="http://placehold.it/400x250" alt="[item-description]" class="img-responsive-center">
</a>
</div>
<p class="featured-product-description"> Description Text. Lots and lots of great content about a particular part. </p>
<ul class="list-unstyled">
<li>
<a href="/products/[product-id]">
More About [product-id] »
</a>
</li>
<li>
Datasheet
</li>
</ul>
</div>
<div class="item active visible-md visible-sm visible-lg product-item col-xs-12 col-md-3 col-sm-6" id="2">
<span class="h2-span">
<h2 class="h2-height"> [product-id] </h2>
</span>
<div class="product-image">
<a href="/products/[[product-id]]">
<img src="http://placehold.it/400x250" alt="[item-description]" class="img-responsive-center">
</a>
</div>
<p class="featured-product-description"> Description Text. Lots and lots of great content about a particular part. Description Text. Lots and lots of great content about a particular part.</p>
<ul class="list-unstyled">
<li>
<a href="/products/[product-id]">
More About [product-id] »
</a>
</li>
<li>
Datasheet
</li>
</ul>
</div>
<div class="item active visible-md visible-sm visible-lg product-item col-xs-12 col-md-3 col-sm-6" id="2">
<span class="h2-span">
<h2 class="h2-height"> [product-id] </h2>
</span>
<div class="product-image">
<a href="/products/[[product-id]]">
<img src="http://placehold.it/400x250" alt="[item-description]" class="img-responsive-center">
</a>
</div>
<p class="featured-product-description"> Description Text. Lots and lots of great content about a particular part. </p>
<ul class="list-unstyled">
<li>
<a href="/products/[product-id]">
More About [product-id] »
</a>
</li>
<li>
Datasheet
</li>
</ul>
</div>
</div>
The parent element isn't display: flex; even though you've specified that because there is another rule overwriting it with display: block!important;.
display: block!important is coming from bootstrap.css on line 6636 and another on line 6554.
.featured-products-carousel {
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
margin: 0 auto;
max-width: 1150px;
width: 80%;
}
.featured-products-carousel .item {
background-color: white;
padding: 20px;
align-items: stretch;
display: flex!important;
flex-direction: column;
margin: 10px;
padding: 0;
flex: 1 1 auto;
flex-wrap: wrap;
}
.featured-products-carousel .item h2 {
text-align: center;
padding: 8px 5px;
}
.featured-products-carousel .item .featured-product-description {
margin-bottom: auto;
}
.featured-products-carousel .item .featured-products-links {
margin-top: auto;
}
.featured-products-carousel .item ul {
margin-top: auto;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="featured-products-carousel" role="listbox">
<div class="item active visible-md visible-sm visible-lg product-item col-xs-12 col-md-3 col-sm-6" id="2">
<span class="h2-span">
<h2 class="h2-height"> [product-id] </h2>
</span>
<div class="product-image">
<a href="/products/[[product-id]]">
<img src="http://placehold.it/400x250" alt="[item-description]" class="img-responsive-center">
</a>
</div>
<p class="featured-product-description"> Description Text. Lots and lots of great content about a particular part. Description Text. Lots and lots of great content about a particular part.</p>
<ul class="list-unstyled">
<li>
<a href="/products/[product-id]">
More About [product-id] »
</a>
</li>
<li>
Datasheet
</li>
</ul>
</div>
<div class="item active visible-md visible-sm visible-lg product-item col-xs-12 col-md-3 col-sm-6" id="2">
<span class="h2-span">
<h2 class="h2-height"> [product-id] </h2>
</span>
<div class="product-image">
<a href="/products/[[product-id]]">
<img src="http://placehold.it/400x250" alt="[item-description]" class="img-responsive-center">
</a>
</div>
<p class="featured-product-description"> Description Text. Lots and lots of great content about a particular part. </p>
<ul class="list-unstyled">
<li>
<a href="/products/[product-id]">
More About [product-id] »
</a>
</li>
<li>
Datasheet
</li>
</ul>
</div>
<div class="item active visible-md visible-sm visible-lg product-item col-xs-12 col-md-3 col-sm-6" id="2">
<span class="h2-span">
<h2 class="h2-height"> [product-id] </h2>
</span>
<div class="product-image">
<a href="/products/[[product-id]]">
<img src="http://placehold.it/400x250" alt="[item-description]" class="img-responsive-center">
</a>
</div>
<p class="featured-product-description"> Description Text. Lots and lots of great content about a particular part. Description Text. Lots and lots of great content about a particular part.</p>
<ul class="list-unstyled">
<li>
<a href="/products/[product-id]">
More About [product-id] »
</a>
</li>
<li>
Datasheet
</li>
</ul>
</div>
<div class="item active visible-md visible-sm visible-lg product-item col-xs-12 col-md-3 col-sm-6" id="2">
<span class="h2-span">
<h2 class="h2-height"> [product-id] </h2>
</span>
<div class="product-image">
<a href="/products/[[product-id]]">
<img src="http://placehold.it/400x250" alt="[item-description]" class="img-responsive-center">
</a>
</div>
<p class="featured-product-description"> Description Text. Lots and lots of great content about a particular part. </p>
<ul class="list-unstyled">
<li>
<a href="/products/[product-id]">
More About [product-id] »
</a>
</li>
<li>
Datasheet
</li>
</ul>
</div>
</div>
I have implemented tabs using uib-tabset. There is issue with alignment of tab.
As you can see in below image, my 'Current' tab is shifted to left and it is moving out of card leaving uncomfortable space between 'Current' and 'Upcoming'.
I want both tabs to aligned perfectly with card.
Is there any way?
I have tried changing CSS in a lot of ways (.nav-tabs especially) but no luck.
HTML:
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="card" style="margin-left:3%;margin-right:3%" ng-controller="AppointmentsCtrl">
<uib-tabset active="active">
<div class="row">
<div class="col-xs-6 nav nav-tabs">
<uib-tab index="0" heading="Current"> <!-- -->
<ul class="list-group">
<li class="list-group-item">
<!-- <div id="accordion" role="tablist" aria-multiselectable="true"> -->
<div class="panel panel-default" style="border-color: white;">
<div class="panel-heading" role="tab" id="headingOne"
style="background-color: #686868; margin-top: 5%;">
<div class="row">
<div class="col-xs-2">
<div class="myimage">
<img id="image" src="img/Calender.png"
style="width: 30px; height: 30px;"></img>
<p id="text">26</p>
</div>
</div>
<div class="col-xs-8">
<p class="panel-title" data-toggle="collapse"
data-parent="#accordion"
ng-click="isCollapsed = !isCollapsed" aria-expanded="true"
aria-controls="collapseOne"
style="color: white; font-size: 15px">
Monday, 26 Sep 2016<br> 02:00 PM
</p>
</div>
<div class="col-xs-2">
<a data-toggle="collapse" data-parent="#accordion"
ng-click="isCollapsed = !isCollapsed" aria-expanded="true"
aria-controls="collapseOne"><img id="arrow"
src="img/Down_Arrow.png" style="width: 30px; height: 30px;"></img></a>
</div>
</div>
</div>
<div id="collapseOne" uib-collapse="isCollapsed"
class="panel-collapse collapse" role="tabpanel"
aria-labelledby="headingOne"
style="background-color: #d5d5d5;">
<div class="row">
<div class="col-xs-6 col-sm-offset-1">
<h5 style="color: #696969; margin-top: 5%;">Visitor
Name</h5>
<h5 style="color: #000; font-weight: bold;">Subodh
Bagade</h5>
<h5 style="color: #696969;">Purpose</h5>
<h5 style="color: #000; font-weight: bold;">Sales
Meeting</h5>
</div>
<div class="col-xs-6">
<img src="img/Gray_User.png"
style="margin-top: 10%; width: 110px; height: 100px;"></img>
</div>
</div>
<hr>
<div class="row">
<div class="col-xs-4">
<!-- <a ng-href="#/viewdetails/appointmentId={{appointment.appointmentId}}"> -->
<a ng-href="#/viewdetails/appointmentId=1"> <img
src="img/more.png" style="width: 30px; height: 30px;"></img>
</a>
</div>
<div class="col-xs-4">
<!-- <a ng-href="#/edit/appointmentId={{appointment.appointmentId}}"> -->
<a ng-href="#/edit/appointmentId=1"> <img
src="img/Edit_White.png" style="width: 30px; height: 30px;"></img>
</a>
</div>
<div class="col-xs-4">
<a ng-href="#" onClick="confirm('Are you sure?')"> <img
src="img/Delete.png" style="width: 30px; height: 30px;"></img>
</a>
</div>
</div>
</div>
</div>
<!-- </div> -->
</li>
</ul>
<!-- --> </uib-tab>
</div>
<div class="col-xs-6 nav nav-tabs">
<uib-tab index="1" heading="Upcoming">
<p>Some text here.</p>
</uib-tab>
</div>
</div>
</uib-tabset>
</div>
</div>
</div>
</div>
A part of my CSS:
.nav-tabs {
border-bottom: 1px solid #ddd;
}
.nav-tabs>li {
/* float: left; */
margin-bottom: -1px;
background-color:#E9880A;
}
.nav-tabs>li>a {
margin-right: 2px;
line-height: 0.42857143;
border: 1px solid transparent;
border-radius: 4px 4px 0 0;
}
this looks more like alignment issue. Once you align the tabs individually it should work fine. I was able to get it aligned by adjusting the tabs individually.
I have a below HTML code in which the images are purely responsive.
<div class="flexslider js-fullheight">
<ul class="slides">
<li style="background-image: url(images/slide_1.jpg); width:100%;" border="0" alt="Null">
<div class="overlay-gradient"></div>
<div class="container">
<div class="col-md-10 col-md-offset-1 text-center js-fullheight slider-text">
<div class="slider-text-inner">
<h2>Start Your Startup With This Template</h2>
<p>Get started</p>
</div>
</div>
</div>
</li>
<li style="background-image: url(images/slide_3.jpg);">
<div class="container">
<div class="col-md-10 col-md-offset-1 text-center js-fullheight slider-text">
<div class="slider-text-inner">
<h2>Take Your Business To The Next Level</h2>
<p>Get started</p>
</div>
</div>
</div>
</li>
<li style="background-image: url(images/slide_2.jpg);">
<div class="container">
<div class="col-md-10 col-md-offset-1 text-center js-fullheight slider-text">
<div class="slider-text-inner">
<h2>We Think Different That Others Can't</h2>
<p>Get started</p>
</div>
</div>
</div>
</li>
</ul>
</div>
In this, the slide_1.jpg image is responsive. What I want is, I want to replace this image with my actual Image.
I tried changing the image by giving width:100% but the Image was still getting stretched. Any idea, how to make that image responsive.
Update
and the css is below
#fh5co-hero .flexslider .slider-text > .slider-text-inner {
display: table-cell;
vertical-align: middle;
min-height: 700px;
}
#fh5co-hero .flexslider .slider-text > .slider-text-inner h2 {
font-size: 70px;
font-weight: 400;
color: #fff;
}
#media screen and (max-width: 768px) {
#fh5co-hero .flexslider .slider-text > .slider-text-inner h2 {
font-size: 40px;
}
}
#fh5co-hero .flexslider .slider-text > .slider-text-inner .fh5co-lead {
font-size: 20px;
color: #fff;
}
<div class="flexslider js-fullheight">
<ul class="slides">
<li style="background-image: url(/images/slide_1.jpg);">
<div class="overlay-gradient"></div>
<div class="container">
<div class="col-md-10 col-md-offset-1 text-center js-fullheight slider-text">
<div class="slider-text-inner">
<h2>Start Your Startup With This Template</h2>
<!--<p>Get started</p>-->
</div>
</div>
</div>
</li>
<li style="background-image: url(images/slide_3.jpg);">
<div class="container">
<div class="col-md-10 col-md-offset-1 text-center js-fullheight slider-text">
<div class="slider-text-inner">
<h2>Take Your Business To The Next Level</h2>
<!--<p>Get started</p>-->
</div>
</div>
</div>
</li>
<li style="background-image: url(images/slide_2.jpg);">
<div class="container">
<div class="col-md-10 col-md-offset-1 text-center js-fullheight slider-text">
<div class="slider-text-inner">
<h2>We Think Different That Others Can't</h2>
<!--<p>Get started</p>-->
</div>
</div>
</div>
</li>
</ul>
</div>
If you change only the width to 100% it will stretch the image inside of it. Try adding height:auto; to the inline CSS in order for the image to scale correctly.
If that doesn't work, try replacing your background-image property with:
background: url(images/slide_1.jpg) no-repeat center center;
background-size: cover;
I am working on the footer. On the right side down -image is attached- I have an image with a responsive "subscribe" button. There is one dive with one general row.This general row consists of two different rows.
The first row includes two grids: col-lg-4 / col-lg-8 (white background)
The second one includes three grids:col-lg-4 / col-lg-4 / col-lg-4 (black background)
I want to put the image in the second row in the very right grid which comes on the top of the very right grid in the first row.
the problem is although the image is put in the second row but it appears in the first row ! I want to correct it as the pattern
<div class="container-fluid p0 hidden-xs hidden-sm" style="border: solid yellow">
<div class="row">
<div class="col-lg-12 col-md-12 ">
<div class="row pb+ pt+ footer-border ">
<div class="col-lg-12 col-md-12">
<div class="container">
<!-- brand starts -->
<div class="col-lg-4 col-md-4 hidden-xs pl0">
<a href="/">
<i class=" icon-famousLogo icon-color famous-large "></i>
</a>
</div>
<!-- brand ends -->
<!-- Social Sharing Start -->
<div class="col-lg-8 col-md-8 hidden-xs clearfix">
<div class="col-lg-5 col-md-5 col-offset-7 pt-">
<ul class="list-inline float-r">
<li>
<span class="follow-us pr">FOLLOW US</span>
</li>
<li>
<a href="https://www.facebook.com/famousmagazine">
<i class=" icon-facebook icon-color facebook pr "></i>
</a>
</li>
<li>
<a href="https://twitter.com/famousweekly ">
<i class=" icon-twitter icon-color twitt pr"></i>
</a>
</li>
<li>
<a href="https://www.instagram.com/famousweekly/ ">
<i class=" icon-instagram icon-color instagram"></i>
</a>
</li>
<!-- They are supposed to be add later after getting the right URL-->
<!--<li >
<a href="https://www.youtube.com">
<i class=" icon-youtube icon-color youtube"></i>
</a>
</li>
<li >
<a href="https://www.instagram.com" >
<i class=" icon-Pintrest icon-color pint"></i>
</a>
</li>
<li >
<a href="https:https://twitter.com" >
<i class=" icon-tumblr icon-color twitt"></i>
</a>
</li> -->
<!-- Hidden Social Sharing Ends-->
</ul>
</div>
</div>
<!-- Social Sharing Ends -->
</div>
</div>
</div>
<!-- Second Row / Footer Lists Starts -->
<div class="row hidden-xs hidden-sm">
<div class="col-lg-12 col-md-12 ">
<div class="bottomMenu-parent" >
<div class="container">
<div class="col-lg-4 col-md-4 pl0 pt+ pb+" >
<table class="footer-table">
<tr>
<td>ABOUT US</td>
<td class="pl++">CoNTACT US</td>
<tr>
<td>TERMS AND CONDITIONS</td>
<td class="pl++">ADVERTISE</td>
</tr>
<tr>
<td>PRIVACY POLICY</td>
</tr>
</table>
</div>
<!-- Sign up Starts -->
<div class="col-lg-4 col-md-4">
</div>
<!--Sign Up Ends -->
<div class="col-lg-4 col-md-4">
<figure class="p pb0 footer-image">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTPZA23BVynjg91p0lXTn2yEiCft5VkK70063kgELaL_77gtH_TWg">
</figure>
<a href="#" class="subscribe-button" >
<button type="button" >
SUBSCRIBE <span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span>
</button>
</a>
</div>
</div>
</div>
</div>
</div>
<!-- Second Row / Footer List Ends -->
</div>
</div>
</div>
#media(min-width: #screen-sm-min) {
.follow-us{
color:#mainpink;
.font-family(#font-Oswald-Bold) ;
font-size: 12px;
}
.footer-border{
border: 1px solid #mainpink;
}
.footer-table{
color:#white !important;
text-align: left;
tr{
td{
padding-bottom:10px;
a{
.font-family(#font-SourceSansPro-Regular) !important;
color:#white !important;
text-transform: uppercase;
font-size:14px;
}
}
}
}
.footer-image{
position: absolute;
bottom: 0px;
display: block;
width: 100%;
text-align: center;
}
}
I have changed the codes as below then it works :
.footer-image
{
margin-top: -100px;
bottom: 0px;
display: block;
width: 100%;
text-align: center;
padding-bottom:0px;
}