I have a row in my page and I want the space in between the borders of the boxes along with keeping the boxes the same size on rotate. The animation is what I want it's that they squares are turning into rectangles and also I don't seem to know how to make them look as stand alone squares with the borders?
.statementnews {
border-style: solid;
border-width: 1px;
padding-left:2em;
/* width: 3vw; */
/* height: 3vh; */
/* justify-content: space-between; */
/* margin-right: 1em; */
transition: width 2s, height 2s, background-color 2s, transform 2s;
}
.statementnews p {
text-align: wrap;
margin-left:1em;
margin-right:1em;
background-color: #F0F0F0;
}
.statementnews:hover {
width: 1em;
height: 1em;
transform: rotate(360deg);
}
.mycolumn2 {
/* display: table-cell; */
margin-top: 2em;
/* width:100%; */
text-align: wrap;
}
.mycolumn2 div {
width:100%;
display: table-cell;
padding-top: 1em;
width: 25vw;
height: 3vh;
justify-content: space-between;
}
<section class="row sectionthird">
<h1 class="mycolumn_header">What they’ve said</h1>
<div class="mycolumn2" id="content2">
<div class="statementnews" id="content2">
<img src="https://i.imgur.com/19iZKat.png" alt="">
<p>“Manage has supercharged our team’s workflow. The ability to maintain
visibility on larger milestones at all times keeps everyone motivated.”</p>
<p>~Anisha Li</p>
</div>
<div class="statementnews" id="content2">
<img src="https://i.imgur.com/nywqgF7.png" alt="">
<p> “We have been able to cancel so many other subscriptions since using
Manage. There is no more cross-channel confusion and everyone is much
more focused.”</p>
<p>~Ali Bravo</p>
</div>
<div class="statementnews" id="content2">
<img src="https://i.imgur.com/TAe4vVN.png" alt="">
<p>“Manage allows us to provide structure and process. It keeps us organized
and focused. I can’t stop recommending them to everyone I talk to!”</p>
<p>~Richard Watts</p>
</div>
<div class="statementnews" id="content2">
<img src="https://i.imgur.com/dnBxz07.png" alt="">
<p>“Their software allows us to track, manage and collaborate on our projects
from anywhere. It keeps the whole team in-sync without being intrusive.”</p>
<p>~Shanai Gough</p>
</div>
</div>
</section>
This is the modified code which would give you the desired output:
html
<section class="row sectionthird">
<h1 class="mycolumn_header">What they’ve said</h1>
<div class="mycolumn2 " id="content2">
<div class="statementnews col">
<img src="https://i.imgur.com/19iZKat.png" alt="">
<p>“Manage has supercharged our team’s workflow. The ability to maintain
visibility on larger milestones at all times keeps everyone motivated.”</p>
<p>~Anisha Li</p>
</div>
<div class="statementnews col">
<img src="https://i.imgur.com/nywqgF7.png" alt="">
<p> “We have been able to cancel so many other subscriptions since using
Manage. There is no more cross-channel confusion and everyone is much
more focused.”</p>
<p>~Ali Bravo</p>
</div>
<div class="statementnews col">
<img src="https://i.imgur.com/TAe4vVN.png" alt="">
<p>“Manage allows us to provide structure and process. It keeps us organized
and focused. I can’t stop recommending them to everyone I talk to!”</p>
<p>~Richard Watts</p>
</div>
<div class="statementnews col">
<img src="https://i.imgur.com/dnBxz07.png" alt="">
<p>“Their software allows us to track, manage and collaborate on our projects
from anywhere. It keeps the whole team in-sync without being intrusive.”</p>
<p>~Shanai Gough</p>
</div>
</div>
</section>
and add this to your css
.col {
min-width:25vw;
}
Also, there was one error. The id of all the div of statement news were the same. In HTML, ids can't be the same. So I have removed the ids out of divs if you wish to add them, give them different naming(content1, content, content3 and so on).
Please note that the cards had the same id's. I've changed the CSS a bit hopefully this is what you meant
.statementnews {
width: 300px;
height: 300px;
padding-left: 30px;
box-shadow: 0 0 10px;
border-radius: 10px;
margin: 10px;
overflow: auto;
transition: width 2s, height 2s, background-color 2s, transform 2s;
}
.statementnews p {
text-align: wrap;
margin-left: 1em;
margin-right: 1em;
background-color: #f0f0f0;
}
.statementnews:hover {
transform: rotate(360deg);
}
.mycolumn2 {
width: 100%;
margin-top: 2em;
display: flex;
flex-direction: row;
justify-content: center;
text-align: wrap;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="style.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=" />
<title></title>
</head>
<body>
<section class="row sectionthird">
<h1 class="mycolumn_header">What they’ve said</h1>
<div class="mycolumn2" id="content2">
<div class="statementnews" id="content_1">
<img src="https://i.imgur.com/19iZKat.png" alt="" />
<p>
“Manage has supercharged our team’s workflow. The ability to
maintain visibility on larger milestones at all times keeps
everyone motivated.”
</p>
<p>~Anisha Li</p>
</div>
<div class="statementnews" id="content_2">
<img src="https://i.imgur.com/nywqgF7.png" alt="" />
<p>
“We have been able to cancel so many other subscriptions since
using Manage. There is no more cross-channel confusion and
everyone is much more focused.”
</p>
<p>~Ali Bravo</p>
</div>
<div class="statementnews" id="content_3">
<img src="https://i.imgur.com/TAe4vVN.png" alt="" />
<p>
“Manage allows us to provide structure and process. It keeps us
organized and focused. I can’t stop recommending them to
everyone I talk to!”
</p>
<p>~Richard Watts</p>
</div>
<div class="statementnews" id="content_4">
<img src="https://i.imgur.com/dnBxz07.png" alt="" />
<p>
“Their software allows us to track, manage and collaborate on
our projects from anywhere. It keeps the whole team in-sync
without being intrusive.”
</p>
<p>~Shanai Gough</p>
</div>
</div>
</section>
</body>
</html>
</body>
</html>
Related
I'm trying to include an image above text, however it affects the text if I resize that image. Whatever I try to do, either it losses responsiveness or moves text under the screen (I have one page 'body' with hidden overflow). I managed to move an image to the center of the screen both in height and width without it affecting the text below, but changing it's width makes it non responsive and moves other elements. Any help?
In short: I want that image above the text, bigger, responsive and not affecting the text.
.pagr_foto {
border-style: solid;
display: flex;
justify-content: center;
position: absolute;
width: 100%;
height: 100%;
}
.container {
position: absolute;
left: 30%;
top: 64%;
max-width: 70%;
}
.icon {
width:85px;
height: auto;
margin-left: 35%;
}
.rows {
display: flex;
flex-direction: row;
width: 80%;
max-width: 80%;
column-gap: 8px;
margin-left: 5%;
}
<div class="container">
<!--DIDELE FOTKE STARTS-->
<div class="pagr_foto">
<div class = "pagr_foto_remas">
<img src="https://sites.google.com/site/mate02trucha/_/rsrc/1472875957853/config/google_.jpg" class="pagr_foto_img"/>
</div>
</div>
<!--DIDELE FOTKE ENDS-->
<!--TEKSTAS PO APACIA STARTS-->
<div class = "fadein"> <!--FADE IN ANIMACIJA-->
<div class="container_text">
<div class = "rows">
<div class="feature">
<div style="display:flex;flex-direction:column">
<!--KAD ICONS BUTU VIRS TEKSTO-->
<img src="assets/images/group.png" class="icon" />
<h3>Watch or listen together</h3>
<p>
Start a session and invite your friends by sharing your friend code with them.
</p>
</div>
</div>
<div class="feature">
<div style="display:flex;flex-direction:column"><!--KAD ICONS BUTU VIRS TEKSTO-->
<img src="assets/images/list.png" class="icon" />
<h3>Build up the queue</h3>
<p>
Browse for your favorite media and add the URL to the queue. A number of popular websites are already supported for playback.
</p>
</div>
</div>
<div class="feature">
<div style="display:flex;flex-direction:column"><!--KAD ICONS BUTU VIRS TEKSTO-->
<img src="assets/images/chat.png" class="icon" />
<h3>Use enhanced features</h3>
<p>
New features are added on top of streaming websites such as real-time chat and timestamp markers.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
why you don't use Bootstrap instead of CSS3? Like this for example:
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<title>Sample</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-12">
<img class="img-fluid" src="https://sites.google.com/site/mate02trucha/_/rsrc/1472875957853/config/google_.jpg" class="pagr_foto_img"/>
</div>
<div class="row">
<div class="col-4">
<img class="img-fluid" src="https://estaticos.muyinteresante.es/media/cache/1140x_thumb/uploads/images/gallery/59c4f5655bafe82c692a7052/gato-marron_0.jpg" class="icon" />
<h3>Watch or listen together</h3>
<p>
Start a session and invite your friends by sharing your friend code with them.
</p>
</div>
<div class="col-4">
<img class="img-fluid" src="https://dam.ngenespanol.com/wp-content/uploads/2019/02/gatos-caja-2.png" class="icon" />
<h3>Build up the queue</h3>
<p>
Browse for your favorite media and add the URL to the queue. A number of popular websites are already supported for playback.
</p>
</div>
<div class="col-4">
<img class="img-fluid" src="https://ichef.bbci.co.uk/news/640/cpsprodpb/10E9B/production/_109757296_gettyimages-1128004359.jpg" class="icon" />
<h3>Use enhanced features</h3>
<p>
New features are added on top of streaming websites such as real-time chat and timestamp markers.
</p>
</div>
</div>
</div>
</div>
Because you are giving position absolute to .pagr_foto. And you didn't mention any css for image. By default image tag won't respect any other elements. So you have to mention style by your own.
.pagr_foto {
border-style: solid;
display: flex;
justify-content: center;
width: 100%;
height: 100%;
}
.pagr_foto_img{
width: 100%;
}
.container {
position: absolute;
left: 30%;
top: 64%;
max-width: 70%;
}
.icon {
width:85px;
height: auto;
margin-left: 35%;
}
.rows {
display: flex;
flex-direction: row;
width: 80%;
max-width: 80%;
column-gap: 8px;
margin-left: 5%;
}
<div class="container">
<!--DIDELE FOTKE STARTS-->
<div class="pagr_foto">
<div class = "pagr_foto_remas">
<img src="https://sites.google.com/site/mate02trucha/_/rsrc/1472875957853/config/google_.jpg" class="pagr_foto_img"/>
</div>
</div>
<!--DIDELE FOTKE ENDS-->
<!--TEKSTAS PO APACIA STARTS-->
<div class = "fadein"> <!--FADE IN ANIMACIJA-->
<div class="container_text">
<div class = "rows">
<div class="feature">
<div style="display:flex;flex-direction:column">
<!--KAD ICONS BUTU VIRS TEKSTO-->
<img src="assets/images/group.png" class="icon" />
<h3>Watch or listen together</h3>
<p>
Start a session and invite your friends by sharing your friend code with them.
</p>
</div>
</div>
<div class="feature">
<div style="display:flex;flex-direction:column"><!--KAD ICONS BUTU VIRS TEKSTO-->
<img src="assets/images/list.png" class="icon" />
<h3>Build up the queue</h3>
<p>
Browse for your favorite media and add the URL to the queue. A number of popular websites are already supported for playback.
</p>
</div>
</div>
<div class="feature">
<div style="display:flex;flex-direction:column"><!--KAD ICONS BUTU VIRS TEKSTO-->
<img src="assets/images/chat.png" class="icon" />
<h3>Use enhanced features</h3>
<p>
New features are added on top of streaming websites such as real-time chat and timestamp markers.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
This question already has answers here:
Align inline-block DIVs to top of container element
(5 answers)
Closed 2 years ago.
I have some simple html and css styling and I am creating a site with articles and pictures. I don't understand why my third picture isn't aligned with the other photos. It's slightly higher, though it seems like the same size. How can I get it to to be aligned properly? I don't believe I'm doing anything differently with my third article/picture, so I don't understand why it looks different.
index.html
<html>
<head>
<title>Best News Ever!</title>
<meta charset="UTF-8">
<meta name="description" content="This page is a webpage to learn html">
<meta name="keywords" content="html5,udemy,learn code,">
<meta name="author" content="Reza Zandi">
<meta name="viewport" content="width=device-width, initial=scale=1.0">
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<header id="main-header">
<h1>Best News Ever!</h1>
</header>
<section id="top-stories">
<article>
<div class="article-image" style= "background:url(dog.jpg)" ></div>
<h3>Dog kidnapped by other dog</h3>
<p>California is no stranger to dog nappings, however, this one takes
the puppies cake... read more..</p>
</article>
</section>
<section id="top-stories">
<article>
<div class= "article-image" style="background:url(chocolate.jpg)" ></div>
<h3>Chocolate is actually good for you</h3>
<p>Scientists have discovered a new propery in chocolate this is good for you.
They discovered that... read more...</p>
</article>
</section>
<section id="top-stories">
<article>
<div class= "article-image" style="background:url(cat.jpg)" ></div>
<h3>Cat steals catnip from pet mart</h3>
<p>A cat in Dallas Texas broke into a petsmart and stole the entire supply of catnip they had.
Now that location is struggling to replace the... read more...</p>
</article>
</section>
</body>
<footer>
<br/><br/>
<center>©2017<br/>
<a href='#'>Terms of service</a>
</center>
</footer>
</html>
styles.css
#import url('https://fonts.googleapis.com/css2?family=Sriracha&display=swap');
body h1 {
font-family: 'Sriracha', sans-serif ;
font-weight: 300 !important;
margin-bottom:0px;
padding-bottom: 20px;
border-bottom: 2px solid #000;
}
#top-stories{
width:1000px;
margin:auto;
}
section {
max-width: 33%;
display: inline-block;
}
article img {
max-width:100%;
}
.article-image{
width: 100%;
height: 200px;
background-size: cover !important;
background-position: center !important;
}
There's a few issues going on here, like duplicating an ID. That being said, you can get what you want by adjusting the width and using vertical-align: top;
Fiddle here: https://jsfiddle.net/harcfs0u/40/
<html>
<head>
<title>Best News Ever!</title>
<meta charset="UTF-8">
</head>
<body>
<header id="main-header">
<h1>Best News Ever!</h1>
</header>
<section class="top-stories">
<article>
<div class="article-image" style="background:url(dog.jpg)"></div>
<h3>Dog kidnapped by other dog</h3>
<p>California is no stranger to dog nappings, however, this one takes
the puppies cake... read more..</p>
</article>
</section>
<section class="top-stories">
<article>
<div class="article-image" style="background:url(chocolate.jpg)"></div>
<h3>Chocolate is actually good for you</h3>
<p>Scientists have discovered a new propery in chocolate this is good for you.
They discovered that... read more...</p>
</article>
</section>
<section class="top-stories">
<article>
<div class="article-image" style="background:url(cat.jpg)"></div>
<h3>Cat steals catnip from pet mart</h3>
<p>A cat in Dallas Texas broke into a petsmart and stole the entire supply of catnip they had.
Now that location is struggling to replace the... read more...</p>
</article>
</section>
</body>
<footer>
<br /><br />
<center>©2017<br />
<a href='#'>Terms of service</a>
</center>
</footer>
</html>
#import url('https://fonts.googleapis.com/css2?family=Sriracha&display=swap');
body h1 {
font-family: 'Sriracha', sans-serif;
font-weight: 300 !important;
margin-bottom: 0px;
padding-bottom: 20px;
border-bottom: 2px solid #000;
}
.top-stories {
vertical-align: top;
}
section {
padding: 0;
margin: 0;
max-width: 32%;
display: inline-block;
}
article {}
.article-image {
width: 100%;
height: 200px;
background-size: cover !important;
background-position: center !important;
}
In the section class of CSS file, Try using display property with inline-flex. I am attaching you stackblitz link here.
https://stackblitz.com/edit/js-c9mqfu
section {
max-width: 33%;
display: inline-flex;
}
The reason is that the vertical alignment of inline-blocks is by default at their baseline, which in this case is the last line of your text. To fix that, add vertical-align: top to the CSS for section:
section {
max-width: 33%;
display: inline-block;
vertical-align: top;
}
(And as I wrote in the comments, don't use an ID more than once - use a class instead)
u can know the differ between grid and flex in this link differ between flex and grid
section {
max-width: 33%;
display: inline-flex; // or used display: inline-grid;
}
I just removed extra text in 3rd image p and then your code worked fine
#import url('https://fonts.googleapis.com/css2?family=Sriracha&display=swap');
body h1 {
font-family: 'Sriracha', sans-serif ;
font-weight: 300 !important;
margin-bottom:0px;
padding-bottom: 20px;
border-bottom: 2px solid #000;
}
#top-stories{
width:1000px;
margin:auto;
}
section {
max-width: 33%;
display: inline-block;
}
article img {
max-width:100%;
}
.article-image{
width: 100%;
height: 200px;
background-size: cover !important;
background-position: center !important;
}
<html>
<head>
<title>Best News Ever!</title>
<meta charset="UTF-8">
<meta name="description" content="This page is a webpage to learn html">
<meta name="keywords" content="html5,udemy,learn code,">
<meta name="author" content="Reza Zandi">
<meta name="viewport" content="width=device-width, initial=scale=1.0">
</head>
<body>
<header id="main-header">
<h1>Best News Ever!</h1>
</header>
<section id="top-stories">
<article>
<div class="article-image" style= "background:url(https://i.ytimg.com/vi/MPV2METPeJU/maxresdefault.jpg)" ></div>
<h3>Dog kidnapped by other dog</h3>
<p>California is no stranger to dog nappings, however, this one takes
the puppies cake... read more..</p>
</article>
</section>
<section id="top-stories">
<article>
<div class= "article-image" style="background:url(https://upload.wikimedia.org/wikipedia/commons/7/70/Chocolate_%28blue_background%29.jpg)" ></div>
<h3>Chocolate is actually good for you</h3>
<p>Scientists have discovered a new propery in chocolate this is good for you.
They discovered that... read more...</p>
</article>
</section>
<section id="top-stories">
<article>
<div class= "article-image" style="background:url(https://news.cgtn.com/news/77416a4e3145544d326b544d354d444d3355444f31457a6333566d54/img/37d598e5a04344da81c76621ba273915/37d598e5a04344da81c76621ba273915.jpg)" ></div>
<h3>Cat steals catnip from pet mart</h3>
<p>A cat in Dallas Texas broke into a petsmart and stole the entire supply of catnip they had.
Now that location ... read more...</p>
</article>
</section>
</body>
<footer>
<br/><br/>
<center>©2017<br/>
<a href='#'>Terms of service</a>
</center>
</footer>
</html>
please see the picture and the problem.
you can see that the p element is not full but breaks a line.
can you tell me the reason?
thanks a lot!
The code consists of three blocks, each with three text descriptions. But in the second text block, when the page pixel is less than 768px, even if a line of text is not full, it will still break the line. Right? I looked at my code and still didn't know what was wrong. I hope you can answer my questions. thank you
.info{
background-color: #ffffff;
box-shadow: #aaa9a9 5px 3px 50px ;
margin-top: 40px;
border-radius: 15px;
}
.info1_1{
height: 350px;
}
.info1_2{
float: right;
margin-top: 40px;
}
.info2_1{
height: 450px;
}
.info3_1{
height: 400px;
}
.info p{
color: #eb6100;
font-size: 20px;
margin: 0 8%;
padding-top: 10%;
}
.info_img{
text-align: center;
margin: 30px auto;
}
#media screen and (max-width: 768px){
.info1,.info2,.info3{
width: 70%;
margin: 0 auto;
}
.col-sm-5,.col-sm-6{
float: none;
}
}
#media screen and (max-width: 640px){
.info1,.info2,.info3{
width: 90%;
}
}
#media screen and (max-width: 500px){
.info p{
font-size: 16px;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maxinum-scale=1.0,user-scale=no" />
<link href="https://cdn.bootcss.com/twitter-bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet">
<title>Hamiio technology--professional software and hardware customization</title>
</head>
<body>
<header></header>
<div class="body">
<div class="about">
<div class="row">
<div class="col-lg-1 col-md-1 col-sm-1"></div>
<div class="row col-lg-11 col-md-11">
<div class="info1 col-lg-6 col-md-6 col-sm-6">
<div class="info1_1 info">
<p>Hami technology, founded by shenzhen yicu innovation software co., LTD in 2010, is located in huizhou, guangdong, the beautiful founder of the former xunlei group of system architects, the company has a number of long-term software development professionals.</p>
</div>
<div class="info1_2 hidden-sm"><img src="paper.png"></div>
</div>
<div class="info2 col-lg-5 col-md-5 col-sm-5 ">
<div class="info2_1 info">
<p>The company's main business is: 1. Software customization development. 2.Customized development of software and hardware. Including system customization (Linux , Android , wince), software development.
</p>
<div class="info_img">
<img src="solution2.png">
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-2 col-md-2 col-sm-2 "></div>
<div class="col-lg-8 col-md-8 col-sm-8 info3">
<div class="info info3_1">
<p>After more than 10 years of development experience, our project implementation team can more accurately make corresponding solutions according to the actual needs of customers. Hami team is a dedicated customer service team to give customers a perfect result.</p>
<div class="info_img">
<img src="img/solution1.png">
</div>
</div>
</div>
</div>
</div>
</div>**strong text**
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>
i got the answer!
because bootstrap class "hidden-sm" just make the element's opacity to 0. So the element still taking up space.
I have a website I'm making updates to, and one of the updates is making an image in the center larger without causing the text and alignment to change. The pictures below are what I'm working on and what I want to avoid.
Basically, I need the logo in the middle to be larger without messing with how the text is lined up, but whenever I make it larger it pushes all the text down and takes the logo out of the center. Below is the code for the area I'm working on and the images..
HTML
<div class="padding">
<div class="container">
<div class="row text-center mt-30">
<div class="col-lg-4 col-md-12 col-sm-12 col-xs-12">
<div class="text-icons" ><img src="images/<?php echo $icons[2]["icon_img"]; ?>"></div>
<div class="featureitem img-item">
<!-- <strong >Empowerment</strong> -->
<p class="">An innovative approach that drives the discovery of new medicines. By collaborating with Circuit Clinical’s network, we have empowered individuals to take charge of the journey to finding cures through their participation.</p>
</div>
</div>
<div class="col-lg-4 col-md-12 col-sm-12 col-xs-12">
<div class="text-icons-middle" >
<img src="images/<?php echo $icons[0]["icon_img"]; ?>">
</div>
<div class="featureitem img-item">
<!-- <strong >Engagement</strong> -->
<p class="">We are an Integrated Research Organization [IRO] dedicated to optimizing the clinical research experience by delivering a comprehensive research program into our physicians practices. We make clinical research more manageable with our dedicated team of research professionals who match clinical trials to a physician’s areas of interest, assist with patient recruitment and study visits while filing all regulatory requirements.</p>
</div>
</div>
<!-- <div class="border"></div> -->
<div class="col-lg-4 col-md-12 col-sm-12 col-xs-12">
<div class="text-icons" ><img src="images/<?php echo $icons[1]["icon_img"]; ?>"></div>
<div class="img-item">
<!-- <strong >Enablement</strong> -->
<p class="">Transforms the experience of finding and participating in clinical trials for patients everywhere. It empowers prospective patients to confidently select a trial site trusted by their peers. Sites, sponsors and CROs leverage TrialScout<sup>TM</sup> to share their story and engage patients to consider participating in their trials.</p>
</div>
</div>
<!-- <div class="border"></div> -->
<div class="col-md-1"></div>
</div>
</div>
</div>
CSS
.text-icons img{
clear: both;
height: auto;
max-width: 300px;
margin: 0 auto;
margin-bottom: 15px;
margin-top: 15px;
}
.text-icons-middle img{
clear: both;
height: auto;
max-width: 300px;
margin: 0 auto;
margin-bottom: 15px;
margin-top: 15px;
}
I think you can use "position" method to avoid this problem, just set the "position" of parent div to "relative" and the div of "text" to "absolute", then set the text to have a fixed-top value. So when you increase the size of the picture, it wont effect the position of below text. I had made a simple program for your reference:
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSS Template</title>
<style>
#parent_div{
position: relative;
}
#div_image{
position: absolute;
top:0px;
left:0px;
background-color: green;
height:100px;
width: 300px;
}
#div_text{
position: absolute;
top:150px;
left:0px;
size:5px;
height:100px;
width: 300px;
}
#button{
position: absolute;
left:400px;
}
</style>
</head>
<body>
<div id="parent_div">
<div id="div_image">
<img src="">
<div>
<div id="div_text">
Basically, I need the logo in the middle to be larger without messing with how the text is lined up, but whenever I make it larger it pushes all the text down and takes the logo out of the center. Below is the code for the area I'm working on and the images..
</div>
</div>
<button id="button" type="button" onclick="inc_size()">Increase size</button>
<script>
function inc_size(){
var test = document.getElementById("div_image").style.height = "150px";
}
</script>
</body>
</html>
I added some images to two columns in a single row using Bootstrap 4. There's a gap between the first and second column, causing unwanted uneven spacing between my images (as you can see below). I would like the spacing to be the same between the second and third image as between the first and second (and third and fourth).
I tried following the directions on the Bootstrap 4 documentation for the no-gutters class, adding it to the row div as well as the following CSS, which didn't do anything (maybe I'm supposed to change something?):
.no-gutters {
margin-right: 0;
margin-left: 0;
> .col,
> [class*="col-"] {
padding-right: 0;
padding-left: 0;
}
}
I also tried (as suggested elsewhere) this, which also did nothing:
.row.no-gutters {
margin-right: 0;
margin-left: 0;
}
.row.no-gutters > [class^="col-"],
.row.no-gutters > [class*=" col-"] {
padding-right: 0;
padding-left: 0;
}
Additionally, here's the relevant HTML:
<div class="card">
<div class="card-header">
<h3 class="text-center">Works</h3>
</div>
<div class="card-body">
<!-- Class no-gutters removes gutters (gaps) between column content -->
<div class="row text-center no-gutters">
<!-- Using two col classes; Bootstrap automatically creates two equal-width columns for all devices -->
<div class="col">
<img src="https://image.ibb.co/mYFYe7/hum3.jpg" alt="The Natural History of Religion" class="works">
<img src="https://image.ibb.co/iRtr1n/hum0.jpg" alt="A Treatise of Human Nature" class="works">
</div>
<div class="col">
<img src="https://image.ibb.co/dZ5Ye7/hum2.jpg" alt="An Enquiry Concerning Human Understanding" class="works">
<img src="https://image.ibb.co/kdbjmn/hum4.jpg" alt="An Enquiry Concerning the Principles of Morals" class="works">
</div>
</div>
</div>
</div>
View CodePen for full code.
The no-gutters was necessary but the issue now is with alignment. You are using text-center which make the image centred in each col. A solution is to put all the image in the same col
<div class="row text-center no-gutters">
<div class="col">
<img src="https://image.ibb.co/mYFYe7/hum3.jpg" alt="The Natural History of Religion" class="works">
<img src="https://image.ibb.co/iRtr1n/hum0.jpg" alt="A Treatise of Human Nature" class="works">
<img src="https://image.ibb.co/dZ5Ye7/hum2.jpg" alt="An Enquiry Concerning Human Understanding" class="works">
<img src="https://image.ibb.co/kdbjmn/hum4.jpg" alt="An Enquiry Concerning the Principles of Morals" class="works">
</div>
</div>
Or change text-alignment for each col BUT you will need to re-adjust it on small devices:
<div class="row no-gutters">
<div class="col text-right">
<img src="https://image.ibb.co/mYFYe7/hum3.jpg" alt="The Natural History of Religion" class="works">
<img src="https://image.ibb.co/iRtr1n/hum0.jpg" alt="A Treatise of Human Nature" class="works">
</div>
<div class="col text-left">
<img src="https://image.ibb.co/dZ5Ye7/hum2.jpg" alt="An Enquiry Concerning Human Understanding" class="works">
<img src="https://image.ibb.co/kdbjmn/hum4.jpg" alt="An Enquiry Concerning the Principles of Morals" class="works">
</div>
</div>
Full code for the first solution:
body {
margin-top: 2em;
font-family: "Raleway", sans-serif;
}
h1 {
text-transform: uppercase;
}
.jumbotron {
text-align: center;
}
img {
margin: 1em;
width: 90%;
}
img.works {
height: 300px;
width: auto;
}
.no-gutters {
margin-right: 0;
margin-left: 0;
> .col,
> [class*="col-"] {
padding-right: 0;
padding-left: 0;
}
}
blockquote {
text-align: left;
/* text-align: center (applied to .jumbotron) requires an element to be inline or contain text as direct child descendant to be functional. Since blockquote's text is inside block-level elements <p> and <footer>, setting it to display: inline-block is a workaround. Note also block is needed for top/bottom margins to appear */
display: inline-block;
font-family: Georgia, serif;
font-style: italic;
margin: 4em 0;
padding: 0.35em 2.5em;
line-height: 1.45;
position: relative;
color: #383838;
}
blockquote p {
font-size: 1em !important;
}
blockquote:before {
display: block;
padding-left: 10px;
content: "\201C";
font-size: 3em;
/* Element with abolute positioning is positioned relative to nearest positioned ancestor */
position: absolute;
/* Offsets from edges of element's containing block, ancestor to which element is relatively positioned */
left: -3px; /* Negative moves it left */
top: -13px; /* Negative moves it toward top */
color: #7a7a7a;
}
blockquote cite {
color: #999;
font-size: 14px;
margin-top: 5px;
}
ul {
/* text-align: center, applied to parent jumbotron class, only works on inline elements; applying this ensures ul is centered */
display: inline-block;
text-align: left;
/* Bottom set to 4em to match margin above ul created by blockquote */
margin-bottom: 4em;
list-style: none;
}
<html lang="en">
<head>
<meta charset="UTF-8">
<title>David Hume</title>
<!-- Ensures proper rendering and touch zooming -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<!-- Provides a responsive, fixed-width container. Needed as outermost wrapper in order for Bootstrap grid system to work correctly -->
<div class="container">
<!-- Big grey box for calling extra attention to content -->
<div class="jumbotron">
<div class="row">
<!-- Using a single col in a row, Bootstrap automatically creates a single column (works for all devices) -->
<div class="col">
<h1>David Hume</h1>
<h6>Philosopher, Historian, Economist, and Essayist</h6>
<div class="card">
<div class="card-body">
<img src="https://cdn.theatlantic.com/assets/media/img/2015/09/03/BOB_Essay_Opener_WEBCrop/1920.jpg?1441298243" alt="Portrait of David Hume">
<div class="caption text-secondary">"Portrait of David Hume," 1754, by Allan Ramsay</div>
</div>
</div>
<blockquote>
<p>A wise man proportions his belief to the evidence.</p>
<footer class="blockquote-footer"><cite>David Hume</cite></footer>
</blockquote>
<h6>A brief timeline in events of David Hume's life:</h6>
<br>
<ul>
<li><strong>1711</strong> – Born as David Home in Edinburgh, Scotland</li>
<li><strong>1713</strong> – Father dies</li>
<li><strong>1723</strong> – Enrolls at University of Edinburgh at the age of 12 (14 was typical)</li>
<li><strong>1734</strong> – Changes surname to Hume</li>
<li><strong>1739</strong> – Publishes Books 1 and 2 of <em>A Treatise on Human Nature</em></li>
<li><strong>1748</strong> – Publishes <em>An Enquiry Concerning Human Understanding</em></li>
<li><strong>1751</strong> – Publishes <em>An Enquiry Concerning the Principles of Morals</em></li>
<li><strong>1776</strong> – Dies at the age of 65</li>
</ul>
</div>
</div> <!-- End of row div -->
<div class="card">
<div class="card-header">
<h3 class="text-center">Works</h3>
</div>
<div class="card-body">
<!-- Class no-gutters removes gutters (gaps) between column content -->
<div class="row text-center no-gutters">
<!-- Using two col classes; Bootstrap automatically creates two equal-width columns for all devices -->
<div class="col">
<img src="https://image.ibb.co/mYFYe7/hum3.jpg" alt="The Natural History of Religion" class="works">
<img src="https://image.ibb.co/iRtr1n/hum0.jpg" alt="A Treatise of Human Nature" class="works">
<img src="https://image.ibb.co/dZ5Ye7/hum2.jpg" alt="An Enquiry Concerning Human Understanding" class="works">
<img src="https://image.ibb.co/kdbjmn/hum4.jpg" alt="An Enquiry Concerning the Principles of Morals" class="works">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<blockquote>
<p>Be a philosopher; but, amidst all your philosophy, be still a man.</p>
<footer class="blockquote-footer"><cite>David Hume</cite></footer>
</blockquote>
<h6>Learn more on Wikipedia.</h6>
</div>
</div>
</div> <!-- End of jumbotron div -->
</div> <!-- End of container div -->
<footer class="text-center">
<hr>
<p>Written and coded by Natalie Cardot</p>
</footer>
</body>
</html>