I know there is an existing question none of the solutions seem to work for me and it's a question posted in 2014.
Here's the code I have:
<section id="team-block">
<div class="team-block-centered">
<div class="col-lg-3 col-sm-6 member-1">
<div class="team-member">
<img
src="http://lvsmiledesigners.com/new/wp-content/uploads/2019/06/dr-tongsiri.jpg"
data-original="http://lvsmiledesigners.com/new/wp-content/uploads/2019/06/dr-tongsiri.jpg"
alt=""
class="lazy"
style="display: block;"
/>
<div class="inner">
<h4 class="name">Dr. Amy Tongsiri</h4>
<p class="position">
<small>Clinical Director</small>
</p>
</div>
<div class="hover">
<div class="description">
<p>
Dr. Amy Tongsiri has joined Smile Designers of Las Vegas in 2017.
She has a joyous energy vibrating the room as she enters. Almost
permanently smiling, she exudes positivity and can easily relaxed
and soothe a nervous patient. The desire to pursue a career in
dentistry came young for Dr. Tongsiri, during the course of her
own dental health. "I originally wanted to do orthodontics, when I
had braces,” she says, flashing the resulting perfect smile. “But
eventually, I found General Dentistry to be more exciting because
you are challenged by being able to cover everything."
</p>
</div>
<div class="read-more">
<a href="/new/dr-amy-tongsiri/" class="button white outline"
>Read more <span class="nc-icon-glyph arrows-1_bold-right"></span
></a>
</div>
</div>
<!--.hover-->
</div>
<!--.team-member-->
</div>
<!--.col-lg-3-->
</div>
<div class="col-lg-3 col-sm-6 member-2">
<div class="team-member">
<img
src="http://lvsmiledesigners.com/new/wp-content/uploads/2019/07/Dr-Dominique-Dela-Cruz.jpg"
data-original="http://lvsmiledesigners.com/new/wp-content/uploads/2019/07/Dr-Dominique-Dela-Cruz.jpg"
alt=""
class="lazy"
style="display: block;"
/>
<div class="inner">
<h4 class="name">Dr. Dominique Dela Cruz</h4>
<p class="position">
<small>Lead Dentist</small>
</p>
</div>
<div class="hover">
<div class="description">
<p>
Providing comprehensive dental care that is tailored to each and
every patient’s needs is Dr. Dominique Dela Cruz’s goal when it
comes to treating patients. She strives to provide dental care in a
comfortable environment while using the most innovative and advanced
technology. Dr. Dela Cruz grew up in Las Vegas, NV. On her spare
time, she likes to stay outdoors as much as possible. She loves to
hike, travel, kayak and snowboard. She also likes to read books and
watch movies with her dogs. Like most of her patients, Dr. Dela Cruz
has a sweet tooth and enjoys eating candy, chocolate and other
pastries.
</p>
</div>
<div class="read-more">
<a href="/new/dr-jorge-jimenez-marquez/" class="button white outline"
>Read more <span class="nc-icon-glyph arrows-1_bold-right"></span
></a>
</div>
</div>
<!--.hover-->
</div>
<!--.team-member-->
</div>
<!--.col-lg-3-->
<div class="col-lg-3 col-sm-6 member-3">
<div class="team-member">
<img
src="http://lvsmiledesigners.com/new/wp-content/uploads/2019/06/karla.jpg"
data-original="http://lvsmiledesigners.com/new/wp-content/uploads/2019/06/karla.jpg"
alt=""
class="lazy"
style="display: block;"
/>
<div class="inner">
<h4 class="name">Karla Brown</h4>
<p class="position">
<small>Office Manager</small>
</p>
</div>
<div class="hover">
<div class="description">
<p>
Delivering outstanding customer service has always been an essential
part of a day’s work for Karla. As Smile Designers of Las Vegas
Office Manager, she is responsible for all office procedures, and
uses her organizational skills to ensure smooth operations in a busy
work environment.
</p>
</div>
<div class="read-more">
<a href="/new/nancy-gutierrez/" class="button white outline"
>Read more <span class="nc-icon-glyph arrows-1_bold-right"></span
></a>
</div>
</div>
<!--.hover-->
</div>
<!--.team-member-->
</div>
<!--.col-lg-3-->
<div class="col-lg-3 col-sm-6 member-4">
<div class="team-member">
<img
src="http://lvsmiledesigners.com/new/wp-content/uploads/2019/06/nancy.jpg"
data-original="http://lvsmiledesigners.com/new/wp-content/uploads/2019/06/nancy.jpg"
alt=""
class="lazy"
style="display: block;"
/>
<div class="inner">
<h4 class="name">Nancy Gutierrez</h4>
<p class="position">
<small>Lead Back Office Assistant</small>
</p>
</div>
<div class="hover">
<div class="description">
<p>
As Smile Designers of Las Vegas lead dental assistant she says her
coworkers and easy-going patients make it a pleasure to go to work
every day. She loves been a part in patients journeys to a better
and healthier oral health.
</p>
</div>
<div class="read-more">
<a href="/new/karla-brown/" class="button white outline"
>Read more <span class="nc-icon-glyph arrows-1_bold-right"></span
></a>
</div>
</div>
<!--.hover-->
</div>
<!--.team-member-->
</div>
<!--.col-lg-3-->
</section>
Here's the live site: http://lvsmiledesigners.com/new/
The section is under the "Our team can help you!" header. The concern I have is Dr. Amy's div. I'm not sure why Dr. Amy's image is narrower in width than the other images.
[Update]: You should wrap all the doctors column with .team-block-centered to positioning them center. In your demo live site - you only wrap Dr. Amy div.
See your code, all the element with col-lg-3 class aren't siblings, instead Dr. Amy div element nested in .team-block-centered element. And thats the main reason. If you remove parent wrapper with class .team-block-centered, everything will be fine.
[Previous]:
.team-block-centered parent wrapper class has width 900px. And col-lg-3 class take the width of 20%(234px in this case).
The problem is you have 4 column width of 20% * 4 = 80%(234 * 4 = 936px), which is greater than parent wrapper width.
Give .team-block-centered class width: 100% , and then center it.
In other words image is very short in width = 173px original, it should more than 204px.
Related
how do I align all buttons at the bottom of the card? The body of the card is already on display:flex and flex-direction: column, while the card buttons' margin-top are already set at 'auto' however the it's still not being positioned at the bottom?
I attached below the code structure for my cards including the styling for the card content and the buttons.
[![enter image description here](https://i.stack.imgur.com/eJLHT.png)](https://i.stack.imgur.com/eJLHT.png)
<section class="container">
<div class="card">
<div class="card-img card-1"></div>
<div class="card-content">
<h2 class="card-header">Bayanihan E-Konsulta</h2>
<p class="card-text">The Bayanihan e-Konsulta – a teleconsultation program aimed at assisting both COVID-19 and non-COVID-19 patients which was initially launched to fill the gaps in the government’s pandemic response.</p>
<button class="card-btn">Read more<span>→</span></button>
</div>
</div>
<div class="card">
<div class="card-img card-2"></div>
<div class="card-content">
<h2 class="card-header">Swab Cab</h2>
<p class="card-text">A mobile testing program which will do mass surveillance testing in communities where transmission is very high.</p>
<button class="card-btn card-btn-2">Read more<span>→</span></button>
</div>
</div>
<div class="card">
<div class="card-img card-3"></div>
<div class="card-content">
<h2 class="card-header">Free PPEs for HCWs</h2>
<p class="card-text">Vice President Leni Robredo’s office continues its livelihood assistance projects as it turned over materials to a group of Bulacan sewers, who were tapped to make personal protective equipment (PPEs) who were tapped to make personal protective equipment (PPEs). </p>
<button class="card-btn">Read more<span>→</span></button>
</div>
</div>
BACK TO TOP
</section>
`
The body of the card is already on display:flex and flex-direction: column, while the card buttons' margin-top are already set at 'auto'. I can fix this by manually adjusting the button's margin but I think it's possible to adjust all buttons simultaneously.
I prepared a example in codepen:
https://codepen.io/isaksonn/pen/eYKzarW
section.container .card{display:flex;flex-direction:column;justify-content:space-between;height:600px;width:200px;border:1px solid gray;padding:10px}section.container .card .card-img{display:block;background-color:gray;width:100%;height:200px}section.container .card .card-content{height:100%;display:flex;flex-direction:column;justify-content:space-between}
<section class="container">
<div class="card">
<div class="card-img card-1"></div>
<div class="card-content">
<!--If you want align the title and text on the top and only the buttons down you have to wrap the firsts in a div, otherwise the text is centered vertically (as second card)-->
<div class="divAdded">
<h2 class="card-header">Bayanihan E-Konsulta</h2>
<p class="card-text">The Bayanihan e-Konsulta – a teleconsultation program aimed at assisting both COVID-19 and non-COVID-19 patients which was initially launched to fill the gaps in the government’s pandemic response.</p>
</div>
<button class="card-btn">Read more<span>→</span></button>
</div>
</div>
<div class="card">
<div class="card-img card-2"></div>
<div class="card-content">
<h2 class="card-header">Swab Cab</h2>
<p class="card-text">A mobile testing program which will do mass surveillance testing in communities where transmission is very high.</p>
<button class="card-btn card-btn-2">Read more<span>→</span></button>
</div>
</div>
BACK TO TOP
</section>
section.container .card{height:600px;width:200px;border:1px solid gray;padding:10px}
section.container .card .card-img{display:block;background-color:gray;width:100%;height:200px}
.btn{
text-align: center;
margin: 10px 0;
}
<section class="container">
<div class="card">
<div class="card-img card-1"></div>
<div class="card-content">
<!--If you want align the title and text on the top and only the buttons down you have to wrap the firsts in a div, otherwise the text is centered vertically (as second card)-->
<div class="divAdded">
<h2 class="card-header">Bayanihan E-Konsulta</h2>
<p class="card-text">The Bayanihan e-Konsulta – a teleconsultation program aimed at assisting both COVID-19 and non-COVID-19 patients which was initially launched to fill the gaps in the government’s pandemic response.</p>
</div>
<p class="btn"><button class="card-btn">Read more<span>→</span></button></p>
</div>
</div>
<div class="card">
<div class="card-img card-2"></div>
<div class="card-content">
<h2 class="card-header">Swab Cab</h2>
<p class="card-text">A mobile testing program which will do mass surveillance testing in communities where transmission is very high.</p>
<p class="btn"><button class="card-btn card-btn-2">Read more<span>→</span></button></p>
</div>
</div>
BACK TO TOP
</section>
You can try this..
add button element in 'p' and you can add class in 'p' element and than go to css file and style
I just started learning HTML and CSS, and am having trouble figuring our how to include a horizontal space to separate both rows, and fix the misalignment/sizing problem. Both rows are currently attached together, and when I remove <div class="row" style="padding-top: 50px">, the misalignment is fixed but the rows are still together.
Can any one help me out?
HTML:
<div id="featuredcities">
<div class="col-sm-3">
<img id="image" src="images/singapore.jpg" alt="singapore">
<p id="text">Singapore</p>
<p id="summarytext">Amazing culinary experience and <br>efficient business ecosystem in this <br>tiny cosmopolitan country.</p>
</div>
<div class="col-sm-3">
<img id="image" src="images/bangkok.jpg" alt="bangkok">
<p id="text">Bangkok</p>
<p id="summarytext">A bustling neon-lit city that combines tradition and modernity.</p>
</div>
<div class="col-sm-3">
<img id="image" src="images/shanghai.jpg" alt="shanghai">
<p id="text">Shanghai</p>
<p id="summarytext">Blend of East meets West <br>in this high energy metropolis.</p>
</div>
<div class="col-sm-3">
<img id="image" src="images/hcmc.jpg" alt="ho chi minh city">
<p id="text">HCMC</p>
<p id="summarytext">The "Paris of Asia", Ho Chi Minh City is <br>as much historical as it is modern.</p>
</div>
</div><!--End of 1st div row-->
<!--2nd div row-->
<div class="row" style="padding-top: 50px">
<div class="col-sm-3">
<img id="image" src="images/seoul.jpg" alt="seoul">
<p id="text">Seoul</p>
<p id="summarytext">Famous for pop culture, <br>vibrant shopping and <br>historical palaces.</p>
</div>
<div class="col-sm-3">
<img id="image" src="images/bangkok.jpg" alt="bangkok">
<p id="text">Bangkok</p>
<p id="summarytext">A bustling neon-lit city that combines tradition and modernity.</p>
</div>
<div class="col-sm-3">
<img id="image" src="images/shanghai.jpg" alt="shanghai">
<p id="text">Shanghai</p>
<p id="summarytext">Blend of East meets West <br>in this high energy metropolis.</p>
</div>
<div class="col-sm-3">
<img id="image" src="images/hcmc.jpg" alt="ho chi minh city">
<p id="text">HCMC</p>
<p id="summarytext">The "Paris of Asia", Ho Chi Minh City is <br>as much historical as it is modern.</p>
</div>
</div><!--End of 1st div row-->
</div><!--End of Community-->
</section>
CSS:
#images .col-md-3 {
height: 570px;
overflow: hidden;
}
You have this HTML for your first div
<div id="featuredcities">
Add the class row to it.
<div class="row" id="featuredcities">
<div class="row" id="featuredcities">
<div class="col-sm-3">
<img id="image" src="images/singapore.jpg" alt="singapore">
<p id="text">Singapore</p>
<p id="summarytext">Amazing culinary experience and <br>efficient business ecosystem in this <br>tiny cosmopolitan country.</p>
</div>
<div class="col-sm-3">
<img id="image" src="images/bangkok.jpg" alt="bangkok">
<p id="text">Bangkok</p>
<p id="summarytext">A bustling neon-lit city that combines tradition and modernity.</p>
</div>
<div class="col-sm-3">
<img id="image" src="images/shanghai.jpg" alt="shanghai">
<p id="text">Shanghai</p>
<p id="summarytext">Blend of East meets West <br>in this high energy metropolis.</p>
</div>
<div class="col-sm-3">
<img id="image" src="images/hcmc.jpg" alt="ho chi minh city">
<p id="text">HCMC</p>
<p id="summarytext">The "Paris of Asia", Ho Chi Minh City is <br>as much historical as it is modern.</p>
</div>
</div>
<!--End of 1st div row-->
<!--2nd div row-->
<div class="row" style="padding-top: 50px"> <!-- padding top is all you need -->
<div class="col-sm-3">
<img id="image" src="images/seoul.jpg" alt="seoul">
<p id="text">Seoul</p>
<p id="summarytext">Famous for pop culture, <br>vibrant shopping and <br>historical palaces.</p>
</div>
<div class="col-sm-3">
<img id="image" src="images/bangkok.jpg" alt="bangkok">
<p id="text">Bangkok</p>
<p id="summarytext">A bustling neon-lit city that combines tradition and modernity.</p>
</div>
<div class="col-sm-3">
<img id="image" src="images/shanghai.jpg" alt="shanghai">
<p id="text">Shanghai</p>
<p id="summarytext">Blend of East meets West <br>in this high energy metropolis.</p>
</div>
<div class="col-sm-3">
<img id="image" src="images/hcmc.jpg" alt="ho chi minh city">
<p id="text">HCMC</p>
<p id="summarytext">The "Paris of Asia", Ho Chi Minh City is <br>as much historical as it is modern.</p>
</div>
</div>
<!--End of 2st div row-->
always try to keep your code cleaner.. I recommend you you study really good bootstrap grid system Bootstrap-grid
edit:
Your images ID is "image" , and in your css you're calling "#images" ... ?
You could either change it from padding-top to margin-top, or you could also add in a tag in between the two divs.
Ok so I have the following HTML
<div class="container">
<div class="row col-sm-12" id="productBrief">
<div id="RaspberryAndChocolate" style="display:none; height:200px;">
<div class="col-sm-6 text-center">
<img src="~/Content/Images/YogurtImages_404x290/Rasberry_White_Chocolate_Yogurt.png" class="img-responsive" style="margin: 0 auto; padding-top: 5%" alt="Rasberry White Chocolate Yogurt" />
</div>
<div class="col-sm-6">
<h2 class="raspberryRed productLineHeight">FLAVOUR #3</h2>
<h1 class="raspberryRed">
RASPBERRY &<br /> WHITE CHOCOLATE
</h1>
<p class="productPara">
A decadent combination of whole raspberries and smooth white chocolate that you will want to make last as long as possible. Teaspoon recommended.
</p>
<p>
<span class="label label-danone label-as-badge" style="font-size: 0.9em; padding:3%">VIEW ALL FLAVOURS</span>
</p>
</div>
</div>
<div class="clearfix"></div>
<div id="BlueBerry" style="display:none; height:200px;">
<div class="col-sm-6 text-center">
<img src="~/Content/Images/YogurtImages_404x290/Blueberry_Yogurt.png" class="img-responsive" style="margin: 0 auto; padding-top: 5%" alt="Blueberry Yogurt" />
</div>
<div class="col-sm-6">
<h2 class="blueBerry productLineHeight">FLAVOUR #6</h2>
<h1 class="blueBerry">
BLUEBERRY
</h1>
<p class="productPara">
Just imagine plump and juicy blueberries immersed in a deliciously creamy yoghurt. Enough said.
</p>
<p>
<span class="label label-as-badge" style="font-size: 0.9em; padding:3%">VIEW ALL FLAVOURS</span>
</p>
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-lg-12 text-center">
<div class="col-lg-2"></div>
<p style="width:70%;" class="text-center col-lg-8">
Experiencing Ultimate's uniquely luscious texture for the first time is beyond words. So don't even try. Take a moment to enjoy the ultra creaminess, the juicy ripened fruits and an array of wicked indulgences that come together to create a yoghurt like no other.
</p>
<div class="col-lg-2"></div>
</div>
</div>
Now there are roughly about 8 different divs but for simplicity I am only showing 2, but only one div is shown look at it as a random affect so the user refreshes the page a different div is shown (this is done in jquery) but if you look at the bottom of the HTML you will see another row with a P tag this is what is causing he issue, when displayed on a desktop it shows like this
when I minimize the browser the text at the bottom of the image displays under the text located to the right hand side of the yogurt box as shown here.
I have added the clearfix, tried adding a new container and yet the problem still remains....
You are using invalid bootstrap grid. Col should be a child of row. Use correct grid and everything will work perfectly.
Scott, hunzaboy says you need to use the dive like this
<div class="row">
<div class="col-sm-12"></div>
</div>
I don't fully understand your question, but hope you asking this,
when re-sizing your first image, I will suitably re-size without any harm to other divs. For that You need to devide that into 3 main divs, check the below code
<div class="row">
<div class="col-md-6">This is the image holding div</div><div class="col-md-6"> this is the right side text "Flavour #6, etc..."</div>
<div class="col-md-12">This is the text on the bottom</div>
</div>
I will look, 2 columns on the top and one column in the bottom.
For mobile view, you can use col-xs-12class, the it will show as stack.
Hope this is you asking. Thanks
I am trying to make the main page for a website.
I want three images with text underneath but the images are not centered above the text. Here is the jsFiddle.
JsFiddle
<div class="row" style="text-align:center">
<div class="col-md-4 col-xs-8">
<img src="http://s27.postimg.org/5emjkk14v/image.jpg" class="img-responsive" style="height:180px;width:180px;" />
<h4> Vaccinations</h4>
<p>Dogs and cats are susceptible to a variety of illnesses that can be completely prevented by following the appropriate vaccination schedule.</p>
</div>
<div class="col-md-4 col-xs-8">
<img src="http://s27.postimg.org/5emjkk14v/image.jpg" class="img-responsive" style="height:180px;width:180px;" />
<h4>Checkups</h4>
<p>Regular checkups are a key factor in pet wellness, and can often unearth problems that could lead to health issues down the road. </p>
</div>
<div class="col-md-4 col-xs-8">
<img src="http://s27.postimg.org/5emjkk14v/image.jpg" class="img-responsive" style="height:180px;width:180px;" />
<h4> Senior Pets</h4>
<p>Senior pets generally require more medical attention than their younger counterparts, just as senior humans do. So when is a pet considered “senior”? </p>
</div>
</div>
You need to set the left and right margins of the images to auto
.col-md-4.col-xs-8 img {
margin: 0 auto;
}
Updated JSFIDDLE
.img-responsive{display:inline-block}
My main body div won't resize to fit my text.
My setup is a main body container div. In that div there is the header div, the body div and the footer div. In the body div there are 3 divs called body-left, body-middle and body-right. These are all side by side using the css style float:left
I have tried setting the height of the bodycontainer, the min-height of bodycontainer, and the same for the divs in bodycontainer.
here is a screenshot of whats happening: http://i.imgur.com/6dYRf.jpg
Here is my html:
<div id="maincontainer">
<div id="headercontainer">
<div id="header-logo"></div>
<div id="header-navbar">
<div id="navbar" align="center">
<div>Home</div>
<div>Roster</div>
<div>FAQ</div>
<div>Donate</div>
<div>About</div>
<div>Contact</div>
</div>
</div>
</div>
<div id="bodycontainer">
<div id="body-left">
<ul>
<div>
<a href="http://www.facebook.com/darkonyxftw" title="Click to go to our Facebook page." target="_blank">
<div class="social-odd">
<h3 class="social">Facebook</h3>
<p class="social">All tweets and youtube uploads, as well as updates and notifications go on our facebook. Like our page to get the notifications on your wall.
</p>
<p class="social">facebook.com/DarkOnyxFTW</p>
</div>
</a>
<a href="http://www.youtube.com/subscription_center?add_user=darkonyxftw" title="Click to subscribe to our Youtube channel." target="_blank">
<div class="social-even">
<h3 class="social">Youtube</h3>
<p class="social">Entire practice sessions, special event videos, VODS and casts get uploaded to our youtube channel. click here to subscribe.
</p>
<p class="social">youtube.com/DarkOnyxFTW</p>
</div>
</a>
<a href="http://www.twitter.com/DarkOnyxFTW" title="Click to go to our twitter page." target="_blank">
<div class="social-odd">
<h3 class="social">Twitter</h3>
<p class="social">Everytime we upload a youtube video or our stream goes online on twitch.tv/DarkOnyxFTW, you will know about it if you follow our twitter account.
</p>
<p class="social">twitter.com/DarkOnyxFTW</p>
</div>
</a>
<a href="http://www.twitch.tv/DarkOnyxFTW" title="Click to go to our twitch.tv channel." target="_blank">
<div class="social-even">
<h3 class="social">Live Stream<br># Twitch.tv</h3>
<p class="social">We live stream our practices every Monday, Wednesday and Thursday at 7PM PST (9PM Central). Follow our twitch channel to get an email notification when we go live. We will also be streaming clan battles and other special events, so keep an eye on your inbox for that.
</p>
<p class="social">twitch.tv/DarkOnyxFTW</p>
</div>
</a>
<a href="http://www.teamliquid.net/blog/DarkOnyx" title="Our TeamLiquid Blog" target="_blank">
<div class="social-odd">
<h3 class="social">Team Liquid Blog</h3>
<p class="social">Click here for player interviews, clan war information and much more.
</p>
<p class="social">teamliquid.net/blog/DarkOnyx</p>
</div>
</a>
</div>
</ul>
</div>
<div id="body-middle">
</div>
<div id="body-right">
</div>
</div>
<div id="footercontainer">
<div style="width:590px; padding-left:10px; padding-top:10px;">Site by Alex "Xzar" Mohr</div>
<div id="footer-nav" style="" align="right">
<ul>
<li>About</li> |
<li>Contact</li>
</ul>
</div>
</div>
here is my css: http://darkonyx.webatu.com/style2.css
#bodycontainer{
width:100%;
height:1000px;
background: rgba(0,0,0,0.9);
}
This limits the height to 1000px, which is less than the length of the text.