Resizing images in Bootstrap - html

Been reading about general answers for this for a while. As often as I have tried to play with it, I just cannot get the CSS to work and fit on my timeline.
I am using this theme. I have been trying to replace the about section timeline with pictures of my own but the pictures I have used are all different sizes. I just can't seem to get even one of my images to fit the fun little circle that the originals were in and trust me it has been a long time. Any help is REALLY appreciated. I'll put the code I have below but I know some of it repeats itself because like I said, I have been trying to fix these images for a while. I've tried to make different CSS rules for each individual image but I have failed on that part as well. Seriously any help is appreciated.
<section id="about">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading">About</h2>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<ul class="timeline">
<li>
<div class="timeline-image">
<img class="img-circle img-responsive1" src="img/about/1.jpg" alt="">
</div>
<div class="timeline-panel">
<div class="timeline-heading">
<h4 class="subheading">Build or Scale your HR Capability</h4>
</div>
<div class="timeline-body">
<p class="text-muted">Properly staffed and positioned Human Resources leaders and teams are strategic enablers of business performance and growth. We help you assess your current HR capabilities and build value adding talent management solutions that will help you move beyond compliance driven personnel management to business integrated Human Resources leadership.</p>
</div>
</div>
</li>
<li class="timeline-inverted">
<div class="timeline-image">
<img class="img-circle img-responsive1" src="img/about/2.jpg" alt="">
</div>
<div class="timeline-panel">
<div class="timeline-heading">
<h4 class="subheading">Develop your Leaders</h4>
</div>
<div class="timeline-body">
<p class="text-muted">Effective leadership is critical to attracting, engaging, and retaining the people you need to delight your customers and achieve your goals. We help you leverage the strengths of your managers and create insights and actions to develop their weaknesses through individualized feedback and coaching.</p>
</div>
</div>
</li>
<li>
<div class="timeline-image">
<img class="img-circle img-responsive1" src="img/about/3.jpg" alt="">
</div>
<div class="timeline-panel">
<div class="timeline-heading">
<h4 class="subheading">Focus and Engage your Team</h4>
</div>
<div class="timeline-body">
<p class="text-muted">The most successful businesses have team members that understand the company's goals and are committed to achieving them. We help you create clarity of purpose and establish goal setting and performance management tools and processes that go beyond score keeping to create a culture of engagement. </p>
</div>
</div>
</li>
<li class="timeline-inverted">
<div class="timeline-image">
<h4>Be Part
<br>Of Our
<br>Story!</h4>
</div>
</li>
</ul>
</div>
</div>
</div>
</section>
and the css for the images
element {
}
.img-circle {
border-radius: 50%;
}
.img-responsive {
display: block;
max-width: 50%;
height: auto;
}
img {
vertical-align: middle;
}
img {
border: 0;
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
Important to note, I think checking the link earlier would really help me. There are a series of CSS rules that also are extended onto the image as you can see from the HTML like timeline-image which I can also put here but I figured my question was long enough.
Thanks for any and all help.

First, make sure you are using the correct classname, img-responsive, currently in your html code, you are using img-responsive1 for your img elements.
after that, in your css change the max-width of img-responsive class to 100%
.img-responsive {
max-width: 100%;
height: auto;
}
to make sure that the image will fit to its container.

You can use this for you are image (whitout use bootstrap) :
img {
display: block;
max-width: 100%;
height: auto;
}
You can use it for one image like this :
#image_id {
display: block;
max-width: 100%;
height: auto;
}
note : we don't need bootstrap to do this.but if you want to tey with bootstrap you can do like this :
<div class="row">
<div class="col-md-4">
<img class="thumbnail img-responsive" src="h.jpg" />
</div>
</div>

Related

Only one horizontal line's got applied with CSS, the last one doesn't show up

I have the one issue with hr tags. There're two hrs in my html below which is decorated using CSS border. When I run the code the first one shows up as I intended nut the second one doesn't, even though they share the same CSS. How should I do???
Here's my code:
hr {
border: none;
border-top: 5px dotted #EAF6F6;
width: 5%;
margin-top: 50px;
margin-bottom: 50px;
}
<div class="middle-container">
<div class="profile">
<img src="resources/profile.png" alt="peofile-picture">
<h2>Hello.</h2>
<p>Learning web development skills. Just a drunk girl who's longing for Britain.</p>
</div>
<hr>
<div class="skills">
<h2>My Skills.</h2>
<div class="skill-row">
<img src="resources/coding.png" class="code-img" alt="coding">
<h3>WEB designing</h3>
<p>Please remember, I AM really a NEWBIE when it comes to designing the website.</p>
</div>
<div class="skill-row">
<img src="resources/beer.png" class="beer-img" alt="beer">
<h3>Drinking. Yes, JUST a drinking.</h3>
<p class="drink">Having good meal is pleasure. When it comes with good drink, that's far more better.</p>
</div>
</div>
<hr>
<div class="contact-me">
<h2>Get In Touch</h2>
<h3>But if you're interested in me...</h3>
<p>Please feel free to contact, there might be any help I can provide.</p>
<a class="btn" href="mailto:fictional#gmail.com">CONTACT ME</a>
</div>
</div>
I think you forgot an hr in your HTML, just check the picture below to understand :

<div> element does not adhere to the Display: inline property

I am new to web development and I am facing an issue. I want to display three div's next to each other. So, I applied display:inline-block to the three div's. But, still the Div's are stacked one below another and not next to each other.
Codepen link: https://codepen.io/shanjaynithin/pen/XWmBPYd
Desired output:
Sample image
You can use flex for this:
.container {
display: flex;
width: 100%;
justify-content: space-between;
}
.boxes {
margin: 10px;
border: 1px solid red;
}
img{
height:100px;
width:100px;
}
<div class="container">
<div class="boxes">
<img src="http://placekitten.com/301/301" alt="snappy-process">
<h3>Snappy Process</h3>
<p>Our application process can be completed in minutes, not hours. Don’t get
stuck filling in tedious forms.</p>
</div>
<div class="boxes">
<img class="eg" src="http://placekitten.com/301/301" alt="affordable-prices">
<h3 >Affordable Prices</h3>
<p>We don’t want you worrying about high monthly costs. Our prices may be low,
but we still offer the best coverage possible.</p>
</div>
<div class="boxes">
<img src="http://placekitten.com/301/301" alt="people-first">
<h3>People First</h3>
<p>Our plans aren’t full of conditions and clauses to prevent payouts. We make
sure you’re covered when you need it.</p>
</div>
</div>
.container {
display: flex;
width: 100vw;
}
<div class="container">
<div class="boxes">
<img src="images/icon-snappy-process.svg" alt="snappy-process">
<h3>Snappy Process</h3>
<p>Our application process can be completed in minutes, not hours. Don’t get
stuck filling in tedious forms.</p>
</div>
<div class="boxes">
<img class="eg" src="images/icon-affordable-prices.svg" alt="affordable-prices">
<h3>Affordable Prices</h3>
<p>We don’t want you worrying about high monthly costs. Our prices may be low,
but we still offer the best coverage possible.</p>
</div>
<div class="boxes">
<img src="images/icon-people-first.svg" alt="people-first">
<h3>People First</h3>
<p>Our plans aren’t full of conditions and clauses to prevent payouts. We make
sure you’re covered when you need it.</p>
</div>
</div>
<div id="app">
<div>One</div>
<div>Two</div>
<div>Three</div>
</div>
#app div{
float: left;
width: 200px;
height: 200px;
border: 1px solid;
}

text does not vertically align with image

Good day, as the title says, I am having issues with aligning the text in the exact center of my image. I tried adding a class with the css vertical-align:middle with no effect. Also, I tried using the span class to surround the text that will be centered. Both the image and the text are encased in a bootstrap grid. Any help will be appreciated thank you.
HTML/Bootstrap:
<div class="container-fluid">
<div class="row">
<div class="col-md-3">
<img src="img/mission-mywhitecard.jpg" class="img-responsive align_text">
</div>
<div class="col-md-9 justify_text">
<span>
<h2 class="med_bg">OUR MISSION</h2>
<p class="mv_font">“To provide a mutually-beneficial platform for partners through high-quality, lower cost and friendly access to health, wellness and beauty.”</p>
</span>
</div>
</div>
</div>
CSS:
.align_text {
vertical-align: middle;
}
Considering you are using bootstrap4, you can achieve that using the class .align-items-center, or use display:flex as stated by others :)
img {
background: gray;
height: 250px;
display: block;
max-width: 100%;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<div class="container-fluid">
<div class="row align-items-center">
<div class="col-3">
<img src="img/mission-mywhitecard.jpg" class="img-responsive align_text">
</div>
<div class="col-9 justify_text">
<h2 class="med_bg">OUR MISSION</h2>
<p class="mv_font">“To provide a mutually-beneficial platform for partners through high-quality, lower cost and
friendly access to health, wellness and beauty.”</p>
</div>
</div>
</div>
I believe this produces what you ask for. It is using 2 flexboxes:
First one (.row) to put the image and text next to each other in a responsive way;
Second one (.col-md-9) to position the span in the center
html,
body {
width: 100%;
}
.row {
display: flex;
width: 100%;
}
.row>* {
flex: 1; /* Allow the flex items to grow and shrink */
}
.col-md-9 {
display: flex;
justify-content: center;
align-items: center;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<div class="col-md-3">
<img src="https://via.placeholder.com/100x300" class="img-responsive align_text">
</div>
<div class="col-md-9">
<span>
<h2 class="med_bg">OUR MISSION</h2>
<p class="mv_font">“To provide a mutually-beneficial platform for partners through high-quality, lower cost and friendly access to health, wellness and beauty.”</p>
</span>
</div>
</div>
</div>
You can aslo use align-self-center in column div class without any height of image and other css also add larger image no design change when you use align-self-center in column div no need set image height
.align_text {
vertical-align: middle;
}
img {
max-width: 100%;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<div class="container-fluid">
<div class="row">
<div class="col-md-3">
<img src="http://placekitten.com/1000/500" class="img-responsive align_text">
</div>
<div class="col-md-9 justify_text align-self-center">
<span>
<h2 class="med_bg">OUR MISSION</h2>
<p class="mv_font">“To provide a mutually-beneficial platform for partners through high-quality, lower cost and friendly access to health, wellness and beauty.”</p>
</span>
</div>
</div>
</div>

To set the background image in wrapper class

I write these code and made 2 grid using bootstrap.Now i want to the backgound image in the wrapper class.I tried it but i din't get success. Any idea about this?
.wrapper {
background-image: url(http://www.steamatic.com/images/footer-pattern-grey.jpg);
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
}
<div class="wrapper">
<div class="col-md-6">
<div class=" flex">
<div class="media-left"> <i class="fa fa-home fa-3x"></i></div>
<div class="media-body">
<h4>Resenditial Services</h4>
</div>
</div>
<p class="para">Steamatic knows that the health and safety of your family is your first concern. Our restoration and cleaning services are all about providing you with the healthiest indoor environment possible.</p>
</div>
<div class="col-md-6">
<div class=" flex">
<div class="media-left"> <i class="fa fa-building fa-3x"></i></div>
<div class="media-body">
<h4>Commercial Services</h4>
</div>
</div>
<p class="para">We've been providing commercial clients money-saving and asset-protecting services for nearly five decades. Steamatic's full range of restoration and cleaning services means we have your business covered.</p>
</div>
</div>
I get the image in my background but i want to get full width image what i do?
U can show the image i upload
If you read the documentation of bootstrap, the cols are always wrapped in a row , if you want to wrap it in your own .wrapper class, then add
.wrapper{
overflow: hidden;
}
or you can try float: left; to .wrapper , its your choice
Add overflow: auto; to your .wrapper element.
You have to add overflow: hidden to your .wrapper class parent element of the two floating elements inside of it. So that if you add background image on your .wrapper it will show. Because, bootstrap grid classes are using float.

How do I center 2 divs in HTML Bootstrap?

As the title says, how do I center two divs next to each other perfectly?
My HTML: (or well, a bit of it)
<section class="team" id="team">
<div class="container">
<h3>The team behind CatCraft</h3>
<div class="divider">
<div class="hr">
<div class="hr-dot"></div>
</div>
</div>
<div class="row row-centered">
<div class="team-centered col-md-4">
<img src="http://cravatar.eu/helmhead/6a940db5e02d4bf79db9203a8b126f0d/140.png" alt="catx">
<h4 class="bold">CatX (Owner)</h4>
<p>Hi! I'm CatX and I'm the owner of CatCraft. I like anime and tech stuff. My favourite server is bending. =^_^=</p>
</div>
<div class="team-centered col-md-4">
<img src="http://cravatar.eu/helmhead/ef4fbdb6d629480d8f98ed9919c111e9/140.png" alt="__ast__">
<h4 class="bold">__Ast__ (Co-Owner)</h4>
<p>Example text, pls write something ;-;</p>
</div>
</div>
</div>
</section>
My CSS: (same here, this isn't all)
I tried to make a box for the css above too but it didn't work. http://pastebin.com/SzhAmh3f
Basically the problem I'm having is that the code above works kind of but one of the blocks are a little bit lower than the other and i have no idea why.
Yes, I know that there are other posts about this subject but no one worked for me so I decided to open my own.
There are a lot of unwanted styles actually to achieve this, you simply need the below code on your team-centered class. Remove row-centered class. It should look like this
CSS
.team img {
width: 140px;
height: 140px;
border-radius: 50%;
margin: 10px auto 40px;
}
.team-centered {
width: 50%;
float:left;
text-align: center;
}
HTML
<section class="team" id="team">
<div class="container">
<h3>The team behind CatCraft</h3>
<div class="divider">
<div class="hr">
<div class="hr-dot"></div>
</div>
</div>
<div class="row">
<div class="team-centered">
<img src="http://cravatar.eu/helmhead/6a940db5e02d4bf79db9203a8b126f0d/140.png" alt="catx">
<h4 class="bold">CatX (Owner)</h4>
<p>Hi! I'm CatX and I'm the owner of CatCraft. I like anime and tech stuff. My favourite server is bending. =^_^=</p>
</div>
<div class="team-centered">
<img src="http://cravatar.eu/helmhead/ef4fbdb6d629480d8f98ed9919c111e9/140.png" alt="__ast__">
<h4 class="bold">__Ast__ (Co-Owner)</h4>
<p>Example text, pls write something ;-;</p>
</div>
</div>
</div>
</section>