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;
}
Related
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 :
:root {
--clr-primary: #f9baaa;
--clr-graylight: #c13828;
--clr-graymed: #c13828;
--border-radius: 0.5rem;
}
*,
*:before,
*:after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: "Playfair Display", "Montserrat";
background:square(#f9baaa);
}
main {
margin: 0rem;
}
.wrapper {
display: flex;
flex-wrap: wrap;
justify-content: center;
margin-top: 1rem;
}
.testimonial-container {
border-radius: square(--border-radius);
padding: 2rem;
width: 300px;
height: 350px;
position: relative;
margin: 0.75rem;
background: #f9baaa;
text-align: center;
}
<head>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&family=Playfair+Display:wght#400;500;700;900&display=swap" rel="stylesheet">
</head>
<body>
<main>
<h3>Here's a summary of what we'll cover together:</h3>
<div class="wrapper">
<div class="testimonial-container">
<h3 class="testimonial">Step 1: Language</h3>
<div class="name">
<p class="name">The language and questions we use internally play a big part in our life and affect our mindset. During our first session we will uncover the language you use and questions you ask yourself.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 2: Values</h3>
<div class="name">
<p class="name">We will dedicate two sessions to getting you clarity on your values; what is important to you in life. We will also assess how these play a role in your life and how to get you more of them.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 3: Beliefs</h3>
<div class="name">
<p class="name">Our fourth and fifth sessions will be focused on understanding your beliefs. This is the time where we tackle those little voices inside your head that may be holding you back.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 4: Identity</h3>
<div class="name">
<p class="name">During the identity session we will create your identity blueprint: Who are you? What do you do? How do you choose to live?</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 5: Purpose</h3>
<div class="name">
<p class="name">We will then move on to identify your purpose. What makes you get up in the morning? Having a clear purpose can help you create goals, guide your life decisions and offer you a sense of direction.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Wrap-Up Session</h3>
<div class="name">
<p class="name">Lastly, we will end by looking at how you can move forward with this new understanding and clarity. How can you utilise what you’ve discovered to help you lead your best life?</p>
</div>
</div>
flex boxes I'm trying to align - first 1 is not aligned
Hello,
I'm trying to align my flex boxes (I have 6) - they are all aligned except for the first 1.
I have tried a few different things but quite new to this so not sure what will work. The last box was not aligning but I fixed that by inputting height: 350px.
I'm creating this on Squarespace - Paloma template.
Is someone able to offer any advice?
Thank you!
:root {
--clr-primary: #f9baaa;
--clr-graylight: #c13828;
--clr-graymed: #c13828;
--border-radius: 0.5rem;
}
*,
*:before,
*:after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: "Playfair Display", "Montserrat";
background:square(#f9baaa);
}
main {
margin: 0rem;
}
.wrapper {
display: flex;
flex-wrap: wrap;
justify-content: center;
margin-top: 1rem;
}
.testimonial-container {
border-radius: square(--border-radius);
padding: 2rem;
width: 300px;
height: 350px;
position: relative;
margin: 0.75rem;
background: #f9baaa;
text-align: center;
}
<head>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&family=Playfair+Display:wght#400;500;700;900&display=swap" rel="stylesheet">
</head>
<body>
<main>
<h3>Here's a summary of what we'll cover together:</h3>
<div class="wrapper">
<div class="testimonial-container">
<h3 class="testimonial">Step 1: Language</h3>
<div class="name">
<p class="name">The language and questions we use internally play a big part in our life and affect our mindset. During our first session we will uncover the language you use and questions you ask yourself.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 2: Values</h3>
<div class="name">
<p class="name">We will dedicate two sessions to getting you clarity on your values; what is important to you in life. We will also assess how these play a role in your life and how to get you more of them.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 3: Beliefs</h3>
<div class="name">
<p class="name">Our fourth and fifth sessions will be focused on understanding your beliefs. This is the time where we tackle those little voices inside your head that may be holding you back.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 4: Identity</h3>
<div class="name">
<p class="name">During the identity session we will create your identity blueprint: Who are you? What do you do? How do you choose to live?</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 5: Purpose</h3>
<div class="name">
<p class="name">We will then move on to identify your purpose. What makes you get up in the morning? Having a clear purpose can help you create goals, guide your life decisions and offer you a sense of direction.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Wrap-Up Session</h3>
<div class="name">
<p class="name">Lastly, we will end by looking at how you can move forward with this new understanding and clarity. How can you utilise what you’ve discovered to help you lead your best life?</p>
</div>
</div>
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>
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>
I'm pretty new to HTML and CSS so perhaps this is a crazy easy question to answer.
The question is:
How to do this using only divs and css?
I don't want to use <table> <tr> <th> <td>....
Here's a basic setup of what you're asking using the flexbox property.
The CSS3 Flexible Box, or flexbox, is a layout mode providing for the
arrangement of elements on a page such that the elements behave
predictably when the page layout must accommodate different screen
sizes and different display devices. For many applications, the
flexible box model provides an improvement over the block model in
that it does not use floats, nor do the flex container's margins
collapse with the margins of its contents.
Read more about it at MDN and experiment with it so you feel comfortable using it. The setup might not be pixel perfect, but it gives you a good start for the desired layout. Trial and error, that's the best way to learn.
div {
box-sizing: border-box;
border: 1px solid black;
min-height: 20px;
}
.container {
display: flex;
flex-flow: row-wrap;
width: 100%;
}
.column {
flex: 1 1 100%;
}
.middle {
flex-basis: 200%;
}
.middle-top,
.right-top,
.right-bottom {
display: flex;
flex-flow: row wrap;
width: 100%;
}
.language,
.search,
.login,
.signup,
.some-text,
.avatar {
flex: 1 1 50%;
}
<div class="container">
<div class="column left">
<div class="social">
Social icons
</div>
<div class="logo">
Logo
</div>
</div>
<div class="column middle">
<div class="middle-top">
<div class="language">
Language
</div>
<div class="search">
Search
</div>
</div>
<div class="slogan">
Slogan
</div>
<div class="menu">
Menu
</div>
</div>
<div class="column right">
<div class="right-top">
<div class="login">
Login
</div>
<div class="signup">
Signup
</div>
</div>
<div class="right-middle">
Welcome guest
</div>
<div class="right-bottom">
<div class="some-text">
<div class="something">
Some text
</div>
<div class="something">
Some text
</div>
</div>
<div class="avatar">
Avatar
</div>
</div>
</div>
</div>