Three inline div height responsiveness is not working on Firefox [closed] - html

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 5 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
On my website I have 3 responsive divs inline, that remain all the same size. I developed it on a 15" MacBook Pro & it works perfectly on Safari, Chrome & Firefox (on Mac). See image below:
But I'm building it for my friend and he keeps telling saying that when he goes to the website on his Microsoft computer the divs wont maintain the same height and look like the following:
I've tried so many different things and especially because I cannot replicate the problem on my MacBook, I'm finding it really hard to root out the problem. What is going wrong here?
.flexbox {
display: flex;
}
.trip {
background-color: white;
margin-bottom: 10px;
padding-bottom: 5px;
max-height: 230px;
overflow-x: scroll;
white-space: nowrap;
}
<div class="container flexbox" style="width:100%; background-color:#205ba0; padding:30px;">
<div class="col-md-offset-3 col-md-2" align="center" style="color:white; border:2px solid white; font-size:12px; padding:10px;">
<div class="trip">
<img src="http://localhost/property_abba/wp-content/uploads/2017/05/rent.png" style="height:100px;">
</div>
<h2 style="font-weight:bold;">Renting? Landlords welcome.</h2>
A swift liason between landlords and tenants as a fair, independeant party, is just one of our services.<br><br>
Find out more >
</div>
<div class="col-md-2" align="center" style="color:white; border:2px solid white; font-size:12px; padding:10px;">
<div class="trip">
<img src="http://localhost/property_abba/wp-content/uploads/2017/05/val.png" style="height:100px;">
</div>
<h2 style="font-weight:bold;">Valuation? Sorted quickly.</h2>
Providing some of the most effecient valuations in town, we're here to help you sort out an important step.<br><br>
Find out more >
</div>
<div class="col-md-2" align="center" style="color:white; border:2px solid white; font-size:12px; padding:10px;">
<div class="trip">
<img src="http://localhost/property_abba/wp-content/uploads/2017/05/sale.png" style="height:100px;">
</div>
<h2 style="font-weight:bold;">Selling? Now uncomplicated.</h2>
We aim to make selling easy. Our trained estate agents are constantly available to help.<br><br>
Find out more >
</div>
</div>

o.k - because it is hard to point out your exact problem due to reasons like a change in the runtime environment & a mix of html and css styling while using bootstrap I took the liberty of cleaning your code & making use of the bootstrap grid system ...
iv'e added some elements , removed the flexbox & moved all of your styling to css to make it easier for you to see the separation and for others to help you ...
the result is pretty much the same except that i changed the number of columns that each "box" occupies due to the text flowing out of the div when the boxes take up 3 columns (BTW this also occurred with your previous code on smaller screens) so I encapsulated half of the heading (the statements after the question mark) in smaller heading tags (<h5>) and now it changes the size before it has a chance to overflow ...
now you can keep playing around with the grid system until you reach the desired result ...
HTML:
<div id="maincontainer" class="container-fluid row">
<div id="box1" class="col-md-4 col-sm-4 col-xs-4">
<div class="trip">
<img src="http://localhost/property_abba/wp-content/uploads/2017/05/rent.png" alt="">
</div>
<h3>Renting? <h5>Landlords welcome.</h5></h3>
<p>A swift liason between landlords and tenants as a fair, independeant party, is just one of our services.</p>
<br><br>
Find out more >
</div>
<div id="box2" class="col-md-4 col-sm-4 col-xs-4">
<div class="trip">
<img src="http://localhost/property_abba/wp-content/uploads/2017/05/val.png" alt="">
</div>
<h3>Valuation? <h5>Sorted quickly.</h5></h3>
<p>Providing some of the most effecient valuations in town, we're here to help you sort out an important step.</p><br><br>
Find out more >
</div>
<div id="box3" class="col-md-4 col-sm-4 col-xs-4">
<div class="trip">
<img src="http://localhost/property_abba/wp-content/uploads/2017/05/sale.png" alt="">
</div>
<h3>Selling? <h5>Now uncomplicated.</h5></h3>
<p>We aim to make selling easy. Our trained estate agents are constantly available to help.</p><br><br>
Find out more >
</div>
</div>
CSS:
h2{
font-weight:bold;
}
a{
color:white;
}
img{
height:100px;
}
.trip {
background-color: white;
margin-bottom: 10px;
padding-bottom: 5px;
max-height: 230px;
}
#maincontainer{
background-color:#205ba0;
padding:30px;
text-align:center;
}
#box1 , #box2 , #box3{
color:white;
border:2px solid white;
font-size:12px;
padding:10px;
}
CodePen

Related

Creating a rectangle with text inside a pattern [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I am new in HTML and CSS and there is a problem I am facing using CSS.
I want to create a section like this:
---Picture---
--Text--
---Picture---
--Text--
---Picture---
--Text--
---Picture---
--Text--
I want the text to be wrapped inside a rectangle with a specific background color. The issue is that whenever I am setting a background-color for my rectangle, the size of the div includes all of the content beneath.
.lower-part {
margin-top: 15%;
}
.lower-part .row .image img {
height: 80%;
width: 80%;
}
.lower-part .row .textbox {
background-color: red;
}
<div class="lower-part">
<div class="row">
<div class="image"><img src="images/BadmintonPicture.svg" alt="Badminton Picture"></div>
<div class="textbox1">
Sports.
<p>For me, nothing is better than regular excercise. It keeps me energetic throughout the day.</p>
<div class="row">
<div class="image"><img src="images/CookingPicture.svg" alt="Cooking Picture"></div>
<div class="textbox">
Cooking.
<p>I LOVE Food. I try to experiment with new recipes whenever I can. The Food Lab by Kenji Lopéz-Alt helps me being a better cook.</p>
<div class="row">
<div class="image"><img src="images/ReadingPicture.svg" alt="Reading Picture"></div>
<div class="textbox">
Reading.
<p> I love self-development books, because it helps me grow as a person.
<span>Favourites:</span>
<br>Slight Edge, Atomic Habits, How to Win Friends & Influence People .
</p>
<div class="row">
<div class="image"><img src="images/GuitarPicture.svg" alt="Guitar Picture"></div>
<div class="textbox">
Music.
<p>I grew up playing the violin but the guitar seemed way cooler. So I stick with that for the most part. Also, I like to sing every few minutes.</p>
</div>
</div>
</div>
Sass
.lower-part {
margin-top: 15%;
.row {
.image {
img {
height: 80%;
width: 80%;
}
}
.textbox {
background-color: red;
}
}
}
You forgot to close your <div> tags.
It helps if you properly indent and use new lines for new tags, because this way you can easily keep track of open tags.
<div class="lower-part">
<div class="row">
<div class="image">
<img src="images/BadmintonPicture.svg" alt="Badminton Picture">
</div>
<div class="textbox1">
Sports.
<p>
For me, nothing is better than regular excercise.
It keeps me energetic throughout the day.
</p>
</div>
</div>
</div>
etc.

Converting Div Row to Column in CSS

Alright so this is a simple question, but I have been figuring this out for a while now and I was wondering if theres any simpler to way to convert this div from a column to row, here's the format right now.
Problem
So how do I make it into columns? I got this template online for free so I may be confused a little, I tried out changing the padding size and such but it ruins the whole layout,
.service-list {
padding: 0 0 0 0;
font-size: 14px;
margin-bottom: 40px;
}
.service-list-col1 {
float: left;
width: 60px;
}
.service-list-col3 {
float: left;
width: 60px;
}
.service-list-col4 {
float: left;
width: 60px;
}
.service-list-col1 i {
font-style: normal;
font-size: 38px;
display: block;
color: #222;
font-family: 'FontAwesome';
line-height: 38px;
}
.service-list-col2 {
overflow: hidden;
}
.main-section.alabaster {
background: #fafafa;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<section class="main-section" id="service">
<!--main-section-start-->
<div class="container">
<h2>Services</h2>
<h6>Your investment plus our market experience, endless possibilities.</h6>
<div class="row">
<div class="col-lg-4 col-sm-6 wow fadeInLeft delay-05s">
<div class="service-list">
<div class="service-list-col1"><img src="img/iconn.png" alt="" width="39" height="37" /></div>
<div class="service-list-col2">
<h3>Business development & Project Syndication</h3>
<p>Highest and Best Use Study for Properties<br> Syndication of Projects<br> Project Feasibility Studies<br> Jumpstarting a New Business<br> Brand Planning<br> Business Planning</p>
</div>
</div>
<div class="service-list">
<div class="service-list-col3"><img src="img/iconn.png" alt="" width="39" height="37" /></div>
<div class="service-list-col2">
<h3>investors support and management advisory</h3>
<p>Business Opportunity Scanning<br> Investment Planning & Implementation<br> Negotiations with Local Partners<br> Advisory on Business Entry into Philippines<br> Management to Reposition Existing Property.</p>
</div>
</div>
<div class="service-list">
<div class="service-list-col4"><img src="img/iconn.png" alt="" width="39" height="37" /></div>
<div class="service-list-col2">
<h3>strategies in marketing development, marketing, and sales.</h3>
<p>Strategic Market Research and Planning<br> Positioning & Branding Strategies<br> Market Development Strategies<br> Customized Strategic Marketing & Sales<br> Interventions
</p>
</div>
</div>
</div>
<figure class="col-lg-8 col-sm-6 text-right wow fadeInUp delay-02s"> </figure>
</div>
</div>
</section>
<!--main-section-end-->
In such cases, including HTML markup would help to solve your problem, but let's see.
First of all, you do have rows, the picture given has one column and three rows, so I assume you want to turn those rows into columns.
To do that, make sure the container of those columns (the element that nests all .service-list elements) has width: 100%.
Probably you will have to remove width: 60px from your .service-list-col* elements since that is less than their actual width and it is overflowing, so remove it or set it to something bigger.
If this still doesn't work, try to add display: inline-block to your .service-list elements.
Hope this helps.
UPDATE
Ah, now with the HTML markup it makes more sense. Ignore my css suggestions above, with this structure you can use bootstrap's classes to get your result.
First of all, your service-lists wrapper needs to be able to cover the whole page, for this to happen, you have to define that it takes up 12 columns (default bootstrap css splits the used screen width into 12 columns). To do this, remove these classes col-lg-4 col-sm-6 and add col-xs-12. This will tell bootstrap that this element covers the whole screen width in all screens.
Secondly, you need the service-list divs to cover one third of the screen, so for a good responsiveness I would add to them the classes col-lg-4 col-md-6 col-xs-12. This will make them align 3 per row on a large screen, (12/4 = 3), 2 per row on medium screen (12/6 = 2) and one per row on a small and extra small screen (12/12 = 1).
To sum up, here you can see a working fiddle, I didn't do any changes in your CSS, I just made use of bootstrap classes. Note, to actually see the result, you have to stretch the screen to actually see them line up on the demo.

Issue with Bootstrap grid system and vertical aligning [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
Issue
I finally found an easy way of vertical aligning div elements and any other type of element, using the CSS properties/values display:flex; align-items: center. Only issue now is that the Boostrap grid system i.e. col-*-12 doesn't work. If I set a div to expand 12 columns when on a small screen, it doesn't react, in less I remove the styling used for vertically aligning the items.
Aim
To be able to use the grid system and vertically align elements. Any idea why display: flex is preventing the grid from working?
HTML
<div class="header-container padding-top--sm padding-bottom--sm">
<div class="row" style="display:flex;align-items:center">
<div class="col-xs-12 col-sm-6 col-md-3">
<img src="#" alt="logo">
</div>
<div class="col-xs-12 col-sm-6 col-md-6 text-md-center">
<p class="txt--white no-margin-bottom h-thin"> Lorem Ipsume, lorem ipsum</p>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 text-md-right">
<span class="txt--white">support#support.com</span><br>
<span class="no-margin-bottom txt--white">001111111111 (8am - 8pm GMT)</span>
</div>
</div>
</div>
CSS
.padding-top--sm { padding-top: 1rem; }
.padding-bottom--sm { padding-bottom: 1rem; }
.header-container {
margin-left: auto;
margin-right: auto;
padding-left: 15px;
padding-right: 15px;
width: 90%;
}
The reason is because you are not letting your row "wrap" its contents.
By default its is set to nowrap value which means it does not allow the content to extend the container.
Try adding flex-wrap: wrap; property to your row style
<div class="row" style="display:flex;align-items:center;flex-wrap: wrap;">
...
</div>
Codepen here
PS: Consider avoiding inline styles, use external or atleast internal styles as much as possible

Height Auto Not Working

I am using bootstrap and basic CSS on my app and for some reason the height-auto on a div isn't working. The height is shown as 0 even though there is text in the div. Here's my html:
<div class="container">
<div class="outlined-div">
<h2 class="text-center col-xs-12" style="color: red">Men are not born knowing how to barbecue.</h2>
<div class="col-xs-12 col-sm-6">
<h4>Good luck explaining this to your buddies.</h4>
<h4>All men are capable. Few are properly trained.</h4>
<h4>Instead, we undergo years of trial and error, suffering through snide comments from our buddies and smug looks from our fathers-in-law. This ends now.</h4>
</div>
<div class="col-xs-12 col-sm-6">
<h4>While men don’t ask for directions (see the man code), it’s only right that we share hints, hacks, and other help with our fellow brothers.</h4>
<h4>Give them a leg up in impressing others with our stellar barbecuemanship.</h4>
<h2 style="color: red">Grill on, brothers.</h2>
</div>
</div> <!-- outlined-div -->
</div> <!-- container -->
Here's my css for outlined-div:
.outlined-div {
background-color: white;
border: solid medium red;
border-radius: 5px;
padding-left: 15px;
padding-right: 15px;
height: auto !important;
}
And here's how it's showing up:
If I put in a fixed height (e.g. height: 10px) the red line expands into a box 10px high.
Can anyone see where I'm going wrong here?
Add the class clearfix to your outlined-div
This will clear the floats added by Bootstrap to create the column layout.
To learn more about clearfixes, read this question: What is a clearfix?

Centering a border that is smaller than its div [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have two divs that are col-xs-12 wide. There is no margin between them so they touch. I would like to add a border between them, like the image on the right (what I have currently is on the left).
I tried adding a 1 px height 11-wide column and centering it, but of course you can see a gap between the two rows on each side of the border.
Here's a jfiddle of the whole thing.
<div class="row top-buffer-10">
<div class="col-xs-12">
<div class="header-text">
<p style="font-size:130%"><b>%REGION%</b></p>
<p style="padding-bottom:15px;">(currently selected)</p>
</div>
</div>
</div>
<div class="row top-buffer-10">
<div class="col-xs-12">
<div class="img-with-text">
<img style="margin-top:5px;" src="img/gsd_list_contact.png" alt="itscl" />
<p style="font-size:90%;padding-left:0px;"><b>PHONE:</b> %LOCAL_PHONE%<br>
<b>TOLL FREE:</b> %TOLL_FREE%<br>
<b>LANGUAGE:</b> %LANGUAGE%
</p>
</div>
</div>
</div>
These are the two relevant divs to look out for.
There seems to be a little confusion, I want the border to be small than the div, as in, not just adding border top or border bottom.
See how the border doesn't quite reach the edges of the div. Thanks.
Here is a possible solution: https://jsfiddle.net/yjtrk00o/4/
EDIT:
add a css called division as shown below
In your HTML, add the line <hr class="division"/> just above the <div class="img-with-text">
CSS
.division{
border-top:1px solid #D3D3D3;
margin-top:0px;
margin-bottom:0px;
margin-left:10px;
margin-right:10px;
}
HTML
<div class="col-xs-12">
<hr class="division"/>
<div class="img-with-text">
I'm not sure if it's the desired effect you're after, but have you tried the following:
<div class="img-with-text" style="border-top: 1px solid black;">
Obviously you can fiddle with colour etc, or add that into the css class.
EDIT:
perhaps this then:
<div class="col-xs-12">
<div style="margin: 0 10px; display: block; height: 1px; background: #000;"></div>
<div class="img-with-text">
You can play with the margin to give you the offset from the edges you want. Probably not the most elegant solution, but seems to get the visual result you're after?