How can I horizontally align these divs? - html

I have 7 divs in a row on and I can't get the arrows in the middle to be horizontally in the centre of the outer div.
I've tried
top: 50%;
text-align: centre:
margin: 0 auto;
But none of them seem to work. How can I correct this?
HTML:
<div id="instruct">
<div align="center" class="category">
<img src="http://www.devo.co.uk/wp-content/uploads/2016/07/1-DEVO.png" width="150" height="auto"/>
<p class="ititle">1. You Order</p>
<p class="itext">Shop and browse your favorite<br>brands from your local shops</p>
</div>
<div align="center" class="arrow">
<img src="http://www.devo.co.uk/wp-content/uploads/2016/08/rightgreyarrow.png" width="50" height="auto"/>
</div>
<div align="center" class="category">
<img src="http://www.devo.co.uk/wp-content/uploads/2016/07/2-DEVOnewblue.png" width="175" height="auto"/>
<p class="ititle">2. We Collect</p>
<p class="itext">Our drivers make their way to your<br>local shop</p>
</div>
<div align="center" class="arrow">
<img src="http://www.devo.co.uk/wp-content/uploads/2016/08/rightgreyarrow.png" width="50" height="auto"/>
</div>
<div align="center" class="category">
<img src="http://www.devo.co.uk/wp-content/uploads/2016/07/3-DEVOcolour.png" width="95" height="auto"/>
<p class="ititle">3. We Deliver</p>
<p class="itext">Our drivers make their way to<br>your location</p>
</div>
<div align="center" class="arrow">
<img src="http://www.devo.co.uk/wp-content/uploads/2016/08/rightgreyarrow.png" width="50" height="auto"/>
</div>
<div align="center" class="category">
<img src="http://www.devo.co.uk/wp-content/uploads/2016/07/4-DEVO.png" width="65" height="auto"/>
<p class="ititle">4. You Enjoy</p>
<p class="itext">Track and receive your order<br>in as little as 30 minutes</p>
</div>
</div>
CSS:
#instruct {
height: auto;
width: 100%;
background-color: transparent;
border-bottom: 3px solid #fd0e35;
}
.category {
padding: 40px 50px 10px 50px;
display: inline-block;
}
.arrow {
padding: 0px;
display: inline-block;
border: 1px solid pink;
}
.ititle {
margin-top: 20px;
margin-bottom: 0;
text-transform: uppercase;
font-weight: bold;
font-size: 14px;
color: #a6a6a6;
}
.itext {
font-size: 13px;
}

The simplest solution is the use of vertical-align: middle; on the children of the container:
#instruct > div { vertical-align: middle; }
See this fiddle.

You need to relatively position the element in order for the 'top' property to take effect:
.arrow {
padding: 0px;
display: inline-block;
border: 1px solid pink;
position:relative;
top:-50px; // <---- change this value to suit your preferred positioning.
}

Related

How do I start a new line for each group of inline blocks?

So I have multiple div tags, each one represents a inline-block. Each div has an image and headings as text. I want to be able to display them side by side, as seen from this image:
(For this image, see the "Getting Started" section, as this is what I'm referring to specifically.)
My question is how do I achieve this structure? I've tried positioning the images and text side to side, but it didn't work in the code below.
.Getting-Started {
background-color: lightBlue;
text-align: center;
padding-top: 20px;
padding-bottom: 50px;
}
.Step1,
.Step2,
.Step3 {
display: inline-block;
}
br {
margin: 0px;
padding: 0px;
line-height: 0px;
}
.Step1 {}
.Step2 {}
.Step3 {}
<div class="Getting-Started">
<h1 style="margin: 0 0 20px;">Getting Started</h1>
<div class="Step1">
<img src="#" alt="#">
<h2 style="margin: 0px;">Step 1: Select your year level above</h2>
</div>
<br>
<div class="Step2">
<img src="#" alt="#" width="">
<h2>Step 2: Choose a level of difficulty you feel cofident with</h2>
</div>
<br>
<div class="Step3">
<img src="#" alt="#">
<h2>Step 3: Select a topic and click on "Read More"</h2>
</div>
<br>
</div>
https://jsfiddle.net/ct69hkbg/
Your mistake is in your css making div elements with class "step1, step2, step3" to inline-block.
You have to make display of children of these elements to inline-block
.Getting-Started {
background-color: lightBlue;
text-align: center;
padding-top: 20px;
padding-bottom: 50px;
}
.step h2,
.step img {
display: inline-block;
vertical-align: middle;
}
.step img {
margin-right: 10px;
}
br {
margin: 0px;
padding: 0px;
line-height: 0px;
}
refactored your code a bit and replaced "step1, step2, step3" to step as you can see in the code
check this out: https://jsfiddle.net/gj02r3dn/
Remove your Step1...3 classes from your HTML and your CSS.
Remove the <br> tags.
Use div:nth-of-type(odd) img and div:nth-of-type(odd) img selectors to
float your images left/right alternatingly.
.Getting-Started {
background-color: lightBlue;
text-align: center;
padding-top: 20px;
padding-bottom: 50px;
}
br {
margin: 0px;
padding: 0px;
line-height: 0px;
}
.Getting-Started div:nth-of-type(odd) img {
float: left;
}
.Getting-Started div:nth-of-type(even) img {
float: right;
}
<div class="Getting-Started">
<h1 style="margin: 0 0 20px;">Getting Started</h1>
<div>
<img src="#" alt="#">
<h2>Step 1: Select your year level above</h2>
</div>
<div>
<img src="#" alt="#" width="">
<h2>Step 2: Choose a level of difficulty you feel confident with</h2>
</div>
<div>
<img src="#" alt="#">
<h2>Step 3: Select a topic and click on "Read More"</h2>
</div>
</div>
Here is the Simple Code
HTML
<h3>
<span class="first-label">This is the main label</span>
<span class="secondary-label">secondary label</span>
</h3>
CSS
.first-label:after {
content: '\A';
white-space: pre; }
try this code:
.Getting-Started {
background-color: lightBlue;
padding-top: 20px;
padding-bottom: 50px;
}
.Step {
display: flex;
flex-direction: row-reverse;
justify-content: space-between;
align-items: center;
border: 1px solid #000;
text-align: right;
}
.Step:nth-child(2n) {
flex-direction: row;
text-align: left;
}
.Step h2 {
flex: 0 0 60%;
}
img {
width: 150px;
height: 150px;
background-color: yellow;
border: 2px solid yellow;
}
<div class="Getting-Started">
<h1 style="margin: 0 0 20px;">Getting Started</h1>
<div class="Step">
<img src="#" alt="#">
<h2 style="margin: 0px;">Step 1: Select your year level above</h2>
</div>
<div class="Step">
<img src="#" alt="#" width="">
<h2>Step 2: Choose a level of difficulty you feel cofident with</h2>
</div>
<div class="Step">
<img src="#" alt="#">
<h2>Step 3: Select a topic and click on "Read More"</h2>
</div>
</div>
heading element <h1> through <h6>, hence can't be displayed inline or inline-block. Use inline elements instead for eg. span.
https://jsfiddle.net/snehansh/xdw9cp50/4/
.Getting-Started {
background-color: lightBlue;
text-align: center;
padding-top: 20px;
padding-bottom: 50px;
}
.Step1, .Step2, .Step3 {
display: inline-block;
}
br {
margin: 0px;
padding: 0px;
line-height: 0px;
}
.Step1 {
}
.Step2 {
}
.Step3 {
}
<div class="Getting-Started">
<h1 style="margin: 0 0 20px;">Getting Started</h1>
<div class="Step1">
<img src="#" alt="#">
<span>Step 1: Select your year level above</span>
</div>
<br>
<div class="Step2">
<img src="#" alt="#" width="">
<span>Step 2: Choose a level of difficulty you feel cofident with</span>
</div>
<br>
<div class="Step3">
<img src="#" alt="#">
<span>Step 3: Select a topic and click on "Read More"</span>
</div>
<br>
</div>

outside div messes up when moding inside it

the Divs look great but once a image url is loaded it does not stay inside the div. Does this have something to do with overflow? i was under the impression that the image being 100% would stretch out to the divs specified height and width
---------------------------------------
---------------------------------------
---------------------------------------
---------------------------------------
---------------------------------------
---------------------------------------
.sec3head {
padding-top: 50px;
padding-bottom: 50px;
width: 100%;
height: 240px;
text-align: center;
border: px solid red;
background: rgba(0, 0, 0, 0.5);
color: #FFF;
border-radius: 10px;
}
.sec3head4 {
/* pic */
display: inline-block;
width: 30%;
height: 200px;
text-align: center;
border: 1px solid red;
color: #FFF;
border-radius: 5px;
}
.sec3head5 {
/* text */
display: inline-block;
width: 60%;
height: 200px;
align-content: start;
text-align: center;
border: px solid red;
background: rgba(0, 0, 0, 0.5);
color: #FFF;
border-radius: 10px;
}
<div class="sec3head">
<div class="sec3head4">
<img src="images/" alt="alt text" height="100%" width="100%" />
</div>
<!--sec3headt4-->
<div class="sec3head5">
text
</div>
<!--sec3headt5-->
</div>
<!--sec3head-->
<div class="sec3head">
<div class="sec3head5">
text
</div>
<!--sec3headt5-->
<div class="sec3head4">
<img src="images/" alt="alt text" height="100%" width="100%" />
</div>
<!--sec3headt4-->
</div>
<!--sec3head-->
<div class="sec3head">
<div class="sec3head4">
<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxAQEA8QDRAPEA8PDw8PDw8QDw8ODw0PFREXFxURFRUYHSggGBolGxUVITEhJSkrLi8vFx82ODMsNygtLisBCgoKBQUFDgUFDisZExkrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrK//AABEIALcBEwMBIgACEQEDEQH/xAAbAAEAAgMBAQAAAAAAAAAAAAAAAgMBBAUGB//EADcQAA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G64ldSDA5M5pfn7lUqscHRqWvdJ+5X+nXWMfsgPP3dw35acct537FFrwuTalVfrpPT/DXZfZGtWilyA01FLZdCcQ0SigJJlqeFnr0RCC6mJMDZ4TL+bv1Uv9juHn+GyxUj74+56AAAAAAAAAAAAAAAAAAAAAAAAAAAAMMAADBkAYwMAZAhNFM4lk5FUpAUVImpVRt1p7GjUmBW4iMQTggMMiyciACm8NHfta2uKfVbM8/g2bS50Sz0fP2A7oIwkmk1umSAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAEJRJmGBrzpvuimVKXdfk3JIpkBqVKb7mpOCRv1DTqICqMS5RFOBOSA15orLKhBAYYMtGEBfZXrpvD3i+nb1R26NWM1mLyjzrRinVnTeqD910f0A9MDnWfFYT2n5Jevyv6nRTAAAAAAAAAAAAAAAAAGGwAAAAAAAAAAAAjIokABRVNeUQAJwRioZAGpMjgADMiCAAyGjAAqqUiy3vKlLk8x/a90AB17HikKr04cZ/te6+jN8AAAAAAA/9k="
alt="alt text" height="100%" width="100%" />
</div>
<!--sec3headt4-->
<div class="sec3head5">
text
</div>
<!--sec3headt5-->
</div>
<!--sec3head-->
You are only missing one bit of CSS.
You need to use vertical-align:top;.
The vertical-align property affects the vertical positioning inside a
line box of the boxes generated by an inline-level element.
top
Align the top of the aligned subtree with the top of the line box.
https://www.w3.org/wiki/CSS/Properties/vertical-align
One a side not dont use 100% in both the height & width of an image. Add the actual image dimensions and use css to change the height and width to 100%.
Also do some reading on div positioning and when to use display inline-block and when to use css tables.
And don't ever use float for positioning anything other than an image that needs text to wrap around it. It's not for elements.
.sec3head {
padding-top: 50px;
padding-bottom: 50px;
width: 100%;
height: 240px;
text-align: center;
border: px solid red;
background: rgba(0, 0, 0, 0.5);
color: #FFF;
border-radius: 10px;
}
.sec3head4 {
/* pic */
display: inline-block;
width: 30%;
height: 200px;
text-align: center;
border: 1px solid red;
color: #FFF;
border-radius: 5px;
vertical-align:top;
}
.sec3head5 {
/* text */
display: inline-block;
width: 60%;
height: 200px;
align-content: start;
text-align: center;
border: px solid red;
background: rgba(0, 0, 0, 0.5);
color: #FFF;
border-radius: 10px;
vertical-align:top;
}
<div class="sec3head">
<div class="sec3head4">
<img src="https://secure.i.telegraph.co.uk/multimedia/archive/01599/duck2_1599748c.jpg" alt="alt text" height="100%" width="100%" />
</div>
<!--sec3headt4-->
<div class="sec3head5">
text
</div>
<!--sec3headt5-->
</div>
<!--sec3head-->
<div class="sec3head">
<div class="sec3head5">
text
</div>
<!--sec3headt5-->
<div class="sec3head4">
<img src="https://secure.i.telegraph.co.uk/multimedia/archive/01599/duck2_1599748c.jpg" alt="alt text" height="100%" width="100%" />
</div>
<!--sec3headt4-->
</div>
<!--sec3head-->
<div class="sec3head">
<div class="sec3head4">
<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxAQEA8QDRAPEA8PDw8PDw8QDw8ODw0PFREXFxURFRUYHSggGBolGxUVITEhJSkrLi8vFx82ODMsNygtLisBCgoKBQUFDgUFDisZExkrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrK//AABEIALcBEwMBIgACEQEDEQH/xAAbAAEAAgMBAQAAAAAAAAAAAAAAAgMBBAUGB//EADcQAAIBAwIEBAUCBQMFAAAAAAABAgMEERIhBTFBUQYiYXETMoGRoRRSByNCYnIWseEkM8Hw8f/EABQBAQAAAAAAAAAAAAAAAAAAAAD/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwD7iAAAAAABsDyXiK1cpPG0nLGy+Zep0eE8N+HFb/8AP1NbxTV+HocM5nOKk9vIlvt7/wDk7tm8wj/igLKccEzBkAAAAAAwRZIxICtgACOCEixkJAUzKplsimowKJkME5zRrTvaaeHJJ9m8AWsgg6iIqXYCFzZQqLEvxzPkviCqqVarThzzKMeqbaxy7n1+c8Rk+yZ8N4zW13M5bNubWZJvG/PYD69/CjhkqVo6tVeetNyT6uG2Pbke5PAeE+MX1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MDnWfFYT2n5Jevyv6nRTAAAAAAAAAAAAAAAAAGGwAAAAAAAAAAAAjIokABRVNeUQAJwRioZAGpMjgADMiCAAyGjAAqqUiy3vKlLk8x/a90AB17HikKr04cZ/te6+jN8AAAAAAA/9k="
alt="alt text" height="100%" width="100%" />
</div>
<!--sec3headt4-->
<div class="sec3head5">
text
</div>
<!--sec3headt5-->
</div>
<!--sec3head-->
You should use float: right; or float: left; to put in place your DOM block elements.
.sec3head {
padding-top: 50px;
padding-bottom: 50px;
width: 100%;
height: 240px;
text-align: center;
border: px solid red;
background: rgba(0, 0, 0, 0.5);
color: #FFF;
border-radius: 10px;
}
.sec3head4 {
/* pic */
display: inline-block;
width: 30%;
height: 200px;
text-align: center;
border: 1px solid red;
color: #FFF;
border-radius: 5px;
}
.sec3head5 {
/* text */
display: inline-block;
width: 60%;
height: 200px;
float: right;
align-content: start;
text-align: center;
border: px solid red;
background: rgba(0, 0, 0, 0.5);
color: #FFF;
border-radius: 10px;
}
<div class="sec3head">
<div class="sec3head4">
<img src="images/" alt="alt text" height="100%" width="100%" />
</div>
<!--sec3headt4-->
<div class="sec3head5">
text
</div>
<!--sec3headt5-->
</div>
<!--sec3head-->
<div class="sec3head">
<div class="sec3head5">
text
</div>
<!--sec3headt5-->
<div class="sec3head4">
<img src="images/" alt="alt text" height="100%" width="100%" />
</div>
<!--sec3headt4-->
</div>
<!--sec3head-->
<div class="sec3head">
<div class="sec3head4">
<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxAQEA8QDRAPEA8PDw8PDw8QDw8ODw0PFREXFxURFRUYHSggGBolGxUVITEhJSkrLi8vFx82ODMsNygtLisBCgoKBQUFDgUFDisZExkrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrK//AABEIALcBEwMBIgACEQEDEQH/xAAbAAEAAgMBAQAAAAAAAAAAAAAAAgMBBAUGB//EADcQAAIBAwIEBAUCBQMFAAAAAAABA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vdJ+5X+nXWMfsgPP3dw35acct537FFrwuTalVfrpPT/DXZfZGtWilyA01FLZdCcQ0SigJJlqeFnr0RCC6mJMDZ4TL+bv1Uv9juHn+GyxUj74+56AAAAAAAAAAAAAAAAAAAAAAAAAAAAMMAADBkAYwMAZAhNFM4lk5FUpAUVImpVRt1p7GjUmBW4iMQTggMMiyciACm8NHfta2uKfVbM8/g2bS50Sz0fP2A7oIwkmk1umSAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAEJRJmGBrzpvuimVKXdfk3JIpkBqVKb7mpOCRv1DTqICqMS5RFOBOSA15orLKhBAYYMtGEBfZXrpvD3i+nb1R26NWM1mLyjzrRinVnTeqD910f0A9MDnWfFYT2n5Jevyv6nRTAAAAAAAAAAAAAAAAAGGwAAAAAAAAAAAAjIokABRVNeUQAJwRioZAGpMjgADMiCAAyGjAAqqUiy3vKlLk8x/a90AB17HikKr04cZ/te6+jN8AAAAAAA/9k="
alt="alt text" height="100%" width="100%" />
</div>
<!--sec3headt4-->
<div class="sec3head5">
text
</div>
<!--sec3headt5-->
</div>
<!--sec3head-->

Div move vertically after window resize

How do i make these divs to move down when window resizes and on mobile devices to be a width of 100%; Subject class = "project-cards"
Heres the Code...
Resize window.
Theres alot of things going on here, first when the window resizes i want the three divs to move down into a vertical row. When the window gets to about the size of a mobile phone i want the three divs to still be vertical with a width of 100%; so that it is covering the the whole page width wise. You can see alot of things going wrong with the content inside the divs when it resizes. For example the text and button overlap. I know i cant ask two questions but if you could help me get the three divs to be responsive, that will help me so much. Visit site Xlaeo.tk
.mainCenter{
width:100%;
padding-right:100px;
padding-left:100px;
padding-top: 50px;
height:700px;
}
.project-wrapper{
margin-top: 420px;
}
.headerProjects{
font-size: 25px;
font-weight: BOLD;
margin-left: 52px;
margin-bottom: 20px;
color: #d80068;
}
.projectholders{
height:auto;
width:100%;
margin:0 auto;
display: flex;
justify-content: center;
margin-bottom: 100px;
min-width: 200px;
}
.projects-cards{
border:.9px solid #f7f7f7;
border-radius: 2rem;
display: block;
width: 30%;
margin-left:25px;
}
.projects-cards:hover{
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);
transition-delay: 1s;
transition-duration: .5s;
}
.media-top{
width:100%;
height:300px;
border-bottom: 1.9px solid gray;
position: relative;
}
.media-top img{
border-top-left-radius: 2rem;
border-top-right-radius: 2rem;
}
.project-info{
width:100%;
}
.progress-left{
float: left;
width: 150px;
height: 150px;
}
.project-money{
float: right;
width: 170px;
border-bottom: 1px solid #c7c8c9;
}
.project-money h1{
font-size: 16.9px;
color: gray;
font-weight: bold;
width:900%;
}
.visitProject-button-H{
padding: 20px;
float:right;
}
.visi-project{
height:50px;
width:135px;
background-color: #ff0043;
font-size: 20px;
font-weight: bold;
border:none;
border-top-left-radius: 1rem;
border-bottom-left-radius: 1rem;
}
.under{
display: flex;
margin:0 auto;
justify-content: center;
font-size: 60px;
color: #ff0043;
}
<div class="projectholders">
<div class="projects-cards">
<div class="media-top" >
<img src="http://cdn.pcwallart.com/images/mercedes-benz-biome-seed-wallpaper-1.jpg" width="100%" height="100%" />
</div>
<div class="project-info">
<div class="progress-left">
<img src="https://camo.githubusercontent.com/40a03a2e27517edee74b177b7d48f1632b31c693/687474703a2f2f692e696d6775722e636f6d2f414a30364157452e706e67"
width="100%" height="100%;" />
</div>
<div class="project-money">
<h1>Backed by $102,323 </h1>
</div>
<div class="visitProject-button-H">
<button class="visi-project" type="button">Visit</button>
</div>
</div>
</div>
<div class="projects-cards">
<div class="media-top">
<img src="https://cdn.dribbble.com/users/149817/screenshots/1436337/speedcam.gif" width="100%" height="100%" />
</div>
<div class="project-info">
<div class="progress-left">
<img src="https://camo.githubusercontent.com/40a03a2e27517edee74b177b7d48f1632b31c693/687474703a2f2f692e696d6775722e636f6d2f414a30364157452e706e67"
width="100%" height="100%;" />
</div>
<div class="project-money">
<h1>Backed by $9,564 </h1>
</div>
<div class="visitProject-button-H">
<button class="visi-project" type="button">Visit</button>
</div>
</div>
</div>
<div class="projects-cards">
<div class="media-top">
<img src="http://coolwallpaperz.info/user-content/uploads/wall/o/27/girl-motorcycle-streamlined-cool-sumer-370761.jpg" width="100%" height="100%" />
</div>
<div class="project-info">
<div class="progress-left">
<img src="https://camo.githubusercontent.com/40a03a2e27517edee74b177b7d48f1632b31c693/687474703a2f2f692e696d6775722e636f6d2f414a30364157452e706e67"
width="100%" height="100%;" />
</div>
<div class="project-money">
<h1>Backed by $23,324 </h1>
</div>
<div class="visitProject-button-H">
<button class="visi-project" type="button">Visit</button>
</div>
</div>
</div>
</div>
If you really don't want to use any libraries,
Please go with CSS Media Query
<div>
<div class="block">
<p>Hello</p>
</div>
<div class="block">
<p>Hello</p>
</div>
<div class="block">
<p>Hello</p>
</div>
<div>
CSS
.block{
display: inline-block;
width: 30%;
}
#media screen and (max-width: 480px) {
.block{
display: inline-block;
width: 100%;
}
}
DEMO: https://codepen.io/mkarrfan/pen/WEOWpG
You can try this I have added bootstrap to your code and your can define your css accordingly.
Firstly add bootstrap CDN to your code and define each section with the columns size you want I have added col-sm-4 to the class.
Note : sm is for small screen similarly we have md, xs, lg for medium extra-small and large screen, you can define all at same time also depending how you want your view to look on different size of screen, you can devide screen into 12 parts so range will be from col-sm-1 to col-sm-12.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/css/bootstrap.min.css" >
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid">
<div class="projectholders row">
<div class="projects-cards col-sm-4">
<div class="media-top" >
<img src="http://cdn.pcwallart.com/images/mercedes-benz-biome-seed-wallpaper-1.jpg" width="100%" height="100%" />
</div>
<div class="project-info">
<div class="progress-left">
<img src="https://camo.githubusercontent.com/40a03a2e27517edee74b177b7d48f1632b31c693/687474703a2f2f692e696d6775722e636f6d2f414a30364157452e706e67"
width="100%" height="100%;" />
</div>
<div class="project-money">
<h1>Backed by $102,323 </h1>
</div>
<div class="visitProject-button-H">
<button class="visi-project" type="button">Visit</button>
</div>
</div>
</div>
<div class="projects-cards col-sm-4">
<div class="media-top">
<img src="https://cdn.dribbble.com/users/149817/screenshots/1436337/speedcam.gif" width="100%" height="100%" />
</div>
<div class="project-info">
<div class="progress-left">
<img src="https://camo.githubusercontent.com/40a03a2e27517edee74b177b7d48f1632b31c693/687474703a2f2f692e696d6775722e636f6d2f414a30364157452e706e67"
width="100%" height="100%;" />
</div>
<div class="project-money">
<h1>Backed by $9,564 </h1>
</div>
<div class="visitProject-button-H">
<button class="visi-project" type="button">Visit</button>
</div>
</div>
</div>
<div class="projects-cards col-sm-4">
<div class="media-top">
<img src="http://coolwallpaperz.info/user-content/uploads/wall/o/27/girl-motorcycle-streamlined-cool-sumer-370761.jpg" width="100%" height="100%" />
</div>
<div class="project-info">
<div class="progress-left">
<img src="https://camo.githubusercontent.com/40a03a2e27517edee74b177b7d48f1632b31c693/687474703a2f2f692e696d6775722e636f6d2f414a30364157452e706e67"
width="100%" height="100%;" />
</div>
<div class="project-money">
<h1>Backed by $23,324 </h1>
</div>
<div class="visitProject-button-H">
<button class="visi-project" type="button">Visit</button>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
you can find the working fiddle https://jsfiddle.net/rhmasm3t/
I hope this will help. and this does not change any thing to your css.
I have made few adjustments in your code, such as widths of some divs. You can play around and see what works best.
You have used 900% on width of project-money h1 thats why your overflow-x is so much.
.project-money h1{
font-size: 16.9px;
color: gray;
font-weight: bold;
width:900%;
}
Also I have used media queries, so that when the width gets smaller the content will be below each other. Read w3 queries.
#media screen and (max-width:500px) {
.projectholders {
flex-direction: column;
}
Code
.mainCenter {
width: 100%;
padding-right: 100px;
padding-left: 100px;
padding-top: 50px;
height: 700px;
}
.project-wrapper {
margin-top: 420px;
}
.headerProjects {
font-size: 25px;
font-weight: BOLD;
margin-left: 52px;
margin-bottom: 20px;
color: #d80068;
}
.projectholders {
height: auto;
width: 100%;
margin: 0 auto;
display: inline-flex;
justify-content: center;
margin-bottom: 100px;
min-width: 200px;
}
.projects-cards {
border: .9px solid #f7f7f7;
border-radius: 2rem;
display: block;
width: 150px;
margin-left: 25px;
}
.projects-cards:hover {
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
transition-delay: 1s;
transition-duration: .5s;
}
.media-top {
width: 100%;
height: 300px;
border-bottom: 1.9px solid gray;
position: relative;
}
.media-top img {
border-top-left-radius: 2rem;
border-top-right-radius: 2rem;
}
.project-info {
width: 100%;
}
.progress-left {
float: left;
width: 150px;
height: 150px;
}
.project-money {
float: right;
width: 150px;
border-bottom: 1px solid #c7c8c9;
}
.project-money h1 {
font-size: 16.9px;
color: gray;
font-weight: bold;
width: 900%;
}
.visitProject-button-H {
padding: 20px;
float: right;
}
.visi-project {
height: 50px;
width: 125px;
background-color: #ff0043;
font-size: 20px;
font-weight: bold;
text-align: center;
border: none;
border-top-left-radius: 1rem;
border-bottom-left-radius: 1rem;
}
.under {
display: flex;
margin: 0 auto;
justify-content: center;
font-size: 60px;
color: #ff0043;
}
#media screen and (max-width:500px) {
.projectholders {
flex-direction: column;
}
<div class="projectholders">
<div class="projects-cards">
<div class="media-top">
<img src="http://cdn.pcwallart.com/images/mercedes-benz-biome-seed-wallpaper-1.jpg" width="100%" height="100%" />
</div>
<div class="project-info">
<div class="progress-left">
<img src="https://camo.githubusercontent.com/40a03a2e27517edee74b177b7d48f1632b31c693/687474703a2f2f692e696d6775722e636f6d2f414a30364157452e706e67" width="100%" height="100%;" />
</div>
<div class="project-money">
<h1>Backed by $102,323 </h1>
</div>
<div class="visitProject-button-H">
<button class="visi-project" type="button">Visit</button>
</div>
</div>
</div>
<div class="projects-cards">
<div class="media-top">
<img src="https://cdn.dribbble.com/users/149817/screenshots/1436337/speedcam.gif" width="100%" height="100%" />
</div>
<div class="project-info">
<div class="progress-left">
<img src="https://camo.githubusercontent.com/40a03a2e27517edee74b177b7d48f1632b31c693/687474703a2f2f692e696d6775722e636f6d2f414a30364157452e706e67" width="100%" height="100%;" />
</div>
<div class="project-money">
<h1>Backed by $9,564 </h1>
</div>
<div class="visitProject-button-H">
<button class="visi-project" type="button">Visit</button>
</div>
</div>
</div>
<div class="projects-cards">
<div class="media-top">
<img src="http://coolwallpaperz.info/user-content/uploads/wall/o/27/girl-motorcycle-streamlined-cool-sumer-370761.jpg" width="100%" height="100%" />
</div>
<div class="project-info">
<div class="progress-left">
<img src="https://camo.githubusercontent.com/40a03a2e27517edee74b177b7d48f1632b31c693/687474703a2f2f692e696d6775722e636f6d2f414a30364157452e706e67" width="100%" height="100%;" />
</div>
<div class="project-money">
<h1>Backed by $23,324 </h1>
</div>
<div class="visitProject-button-H">
<button class="visi-project" type="button">Visit</button>
</div>
</div>
</div>
</div>
For the resizing functionality you should use bootstrap
It's simple and easy to use and provide responsiveness to your site.

How to align an image at left and a heading in centre?

I tried using below code but the heading comes in next line.
The code is given below :
<div style="display:inline;">
<img src="abc.png" style="margin:10px 10px 10px 10px;width:97px;height:50px;" />
<h5 style="display:inline-block">Hello</h5></div>
Expected Output!!
Change your styles like below. Add float:left; to both img and h5 tags to get your result.
UPDATED OUTPUT
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div style="display: inline-block;width: 100%;">
<img src="https://smallbusinesssaturdayuk.com/Images/Small-Business-Saturday-UK-Google-Plus.gif" style="float:left;" />
<h5 style="text-align:center;">Hello</h5>
</div>
</body>
</html>
Here I used inline styles as you are using that. But always try to avoid inline styles.
<div style="display: inline-block;width: 100%;text-align: center;">
<img src="https://placeholdit.imgix.net/~text?txtsize=12&txt=97%C3%9750&w=97&h=50" alt="img" style="text-align: left;float: left;" />
<h5 style="margin: 17px 0;">Hello</h5>
</div>
div {
display: flex;
align-items: center;
}
img {
margin: 10px 10px 10px 10px;
width: 97px;
height: 50px;
flex: 0 0;
}
h5 {
padding: 0;
margin: 0;
flex: 1 0;
text-align: center;
}
.div {
position: relative;
min-height: 70px;
}
.img {
position: absolute;
left: 0;
top: 0;
}
<h4>Center of text part</h4>
<div>
<img src="http://beerhold.it/97/50">
<h5>Hello</h5>
</div>
<hr>
<h4>Center of vieport</h4>
<div class="div">
<img class="img" src="http://beerhold.it/97/50">
<h5>Hello</h5>
</div>
Its on the same line
<div style="display:inline;background:red; float: left;">
<img src="http://image.flaticon.com/icons/png/128/33/33702.png" style="margin:10px 10px 10px 10px;width:97px;height:50px;"><h5 style="display:inline-block; background:blue;color:#fff; vertical-align:top;">Hello</h5></div>
Use vertical-align to align elements vertically (does not work for block elements).
div {
display: inline
}
h5 {
display: inline-block;
vertical-align: middle;
}
img {
margin: 10px;
width: 97px;
height: 50px;
vertical-align: middle;
}
<div>
<img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=350%C3%97150&w=350&h=150" />
<h5>Hello</h5>
</div>
I didn't understand what's your problem. Just try this..
<div style="display:inline;">
<img src="abc.png" style="float:left; margin:10px 10px 10px 10px;width:97px;height:50px;" />
<h5 style="display:inline-block;">Hello</h5></div>

Image and Text Positioning HTML

I am trying to create a setup mimicking the one in the link with an image, text and a border all horizontally and vertically centered. I've tried a number of different ideas.
The below is the closest I've gotten but even then I'm still experiencing issues with the border displaying and things not being centered the way I want them.
<div style="max-width: 800px; height border: 1px solid #c6c6c6; border-radius: 5px; padding: 35px; margin-left: 60px; float: center; height: 220px; display: inline-block;">
<img src="image.gif" />
</div>
<div style="height: 220px; display: inline-block;">
<div style="position: relative; top: 50%;">
<h4 style="text-align: center;">Text 1/h4>
<p style="text-align: center;">Text 2<br />Text 3</p>
</div>
</div>
I would try using CSS tables, put the image and the text in separate block level elements that use display: table-cell, all of which are contained in a parent container using display: table.
.wrapper {
border: 1px solid gray;
border-radius: 5px;
display: table;
height: 220px;
margin: 0 auto;
}
.wrapper .item {
display: table-cell;
vertical-align: middle;
text-align: center;
min-width: 200px;
padding: 35px;
}
.item img {
display: block;
}
<div class="wrapper">
<div class="item">
<a href="www.google.com" target="_blank">
<img src="http://placehold.it/200x150" />
</a>
</div>
<div class="item">
<h4>Text Line One</h4>
<p>Text 2
<br />Text 3</p>
</div>
</div>
you should put inline-block on image and the parent div of text panel and vertical-align:middle .. would do that
.textpane{
height: 220px;
display: inline-block;
vertical-align:middle;
}
.imagepane{
width:50px;
height:50px;
display:inline-block;
vertical-align:middle;
max-width: 800px;
border: 1px solid #c6c6c6;
border-radius: 5px;
padding: 35px;
margin-left: 60px;
height: 220px;
}
<div class='imagepane'>
<img src="image.gif" />
</div>
<div class='textpane'>
<div style="position: relative; top: 50%;">
<h4 style="text-align: center;">Text 1/h4>
<p style="text-align: center;">Text 2<br />Text 3</p>
</div>
</div>
jsfiddle
Note
there is not such thing as float:center;