How to mask "hr" line with rounded div - html

I need something look like this:
I have used the bootstrap framework. The line "hr" should not visible behind the circle div (as shown in the picture). Is it possible with css masking??
My code is below:
.container.bg {
background: url(https://image.shutterstock.com/z/stock-photo-silhouettes-of-colleagues-discussing-business-issue-in-dark-office-377738314.jpg);
background-size: cover;
}
.about-info {
padding-top:70px;
padding-bottom:90px;
position:relative
}
.about-info hr {
position:absolute;
width: 100%;
right: 15px;
left: 15px;
top: 40%;
z-index: 1;
}
.about-info .text {
width:100px;
height:100px;
background:rgba(153,153,153,0.5);
border-radius:100%;
text-align:center;
line-height:14;
margin:0 auto
}
.about-info .text span {
display: inline-block;
vertical-align: middle;
padding-right: 10px;
padding-left: 10px;
font-family:helverticacb;
color:#fff;
font-size:20px
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container bg">
<div class="row about-info">
<hr>
<div class="col-sm-4 col-xs-4"><div class="text pull-left"><span>Honesty</span></div></div>
<div class="col-sm-4 col-xs-4 text-center"><div class="text"><span>Transparency</span></div></div>
<div class="col-sm-4 col-xs-4"><div class="text pull-right"><span>Integrity</span></div></div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

Here is a solution that uses flex-box
you may want to tweak it some (note: that the flex widths and height may scale on differently on viewports of different sizes
.container.bg{
font-size:5em;
}
.flex-container {
min-height:5em;
background: url(https://image.shutterstock.com/z/stock-photo-silhouettes-of-colleagues-discussing-business-issue-in-dark-office-377738314.jpg);
background-size: cover;
display: flex;
/*makes the container a flex-box*/
flex-direction: row;
align-items: center;
/* centers the stuff V*/
}
.hr {
flex-grow: 2;
/* make the rules 2x the width as circles*/
height: 2px;
border: 1px solid #ccc;
}
.text {
font-family: impact;
font-size: .3em;
}
.about-info {
padding-top: 70px;
padding-bottom: 90px;
/*position: relative*/
width: 80px;
height: 80px;
background-color: rgba(255, 255, 255, .5);
border-radius: 100%;
text-align: center;
flex-grow: 1;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container bg">
<div class="flex-container">
<div class="about-info">
<div class="text "><span>Honesty</span>
</div>
</div>
<div class="hr"></div>
<div class="about-info">
<div class="text "><span>Transparency</span>
</div>
</div>
<div class="hr"></div>
<div class="about-info">
<div class="text "><span>Integrity</span>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

Have you considered using :after on .text? so something like:
.text:after {
content: '';
position: absolute;
top: 50px;
left: 115px;
display: block;
width: 210px;
border: 1px solid #fff;
}
And from there adjusat the width/height etc to get it looking it proper.
Take a look at the fiddle here: https://jsfiddle.net/mjwtL2ze/3/

(3 edits)
It's the opacity that prevents z-index from "working".
Note: z-index is doing its job, but if the top layer is transparent, you'll see under it.
.container.bg {
background: url(https://image.shutterstock.com/z/stock-photo-silhouettes-of-colleagues-discussing-business-issue-in-dark-office-377738314.jpg);
background-size: cover;
}
.about-info {
padding-top:70px;
padding-bottom:90px;
position:relative
}
.about-info hr {
position:absolute;
width: 100%;
right: 15px;
left: 15px;
top: 40%;
z-index: 0;
}
.about-info .text {
width:100px;
height:100px;
background:rgba(153,153,153,1);
border-radius:100%;
text-align:center;
line-height:14;
margin:0 auto
}
.about-info .text span {
display: inline-block;
vertical-align: middle;
padding-right: 10px;
padding-left: 10px;
font-family:helverticacb;
color:#fff;
font-size:20px
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container bg">
<div class="row about-info">
<hr>
<div class="col-sm-4 col-xs-4"><div class="text pull-left"><span>Honesty</span></div></div>
<div class="col-sm-4 col-xs-4 text-center"><div class="text"><span>Transparency</span></div></div>
<div class="col-sm-4 col-xs-4"><div class="text pull-right"><span>Integrity</span></div></div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
EDIT #2:
Perhaps you can make the hr's opacity the same?
.container.bg {
background: url(https://image.shutterstock.com/z/stock-photo-silhouettes-of-colleagues-discussing-business-issue-in-dark-office-377738314.jpg);
background-size: cover;
}
.about-info {
padding-top:70px;
padding-bottom:90px;
position:relative
}
.about-info hr {
position:absolute;
width: 100%;
right: 15px;
left: 15px;
top: 40%;
z-index: 0;
background-color: rgba(153,153,153,0.1);
color: rgba(153,153,153,0.1);
height: 5px;
}
.about-info .text {
width:100px;
height:100px;
background:rgba(153,153,153,0.9);
border-radius:100%;
text-align:center;
line-height:14;
margin:0 auto
}
.about-info .text span {
display: inline-block;
vertical-align: middle;
padding-right: 10px;
padding-left: 10px;
font-family:helverticacb;
color:#fff;
font-size:20px
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container bg">
<div class="row about-info">
<hr>
<div class="col-sm-4 col-xs-4"><div class="text pull-left"><span>Honesty</span></div></div>
<div class="col-sm-4 col-xs-4 text-center"><div class="text"><span>Transparency</span></div></div>
<div class="col-sm-4 col-xs-4"><div class="text pull-right"><span>Integrity</span></div></div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
EDIT #3: use 2 <hr> instead of 1.
.container.bg {
background: url(https://image.shutterstock.com/z/stock-photo-silhouettes-of-colleagues-discussing-business-issue-in-dark-office-377738314.jpg);
background-size: cover;
}
.about-info {
padding-top:70px;
padding-bottom:90px;
position:relative
}
hr {
position:absolute;
width: auto;
right: 5px;
left: 20px;
top: 30px;
color: red;
background-color: red;
color: red;
height: 2px;
border: 0;
}
.text {
width:100px;
height:100px;
background:rgba(153,153,153,0.9);
border-radius:100%;
text-align:center;
line-height:14;
margin:0 auto;
}
.text span {
display: inline-block;
vertical-align: middle;
padding-right: 10px;
padding-left: 10px;
font-family:helverticacb;
color:#fff;
font-size:20px
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container bg">
<div class="row about-info">
<div class="col-xs-2 col-xs-offset-1">
<div class="text pull-left">
<span>lorem</span>
</div>
</div>
<div class="col-xs-2">
<hr>
</div>
<div class="col-xs-2">
<div class="text text-center">
<span>lorem</span>
</div>
</div>
<div class="col-xs-2">
<hr>
</div>
<div class="col-xs-2">
<div class="text pull-right">
<span>lorem</span>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

Related

Div Blocks under each other in mobile version

There are 3 block different size in a row. How can I make them responsive, because in mobile version they overlay at each other.
.watch {
position: absolute;
bottom: 0;
left: 50px;
width: 224px;
height: 69px;
cursor: pointer;
background-color: #918A83;
opacity: 0.85;
}
.watch-elements {
margin: 20px 20px;
}
.watch p {
display: inline-block;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #fff;
}
.mouse {
position: absolute;
bottom: 0;
border: 1px solid #DAD3CC;
width: 577px;
height: 69px;
cursor: pointer;
background-color: #fff;
}
.mouse-elements {
text-align: center;
margin-top: 10px;
}
.mouse p {
display: inline-block;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #000;
}
.chat-bot {
position: absolute;
bottom: 20px;
background-color: #09A753;
border-radius: 100px;
right: 100px;
width: 227px;
height: 39px;
cursor: pointer;
}
.chat-bot img {
margin-top: -20px;
margin-left: -15px;
}
.chat-bot p {
display: flex;
justify-content: center;
text-align: center;
margin-top: -15px;
flex-direction: row;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #fff;
}
#media all and (max-width: 1024px) {
.watch img {
position: absolute;
float: left;
left: 0;
}
.watch p {
margin-left: 20px;
}
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="container mt-5">
<h2 class="header-text">Practical business advice and knowhow<br>customized to your needs</h2>
</div>
</div>
<div class="d-flex justify-content-left">
<div class="watch">
<div class="watch-elements">
<img src="assets/img/icons/icon2.svg">
<p>Watch Presenation</p>
</div>
</div>
</div>
<div class="d-flex justify-content-center">
<div class="mouse">
<div class="mouse-elements">
<img src="assets/img/icons/Icon1.svg"><br>
<p>Scroll Down</p>
</div>
</div>
</div>
<div class="d-flex justify-content-right">
<div class="chat-bot">
<img src="assets/img/06w.png">
<p>Hi, can I help you?</p>
<img src="assets/img/icons/icon3.svg" style="float: right; margin-right: -60px; margin-top: -39px;">
</div>
</div>
</div>
Now, they arrange in a row as on image
In mobile version left block disappears and I can not see it, also second and third block overlay at each other.
For mobile devices please try position: relative instead of position: absolute. Don't forget to adjust other CSS values as per your requirements. Hope this will solve your issues
#media all and (max-width: 767px) {
.watch, .mouse, .chat-bot{
position:relative;
right:auto;
left:auto;
top:auto;
bottom:auto;
margin:5px 0
}
}
I have put all the elements inside a div with class footer. and used bootstrap flex css properties to align it. Hope its helps you. thanks
.watch {
width: 224px;
height: 69px;
cursor: pointer;
background-color: #918A83;
opacity: 0.85;
}
.watch-elements {
margin: 20px 20px;
}
.watch p {
display: inline-block;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #fff;
}
.mouse {
border: 1px solid #DAD3CC;
width: 577px;
height: 69px;
cursor: pointer;
background-color: #fff;
}
.mouse-elements {
text-align: center;
margin-top: 10px;
}
.mouse p {
display: inline-block;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #000;
}
.chat-bot {
background-color: #09A753;
border-radius: 100px;
right: 100px;
width: 227px;
height: 39px;
cursor: pointer;
}
.chat-bot img {
margin-top: -20px;
margin-left: -15px;
}
.chat-bot p {
display: flex;
justify-content: center;
text-align: center;
margin-top: -15px;
flex-direction: row;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #fff;
}
#media all and (max-width: 1024px) {
.watch img {
position: absolute;
float: left;
left: 0;
}
.watch p {
margin-left: 20px;
}
}
.footer {
position: absolute;
bottom: 0;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="container mt-5">
<h2 class="header-text">Practical business advice and knowhow<br>customized to your needs</h2>
</div>
</div>
<div class="d-flex footer justify-content-sm-center align-content-between flex-sm-wrap flex-lg-nowrap">
<div class="d-flex justify-content-left">
<div class="watch">
<div class="watch-elements">
<img src="assets/img/icons/icon2.svg">
<p>Watch Presenation</p>
</div>
</div>
</div>
<div class="d-flex justify-content-center">
<div class="mouse">
<div class="mouse-elements">
<img src="assets/img/icons/Icon1.svg"><br>
<p>Scroll Down</p>
</div>
</div>
</div>
<div class="d-flex justify-content-right align-items-center">
<div class="chat-bot">
<img src="assets/img/06w.png">
<p>Hi, can I help you?</p>
<img src="assets/img/icons/icon3.svg" style="float: right; margin-right: -60px; margin-top: -39px;">
</div>
</div>
</div>
</div>
you can try replacing your existing divs with the below ones
<div class="d-flex justify-content-left col-lg-3 col-md-6 col-xs-12">
<div class="d-flex justify-content-center col-lg-3 col-md-6 col-xs-12">
<div class="d-flex justify-content-right col-lg-3 col-md-6 col-xs-12">
position:absolute and related properties are not suitable for this function. You can use CSS flexbox layout
For more information use this link: Complete Guide to Flexbox
I explain simple usage of flexbox layout using example:
#wrapper{display:flex;flex-wrap:wrap;justify-content:space-between}
/*just for styles*/
#wrapper div{background-color:#f5f5f5;text-align:center;padding:2px 5px;margin:2px}
#e3{width:200px}
<div id="wrapper">
<div id="e1">element 1</div>
<div id="e2">element 2</div>
<div id="e3">element 3</div>
<div id="e4">element 4</div>
</div>
Also with flex layout you can manipulate elements places based on viewport size with order property.

How to keep position of image when text is changing?

Trying to position my image without changing the position. When the wind text is turned off(js not working in codepen btw. ) ie not displayed under the temperature, the weatherimage is moving up. I tried to position this 'absolute' but not helping.
I am using reactjs to display the Widget on the right:
<div className="widget">
<div className="row">
<div className="col-lg-12 title">{title}</div>
</div>
<div className="row widgettop">
<div className="col-lg-6 topicon">
<img src={'http://openweathermap.org/img/w/' + icon + '.png'}></img>
</div>
<div className="col-lg-6 topdegrees">
{location}
<div className='degrees'>{degrees}°</div>
{wind && <div>Wind{' '}<span className='wind'>{speed}</span> {unitsType === 'metric' ? <span>km/h</span> : <span>mph</span>}</div>}
</div>
</div>
</div>
Based on the state.wind I display the wind details or not.
How can I keep the image in position when the Wind text/ other content is removed/changed?
codepen here
You can toggle the visibility property for the wind area using JS. The image holds its place when I added visibility: hidden to say #windArea - you can toggle between visible and hidden:
body {
margin: 0;
padding: 0;
font-family: sans-serif;
font-family: Lucida Grande;
}
input,
label {
display: block;
}
#tempArea input,
#tempArea label {
display: inline;
margin-bottom: 10px;
}
#windArea input,
#windArea label {
display: inline;
margin-bottom: 10px;
}
div#main {
background: #F2F2F2;
padding: 1vw 2vw;
width: 48%;
}
.spaceradio {
margin-right: 10px;
}
img {
width: 84% !important;
height: 100% !important;
margin-left: 20%;
position: relative;
}
.divider {
border-left: 1px solid lightgrey;
}
.widget {
box-shadow: 1px 2px 1px lightgray;
background-color: white;
margin-left: 10px;
height: 100%;
width: 90%;
position: absolute;
}
.title {
margin-left: 30px;
padding: 10px;
position: absolute;
}
.left {
margin-left: 20px;
padding: 10px;
vertical-align: top;
}
.text {
height: 40px;
width: 100%;
}
.top {
margin-top: 15px;
}
.widgettop {
margin-top: 15px;
}
.topdegrees {
margin-top: 40px;
}
.topicon {
margin-top: 20px;
}
.degrees {
font-size: xx-large;
font-weight: bold;
}
.wind {
font-size: small;
font-weight: bold;
}
.hline {
border-top: 4px solid blue;
padding: 0 !important;
margin-bottom: 10px;
width: 48%;
}
/* .abs
{
position: absolute;
} */
#windArea { /* ADDED */
visibility: hidden;
}
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<div class="left">
<hr class="container hline">
<div id="main" class="container border">
<div class="row">
<div class="col-lg-6 top"><label for="title">Title</label><input id="title" type="text" placeholder=" Title of widget" name="title" class="text" value="">
<div class="top"><label for="radio">Temperature</label>
<div id="tempArea" class="row"><span class="col-lg-6"><input type="radio" id="one" class="spaceradio" value="metric" checked=""><label for="one">℃</label></span><span class="col-lg-6"><input type="radio" id="two" class="spaceradio" value="imperial"><label for="two">℉</label></span></div>
</div>
<div class="top"><label for="radio">Wind</label>
<div id="windArea" class="row"><span class="col-lg-6"><input type="radio" id="one" class="spaceradio" value="true"><label for="one">On</label></span><span class="col-lg-6"><input type="radio" id="two" class="spaceradio" value="false" checked=""><label for="two">Off</label></span></div>
</div>
</div>
<div class="col-lg-6 divider top">
<div class="widget">
<div class="row">
<div class="col-lg-12 title">FDSFSDFDSFDSFDS</div>
</div>
<div class="row widgettop">
<div class="col-lg-6 topicon"><img src="http://openweathermap.org/img/w/09d.png"></div>
<div class="col-lg-6 topdegrees abs">Paramatta
<div class="degrees">58.12°</div>
<div>Wind <span class="wind">23.04</span> <span>mph</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

Hide text that is outside div

I'm trying to create the design above. This is what I've achieved so far, but I'm using fixed height.
https://jsfiddle.net/iDaniel19/b0LL5wj8/1/
<div class="container">
<div class="row event">
<div class="col-xs-3 col-sm-2 col-md-1 event-date">
<h3>9</h3>
<h3>May</h3>
</div>
<div class="col-xs-9 col-sm-10 col-md-1 no-padding-left event-info">
<div class="event-info-title">
<h4>Title</h4>
</div>
<div class="event-info-tl">
<div class="event-info-tl-text">
<p><span class="glyphicon glyphicon-time" aria-hidden="true"></span> Time</p>
<p><span class="fa fa-map-marker" aria-hidden="true"></span>Post code</p>
</div>
<div class="event-info-tl-icon">
<p class="event-icon"><span class="fa fa-chevron-right" aria-hidden="true"></span></p>
<div style="clear: both;"></div>
</div>
</div>
</div>
</div>
How do I make sure that the text remains on one line and is not displayed outside?
E.g. on the image above, the bottom line (time and location) will not fit on a mobile device and will break outside the container
Is this the right approach to code that image?
updated fiddle
Try doing it in the following way-- it won't break in small devices rather a new row will be created.
.body {
font-family: 'Open Sans';
}
.no-padding-left {
padding-left:0;
}
.float-right {
float:right;
}
.event{
height:70px;
}
.event-date {
border-right: 1px solid black;
text-align: center;
}
.event-date > h3 {
font-weight: bold;
text-transform: uppercase;
padding:0;
margin:0;
line-height: 34px;
}
.event-info-title {
height: 35px;
}
.event-info-title > h4{
padding: 0 0 0 5px;
font-weight: 600;
letter-spacing: 2px;
text-transform: uppercase;
margin:0;
top:25%;
position: relative;
}
.event-info-tl {
height: 35px;
border-top: 1px solid black;
}
.event-info-tl > div {
display: inline-block;
}
.event-info-tl-text {
top:25%;
position: relative;
}
.event-info-tl-text > p {
display: inline-block;
margin: 0;
}
.event-info-tl-text > p:first-child{
padding-left: 5px;
}
.event-info-tl-icon {
float:right;
margin:0;
}
.event-icon {
padding:5px;
font-size: 20px;
margin:0;
}
#media (max-width: 576px) {
.container {
padding:0;
}
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div class="container">
<div class="row event">
<div class="col-xs-3 col-sm-2 col-md-1 event-date">
<h3>9</h3>
<h3>May</h3>
</div>
<div class="col-xs-9 col-sm-10 col-md-1 no-padding-left event-info">
<div class="event-info-title">
<h4>Title</h4>
</div>
<div class="event-info-tl ">
<div class="event-info-tl-text ">
<div class="col-xs-12 col-sm-6">
<p><span class="glyphicon glyphicon-time" aria-hidden="true"></span> Time</p>
</div>
<div class="col-xs-12 col-sm-6">
<p><span class="fa fa-map-marker" aria-hidden="true"></span>Post code</p>
</div>
</div>
<div class="event-info-tl-icon">
<p class="event-icon"><span class="fa fa-chevron-right" aria-hidden="true"></span></p>
<div style="clear: both;"></div>
</div>
</div>
</div>
</div>
</div>
You can use top/bottom padding to create space above/below the title/time/postcode text and remove the fixed height. Absolutely position the right arrow. And use white-space: nowrap on the container for the 2 lines of text that you don't want to break.
.body {
font-family: 'Open Sans';
}
.no-padding-left {
padding-left: 0!important;
}
.float-right {
float: right;
}
.event-date {
border-right: 1px solid black;
text-align: center;
}
.event-date > h3 {
font-weight: bold;
text-transform: uppercase;
padding: 0;
margin: 0;
line-height: 34px;
}
.event-info-title,
.event-info-tl {
padding: .5em 0;
}
.event-info-title > h4 {
padding: 0 0 0 5px;
font-weight: 600;
letter-spacing: 2px;
text-transform: uppercase;
margin: 0;
top: 25%;
position: relative;
}
.event-info-tl {
border-top: 1px solid black;
position: relative;
overflow: hidden;
}
.event-info-tl > div {
display: inline-block;
}
.event-info-tl-text {
top: 25%;
position: relative;
white-space: nowrap;
}
.event-info-tl-text > p {
display: inline-block;
margin: 0;
}
.event-info-tl-text > p:first-child {
padding-left: 5px;
}
.event-info-tl-icon {
position: absolute;
top: .5em;
right: 0;
}
.event-icon {
font-size: 20px;
margin: 0;
}
#media (max-width: 576px) {
.container {
padding: 0;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="container">
<div class="row event">
<div class="col-xs-3 col-sm-2 col-md-1 event-date">
<h3>9</h3>
<h3>May</h3>
</div>
<div class="col-xs-9 col-sm-10 col-md-1 no-padding-left event-info">
<div class="event-info-title">
<h4>Title</h4>
</div>
<div class="event-info-tl">
<div class="event-info-tl-text">
<p><span class="glyphicon glyphicon-time" aria-hidden="true"></span> Time</p>
<p><span class="fa fa-map-marker" aria-hidden="true"></span> Post code</p>
</div>
<div class="event-info-tl-icon">
<p class="event-icon"><span class="fa fa-chevron-right" aria-hidden="true"></span></p>
<div style="clear: both;"></div>
</div>
</div>
</div>
</div>
</div>
What about hidden it using overflow? I added the last these two classes :
.event-info-tl-text{width:90%; line-height: 1.1em; height: 1.1em; overflow:hidden;white-space: nowrap;}
.event-info-tl-icon{width:5%}
Here you have a fiddle.

CSS alignment of columns with multiple rows

I have the following snippet
.striped {
height : 30px;
margin-right: 1px !important;
background: repeating-linear-gradient(-45deg,#E4003D,#E4003D 10px,#222 10px,#222 20px)!important;
}
.content{
height : 100%;
}
.mymedia {
font-size: 1.5vh !important;
color: #fff;
text-align: justify;
-ms-text-justify: inter-word;
text-justify: inter-word;
border-color: #E4003D;
font-weight: normal !important;
background-color:#363636 !important;
background: repeating-linear-gradient( -45deg, #111 2px, #222 3px, #222 4px, #111 7px)!important;
}
.rightpadding{
margin-right: 1px !important;
}
.top-buffer {
margin-top:13px;
overflow: hidden;
}
.bottom {
vertical-align: bottom;
bottom: 0 !important;
}
.nolrpadding{
padding-left: 0 !important;
padding-right: 0 !important;
}
.mymedia > p {
margin-left: 5vw !important;
margin-right: 5vw !important;
}
* {
-webkit-border-radius: 0 !important;
-moz-border-radius: 0 !important;
border-radius: 0 !important;
}
.square-box{
position: relative;
width: 95%;
overflow: hidden;
font-size: 2vh !important;
font-weight: bold !important;
background: repeating-linear-gradient( -45deg, #E4003D 2px, #D6003D 3px, #D6003D 4px, #E4003D 7px)!important;
}
.square-box:before{
content: "";
display: block;
padding-top: 100%;
}
.square-content{
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
color: white;
}
.square-content div {
display: table;
width: 100%;
height: 100%;
}
.square-content span {
display: table-cell;
text-align: center;
vertical-align: middle;
color: white;
}
.noRightMargin {
margin-right: 0 !important;
}
.noLeftMargin {
margin-left: 0 !important;
}
.row [class*="col-"]{
margin-bottom: -99999px;
padding-bottom: 99999px;
}
.row{
overflow: hidden;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="css/main.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<div class="row" style="margin-top:5%; margin-bottom: 10px;">
</div>
<div class="row">
<div class="col-xs-5">
<!-- <div class="row rightpadding"> -->
<div class="row striped"></div>
<div class="row rightpadding">
<div class="media mymedia">
<img src="images/Mission/cluster.png" class="img-responsive">
<p>
asas
</p>
</div>
</div>
<div class="row striped bottom"></div>
<!-- </div> -->
</div>
<div class="col-xs-7">
<div class="row noRightMargin">
<div class="col-xs-4 nolrpadding">
<div class='square-box'>
<a href="http://sky.esa.int/" data-internal="false">
<div class="square-content"><div><span>xxx</span></div></div></a>
</div>
</div>
<div class="col-xs-4 nolrpadding">
<div class='square-box'>
<a href="https://twitter.com/ESAscience" data-internal="false">
<div class="square-content"><div><span>xxx</span></div></div></a>
</div>
</div>
<div class="col-xs-4 nolrpadding">
<div class='square-box'>
<a href="#" data-internal="false">
<div class="square-content"><div><span>xxx</span></div></div></a>
</div>
</div>
</div>
<div class="row top-buffer noRightMargin">
<div class="col-xs-4 nolrpadding">
<div class='square-box'>
<a href="http://helioviewer.org/" data-internal="true">
<div class="square-content"><div><span>xxx</span></div></div></a>
</div>
</div>
<div class="col-xs-4 nolrpadding">
<div class='square-box'>
<a href="EXE" data-prog=" O:\Projects\xdisk\projects\ESAC-SOSR\Work\WP1000 - Visualization tool\wwt-windows-client\WWTExplorer3d\bin\gaiasandbox\gaiasandbox.exe" data-args="scripts\tests\Rosetta.py">
<div class="square-content"><div><span>xxx</span></div></div></a>
</div>
</div>
</div>
</div>
<!-- <div class="col-xs-3"></div> -->
</div>
</div>
</html>
the problem that I have is the bottom alignments in the two columns, as shown in the image
I have seen fixes for column vertical alignments but it seems that they do not work here, so how can I align the bottom of the three rows within the first column with the next column?
thanks in advance,
es.
UPDATE
I would like it to look something like this with the bottom strip row being vertically aligned with the bottom of the red box.
managed to do what you wanted with just a little jq . hope you don't mind
check here jsfiddle
css code added : .mymedia { height:100%;}
jq code added :
var result = $(".col-xs-7").height() - $(".row.striped").height()*2
$(".row.rightpadding").height(result)
result = height of the right col - the heights of both striped rows ( which are equal i presume )
then add that height to the middle row ( .row.rightpadding )
let me know if it helps.
You should be able to achieve what you want by using absolute positioning, with fixed top and bottom so that the left column elements are "snapped" to the height of the row.
Try the snippet below.
.striped {
height: 30px;
background: repeating-linear-gradient(-45deg, #E4003D, #E4003D 10px, #222 10px, #222 20px)!important;
position: absolute;
left: 0;
right: 15px;
}
.content {
height: 100%;
}
.mymedia {
font-size: 1.5vh !important;
color: #fff;
text-align: justify;
-ms-text-justify: inter-word;
text-justify: inter-word;
border-color: #E4003D;
font-weight: normal !important;
background-color: #363636 !important;
background: repeating-linear-gradient( -45deg, #111 2px, #222 3px, #222 4px, #111 7px)!important;
top: 30px;
bottom: 30px;
left: 0;
right: 15px;
position: absolute;
margin-top: 0 !important;
}
.top-buffer {
margin-top: 13px;
overflow: hidden;
}
.bottom {
bottom: 0 !important;
}
.nolrpadding {
padding-left: 0 !important;
padding-right: 0 !important;
}
.mymedia > p {
margin-left: 5vw !important;
margin-right: 5vw !important;
}
* {
-webkit-border-radius: 0 !important;
-moz-border-radius: 0 !important;
border-radius: 0 !important;
}
.square-box {
position: relative;
width: 95%;
overflow: hidden;
font-size: 2vh !important;
font-weight: bold !important;
background: repeating-linear-gradient( -45deg, #E4003D 2px, #D6003D 3px, #D6003D 4px, #E4003D 7px)!important;
}
.square-box:before {
content: "";
display: block;
padding-top: 100%;
}
.square-content {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
color: white;
}
.square-content div {
display: table;
width: 100%;
height: 100%;
}
.square-content span {
display: table-cell;
text-align: center;
vertical-align: middle;
color: white;
}
.noRightMargin {
margin-right: 0 !important;
}
.noLeftMargin {
margin-left: 0 !important;
}
.row {
overflow: hidden;
position: relative;
}
.myLeftCol {
bottom: 0;
padding-left: 0 !important;
position: absolute !important;
top: 0;
}
.myRightCol {
margin-left: 41.6667%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="css/main.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<div class="row" style="margin-top:5%; margin-bottom: 10px;">
</div>
<div class="row">
<div class="col-xs-5 myLeftCol">
<div class="striped"></div>
<div class="media mymedia">
<img src="images/Mission/cluster.png" class="img-responsive">
<p>
asas
</p>
</div>
<div class="striped bottom"></div>
</div>
<div class="col-xs-7 myRightCol">
<div class="row noRightMargin">
<div class="col-xs-4 nolrpadding">
<div class='square-box'>
<a href="http://sky.esa.int/" data-internal="false">
<div class="square-content">
<div><span>xxx</span>
</div>
</div>
</a>
</div>
</div>
<div class="col-xs-4 nolrpadding">
<div class='square-box'>
<a href="https://twitter.com/ESAscience" data-internal="false">
<div class="square-content">
<div><span>xxx</span>
</div>
</div>
</a>
</div>
</div>
<div class="col-xs-4 nolrpadding">
<div class='square-box'>
<a href="#" data-internal="false">
<div class="square-content">
<div><span>xxx</span>
</div>
</div>
</a>
</div>
</div>
</div>
<div class="row top-buffer noRightMargin">
<div class="col-xs-4 nolrpadding">
<div class='square-box'>
<a href="http://helioviewer.org/" data-internal="true">
<div class="square-content">
<div><span>xxx</span>
</div>
</div>
</a>
</div>
</div>
<div class="col-xs-4 nolrpadding">
<div class='square-box'>
<a href="EXE" data-prog=" O:\Projects\xdisk\projects\ESAC-SOSR\Work\WP1000 - Visualization tool\wwt-windows-client\WWTExplorer3d\bin\gaiasandbox\gaiasandbox.exe" data-args="scripts\tests\Rosetta.py">
<div class="square-content">
<div><span>xxx</span>
</div>
</div>
</a>
</div>
</div>
</div>
</div>
<!-- <div class="col-xs-3"></div> -->
</div>
</div>
</html>
Wrap everything in a <div>, and set the childs to have min-height: 100%

How do I fix a floating div inside another div?

I don't really know how to put it in words but I do have pictures which will quite give you an idea of my problem. Seems like float is giving me the problem/
This is what I am trying to accomplish:
This is my problem:
Here's the code:
body {
background: #C52C2C;
}
.images div {
width: 300px;
height: 300px;
background-color: white;
margin: 0 auto;
float: left;
margin: 2px;
}
#portfolio {
overflow: auto;
clear: both;
heigth: 400px;
background-color: #c62828;
}
<div class="images">
<!-- Top Boxes -->
<div class="box-1 left"></div>
<div class="box-2 left"></div>
<div class="box-3 left"></div>
<!-- Bottom Boxes -->
<div class="box-4 left"></div>
<div class="box-5 left"></div>
<div class="box-6 left"></div>
</div>
What I would like to do is change the height of the portfolio section but when I change the height, nothing changes. If I remove the boxes then I can change the height. How would I fix this?
Thank you if you well understood this.
That is because of impropper value of the display property for View More element. You should set it to be:
view_more{ display: block; } // Please replace **view_more** with the correct value to select the element
Also do that for the downward arrow.
Do you mean something like this?
https://jsfiddle.net/xsjjo654/1/
Code Sample:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body, html {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
font-family: sans-serif;
}
h1.title {
text-align: center;
color: white;
font-size: 40pt;
margin: 5px auto;
}
#portfolio {
overflow: auto;
clear: both;
min-height: 400px;
width: 100%;
background-color: #c62828;
text-align: center;
}
#portfolio > .wrapper {
display: table;
width: 100%;
}
#portfolio > .wrapper > section {
display: table-cell;
vertical-align: middle;
}
section.side-left {
text-align: right;
}
section.side-right {
text-align: left;
}
section.side-center {
width: 930px;
}
.images {
display: inline-block;
}
.images .box {
width: 300px;
height: 300px;
background-color: white;
display: inline-block;
float: left;
margin: 1px;
}
.button {
cursor: pointer;
background: transparent;
outline: 0;
border: none;
}
.button.round, .button.round-alt {
border-radius: 50%;
width: 40px;
height: 40px;
font-size: 30px;
}
.button.round {
background-color: white;
color: #c62828;
}
.button.round-alt {
border: 2px solid white;
color: white;
margin: 30px;
}
.button.square {
border: 2px solid white;
color: white;
font-size: 14pt;
padding: 12px 30px;
margin: 40px auto;
}
/* (c) 2016 David#Refoua.me, www.Refoua.me */
</style>
</head>
<body>
<div id="portfolio">
<h1 class="title">
Portfolio
</h1>
<div class="wrapper">
<section class="side-left">
<button class="button round prev">
←
</button>
</section>
<section class="side-center">
<div class="images">
<!-- Top Boxes -->
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<br>
<!-- Bottom Boxes -->
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
</section>
<section class="side-right">
<button class="button round prev">
→
</button>
</section>
</div>
<button class="button square more">
View More...
</button>
<br>
<button class="button round-alt down">
↓
</button>
</div>
</body>
Try Bootstrap. It let's you play around with some cool grid functionality AND it's RESPONSIVE!
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
rel="stylesheet">
<style>
.inner {
height:350px;
background-color:white;
margin-top:5px;
margin-left:-25px;}
body {background-color:red;}
</style>
<body>
<div class='container'>
<div class='row'>
<div class='col-md-4'>
<div class='inner'></div>
<div class='inner'></div>
</div>
<div class='row'>
<div class='col-md-4'>
<div class='inner'></div>
<div class='inner'></div>
</div>
<div class='row'>
<div class='col-md-4'>
<div class='inner'></div>
<div class='inner'></div>
</div>
</div>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/
3.3.6/js/bootstrap.min.js"> </script>
Output: http://s28.postimg.org/9y69346tp/test.png You can add more rows later if you're going to refresh your pictures from database automatically.
Hope that helps! Cheers!
if you give a width to images and margin:auto it should center much easier :)
body {
background: #C52C2C;
}
.images {
width:912px;
margin:auto;
}
.images div {
width: 300px;
height: 300px;
background-color: white;
margin: 0 auto;
float: left;
margin: 2px;
}
#portfolio {
overflow: auto;
clear: both;
heigth: 400px;
background-color: #c62828;
}
<div class="images">
<!-- Top Boxes -->
<div class="box-1 left"></div>
<div class="box-2 left"></div>
<div class="box-3 left"></div>
<!-- Bottom Boxes -->
<div class="box-4 left"></div>
<div class="box-5 left"></div>
<div class="box-6 left"></div>
</div>
use this: clearfix
The problem here is that your container doesn't take the height of the inner boxes in consideration, so if you add the clearfix to it that will do the trick