I am trying to create a website where I have divs side by side in a list (separated by a vertical line). I am referencing this design
I am having trouble making the design responsive: I tried using % but when resizing the browser, the divs containing my text content move down and awkwardly collide/crash into each other (and don't stay separated by the vertical line). I am wondering if anyone knows how to keep the divs separated and responsive when resizing
#experience {
border: 1px solid red;
padding-top: 0px;
margin-top: 0px;
min-height: 1000px;
}
.center_text {
border: 1px solid black;
padding-top: 1%;
text-align: center;
color: #001418;
font-weight: 600;
font-family: 'Josefin Sans', sans-serif;
font-size: 2em;
}
.vline {
height: 740px;
width: 1px;
border: none;
border-right: solid 1px black;
z-index: 10;
}
.circle2 {
border: 50px solid black;
width: 1px;
border: none;
border-right: solid 1px black;
z-index: 10;
}
#exp1 {
border: 1px solid blue;
font-family: 'Josefin Sans', sans-serif;
color: #182153;
margin-top: -43%;
height: 150px;
}
.circle:before {
content: ' \25CF';
font-size: 20px;
margin-left: 49.69%;
}
.exp_text {
display: flex;
flex-grow: 1;
flex-wrap: wrap;
margin: 0 auto;
border: 1px solid red;
margin-top: -2%;
min-height: 110px;
}
.left_exp {
border: 1px solid green;
text-align: right;
margin-left: 25%;
}
.right_exp {
margin-top: -5.8%;
border: 1px solid green;
width: min-content;
margin-left: 60%;
}
.date {
font-size: 1.3em;
font-weight: 600;
}
.company {
font-size: 1.3em;
font-weight: 600;
}
.role {
font-size: 1em;
min-width: 250px;
}
.job_descr {
font-size: 1em;
min-width: 250px;
}
<div id="experience">
<h3 class="center_text"> Experience</h3>
<div>
<hr class="vline" />
<div id="exp1">
<span class="circle"></span>
<div class="exp_text">
<div class="left_exp">
<div class="date">
<p>2022 </p>
</div>
<div class="role">
<p>Software Engineering Intern</p>
</div>
</div>
<div class="right_exp">
<div class="company">
<p>Company Name</p>
</div>
<div class="job_descr">
<p>Description.................</p>
</div>
</div>
</div>
</div>
</div>
</div>
The solution was to use flexbox.
#experience_content {
margin: 0 auto;
min-height: 100vh;
width: min-content;
}
.row {
display: flex;
}
.column {
color: black;
flex:33.3%;
padding: 20px;
}
and
<div id="experience">
<div id="experience_content">
<div class="row">
<div class="column">
</div>
</div>
</div>
</div>
Related
This is the current output of my code,
Here I want to position the minus icon to top left like this (I edited the following image using paint) ,
I have included my code below.Here I tried to set the position of the minus span to absolute and It going to the corner of the top.And I don't want it to happen.Is there any way to do this?, I really appreciate your help.I'm trying to do for whole day.
<div class="left-bar-sm">
<div class="left-bar-sm-header">
Quantity (0)
</div>
<div class="left-bar-sm-body">
<div class="left-bar-sm-nested">
<span>Samaposha</span>
<br>
<span>2 x Rs 28.00 = Rs 56.00</span>
<span style="float: right;"><i class="fas fa-minus-circle"></i> <i class="fas fa-trash"></i></span>
</div>
</div>
.left-bar-sm-header {
background-color: #333333;
width: auto;
height: 50px;
margin-top: 5px;
border: 1px solid #595E57;
text-align: center;
padding: 5px;
font-size: 18px;
overflow-x: auto;
}
.left-bar-sm-body {
height: 450px;
border: none;
border-bottom: 2px dashed #595E57;
overflow-x: auto;
}
.left-bar-sm-nested {
margin-top: 5px;
background-color: #333333;
border: 1px solid #595E57;
padding: 20px;
}
In this Case you can use CSS flex. I have slightly changed your HTML.
Try this:
.left-bar-sm {
background: #252525;
padding: 10px;
color: #fff;
}
.left-bar-sm-header {
background-color: #333333;
width: auto;
height: 50px;
margin-top: 5px;
border: 1px solid #595E57;
text-align: center;
padding: 5px;
font-size: 18px;
overflow-x: auto;
}
.left-bar-sm-body {
height: 450px;
border: none;
border-bottom: 2px dashed #595E57;
overflow-x: auto;
}
.left-bar-sm-nested {
display: flex;
flex-direction: column;
margin-top: 5px;
background-color: #333333;
border: 1px solid #595E57;
padding: 20px;
}
.left-bar-sm-nested > div {
display: flex;
justify-content: space-between;
}
.left-bar-sm-nested > div span {
line-height: 25px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet"/>
<div class="left-bar-sm">
<div class="left-bar-sm-header">
Quantity (0)
</div>
<div class="left-bar-sm-body">
<div class="left-bar-sm-nested">
<div>
<span>Samaposha</span>
<span style="float: right;"><i class="fas fa-minus-circle"></i><span>
</div>
<div>
<span>2 x Rs 28.00 = Rs 56.00</span>
<span><i class="fas fa-trash"></i></span>
</div>
</div>
</div>
</div>
You can wrap the text and right side icons in two divs.
Then using flex modify the layout to show left and right side.
.left-bar-sm-header {
background-color: #333333;
width: auto;
height: 50px;
margin-top: 5px;
border: 1px solid #595E57;
text-align: center;
padding: 5px;
font-size: 18px;
overflow-x: auto;
}
.left-bar-sm-body {
height: 450px;
border: none;
border-bottom: 2px dashed #595E57;
overflow-x: auto;
}
.left-bar-sm-nested {
color: #fff;
margin-top: 5px;
background-color: #333333;
border: 1px solid #595E57;
display:flex;
}
.right {
margin-left: auto;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 10px;
}
.left {
padding: 20px;
flex: 1;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet"/>
<div class="left-bar-sm">
<div class="left-bar-sm-header">
Quantity (0)
</div>
<div class="left-bar-sm-body">
<div class="left-bar-sm-nested">
<div class="left">
<span>Samaposha</span>
<br>
<span>2 x Rs 28.00 = Rs 56.00</span>
</div>
<div class="right"><i class="fas fa-minus-circle"></i> <i class="fas fa-trash"></i></div>
</div>
</div>
I work with dynamicaly created boxes, and i have issues that text are not fiting inside box.
EX:
My code:
HTML:
<div class="box" id="box98" style="width: 110px; height: 43px;">
<div class="machine-icon" id="machine98" style="background-color: green;">
<img src="https://via.placeholder.com/150/">
</div>
<div class="title-box">SOME WERY BIG DATA 1345135131421124</div>
<div class="desc-box">SUB DATAqfqwfqwf</div>
</div>
CSS:
.box {
background-color: #ccc;
margin: 10px;
border-radius: 10px;
text-align: center;
font-size: 10px;
}
.machine-icon {
vertical-align: middle;
float: left;
width: 40px;
height: 40px;
background-color: #808080;
border-radius: 20px;
margin: 2px;
}
.machine-icon > img {
margin-top: 25%;
width: 20px;
height: 20px;
}
.title-box {
color: #000;
font-size: 10px;
overflow: hidden;
font-weight: 600;
}
.desc-box {
color: #000;
}
So my idea was to not showing all text, just end, for example:
I try to use display: flex and justify-content: end; idea was, to add for title and sub title z-index: 1 and for image z-index: 2, and for box overflow: hidden;
But it's not working for me.
This could be done this way using white-space: nowrap; and direction: rtl;
.box {
background-color: #ccc;
margin: 10px;
border-radius: 10px;
text-align: center;
font-size: 10px;
}
.machine-icon {
vertical-align: middle;
float: left;
width: 40px;
height: 40px;
background-color: #808080;
border-radius: 20px;
margin: 2px;
}
.machine-icon>img {
margin-top: 25%;
width: 20px;
height: 20px;
}
.title-box {
color: #000;
font-size: 10px;
overflow: hidden;
font-weight: 600;
direction: rtl;
white-space: nowrap;
}
.desc-box {
color: #000;
}
<div class="box" id="box98" style="width: 110px; height: 43px;">
<div class="machine-icon" id="machine98" style="background-color: green;">
<img src="https://via.placeholder.com/150/">
</div>
<div class="title-box">SOME WERY BIG DATA 1345135131421124</div>
<div class="desc-box">SUB DATAqfqwfqwf</div>
</div>
Remove Height from your in the .box element.
the height should be Auto:
<div class="box" id="box98" style="width: 110px; **height: auto;**">
<div class="machine-icon" id="machine98" style="background-color: green;">
<img src="https://via.placeholder.com/150/">
</div>
<div class="title-box">SOME WERY BIG DATA 1345135131421124</div>
<div class="desc-box">SUB DATAqfqwfqwf</div>
</div>
How to make this div starts after the picture.
It starts from the beginning of the container.
I have added /float: left;/ in profile image.
enter image description here
HTML and CSS Code:
.profile{
border: 1px solid #ddd;
padding: 22px;
min-height: 150px;
}
.profile img{
max-width: 150px;
width: 100%;
float: left;
}
.profile #details{
margin-left: 50px;
}
<section class="profile">
<img src="https://www.sonypark360.net/wp-content/uploads/2017/08/profile-pictures.png" alt="profile">
<div id="details">
<h1>Name</h1>
<h2>Age</h2>
<h3>City, Country</h3>
</div>
</section>
This code should work for you
.my-profiles {
border: 1px solid #b2cbe3;
padding: 22px;
font-family: arial;
display: inline-block;
}
.my-profiles img{
max-width: 100px;
width: 100%;
border-radius: 50%;
float: left;
}
.my-profiles .details {
overflow-x: hidden;
padding-top: 10px;
padding-left: 8px;
display: inline-block;
}
.my-profiles .details * {
margin: 0px;
font-size: 22px;
font-weight: 200;
}
<div class="my-profiles">
<img src="https://cdn.pixabay.com/photo/2016/08/08/09/17/avatar-1577909_960_720.png">
<div class="details">
<h2>Name</h2>
<h2>Age</h2>
<h2>City, Country</h2>
</div>
</div>
So my problem is pretty simple. I am creating a report that can be anywhere from one to 100 pages roughly. it is variable based on multiple factors. What I am having issues with is that I need to have a set footer on EVERY page. I can get the footer to sit where I need it to and look the way I want. HOWEVER, the div's I am using to display my content overflow behind my footer. So my question is simply how to I for any content that does not fit in the content div to overflow on the next page and not simply to fill the printable space? is this even possible?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
body {
background-color: #fff;
margin: 0px;
height: 278mm;
margin-bottom: 20mm;
}
.page {
width: 217mm;
height: 268mm;
}
footer {
bottom: 0;
height: 10mm;
background: black;
color: white;
width: 200mm;
position: fixed;
}
.whiteBox {
min-height: 5mm;
height: auto;
font-size: 3mm;
line-height: 2;
border-left: 1px solid #a95346;
border-bottom: 1px solid #a95346;
color: #000;
letter-spacing: 0.1mm;
float: left;
display: inline-block;
text-align: center;
}
.content {
width: 217mm;
height: 250mm;
font-family: 'Verdana';
display: inline-block;
background: #fff;
float: left;
}
.pb {
page-break-before: always;
}
#media print {
body {
background-color: #fff;
margin: 0px;
height: 278mm;
margin-bottom: 20mm;
}
.page {
width: 217mm;
height: 268mm;
}
footer {
bottom: 0;
height: 10mm;
background: black;
color: white;
width: 200mm;
position: fixed;
}
.whiteBox {
min-height: 5mm;
height: auto;
font-size: 3mm;
line-height: 2;
border-left: 1px solid #a95346;
border-bottom: 1px solid #a95346;
color: #000;
letter-spacing: 0.1mm;
float: left;
display: inline-block;
text-align: center;
}
.content {
width: 217mm;
height: 250mm;
font-family: 'Verdana';
display: inline-block;
background: #fff;
float: left;
}
.pb {
page-break-before: always;
}
}
</style>
</head>
<body>
<div class="page" style="border: 1px dotted;">
<div class="content" style="border: none">
<div class="whiteBox" style="width: 217mm; border: none;">
<div class="whiteBox" style="width: 217mm; border: none">Text ...</div>
<div class="whiteBox" style="width: 217mm; border: none">Text ...</div>
<div class="whiteBox" style="width: 217mm; border: none">Text ...</div>
</div>
</div>
<div class="pb"></div>
<div class="whiteBox" style="width: 217mm; border: none;">
<footer>
<p>Posted by: Hege Refsnes</p>
</footer>
</div>
</div>
</body>
</html>
Hello all I am trying to make a full-width bar of images, and when one image is hovered, I want text about that image to appear below the bar. So far I have the following html and css:
<div class="everything-container">
<div class="pic-container">
<img class="pic one" src="http://homeinspectioncarync.com/wp-content/uploads/2016/05/glenn-e1464714419457.jpg">
</div>
<div class="info-container">
<div class="name">
<p class="glenn name">Glenn</p>
</div>
<div class="title">
<p class="glenn title">Part Owner/ Senior Inspector</p>
</div>
<div class="bio">
<p class="glenn bio">My name is Glenn and I am amazing.</p>
</div>
</div>
</div>
.everything-container {
height: 500px;
width: 100%;
border: 2px solid black;
}
.pic-container {
width: 100%;
height: 100px;
border: 2px solid green;
}
.info-container {
width: 100%;
height: 400px;
border: 2px solid red;
}
.name {
height: 400px;
width: 25%;
border: 2px solid yellow;
float: left;
text-align: center;
font-size: 120%;
font-family: "Open Sans";
font-weight: bold;
color: black;
}
.title {
height: 400px;
width: 20%;
border: 2px solid blue;
float: left;
text-align: center;
font-size: 90%;
text-decoration: italic;
color: grey;
font-family: "Open Sans";
}
.bio {
height: 400px;
width: 55%;
border: 2px solid orange;
float: left;
font-size: 100%;
text-align: center;
color: black;
font-family: "Open Sans";
}
.pic {
height: 100px;
width: 100px;
float: left;
}
I gave one of my images the class of "one" and when i hover it i want anything with a class of "glenn" to appear. Using .one:hover .glenn { stuff } did not work. Is this possible to do? Thank you!
I'm afraid this is the closest you can get without javascript:
<div class="everything one">
<div class="image">
<img src="..." />
</div>
<div class="info">
Name
Title
Details
</div>
</div>
CSS:
.everything .info {
opacity: 0;
}
.everything:hover .info {
opacity: 1;
}
In order to make ".one:hover .glenn" work you need that everything with class 'glenn' to be inside of element with class 'one'.
If you are not able to achieve this you probably have to go with javascript.
.info-container {
display: none;
}
.pic-container:hover + .info-container {
display: block;
}
This is the easiest way:
Because you don't need JavaScript
Because it works with your HTML, no configuration needed.