Working on page flow in responsiveness using css and images - css

I am working on the below reference image work on responsiveness using css media query and images. I am trying to avoid position I am not getting the excact output which I required.
Here is my Fiddle link
Here is my HTML Code
<div class="container-fluid">
<div class="row-fluid">
<div class="flw_width">
<label class="pull-left flw_text green_prog_text">Basic Information</label>
<div class="col-xs-4 col-sm-4 col-md-1">
<div class="flw_circle_green">
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-3">
<div class="green_prog">
</div>
</div>
<label class="pull-left flw_text cst_text">Education & Health</label>
<div class="col-xs-4 col-sm-4 col-md-1">
<div class="flw_circle_grey">
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-3">
<div class="grey_prog">
</div>
</div>
<label class="pull-left flw_text cst_text">Attach & Declaration</label>
<div class="col-xs-4 col-sm-4 col-md-1">
<div class="flw_circle_grey">
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-3">
<div class="grey_prog">
</div>
</div>
<label class="pull-left flw_text pay_text">Payment</label>
<div class="col-xs-4 col-sm-4 col-md-1">
<div class="flw_circle_grey">
</div>
</div>
</div>
</div>
</div>
My CSS Code
.flw_width{
width: 480px;
margin: 0px auto;
padding-top:45px;
padding-bottom: 60px;
}
.flw_text{
font-size: 13px;
color: #ced3d0;
font-family: 'Open Sans', sans-serif;
width: 0px;
white-space: nowrap;
margin-top: -35px;
margin-left: -45px;
border:0px;
}
.flw_text, .cst_text{
margin-left: -46px !important;
}
.pay_text{
padding-left:26px;
}
.flw_circle_grey{
background: url(../images/grey_Circle.jpg) no-repeat;
width: 20px;
height: 20px;
margin-left: -35px;
margin-top: -7px;
}
.flw_circle_green{
background: url(../images/green_Circle.jpg) no-repeat;
width: 20px;
height: 20px;
margin-top: -6px;
margin-left: 0px;
}
.grey_prog{
background-color: #ced3d0;
height: 6px;
margin-left: -24px;
border: 1px solid #bdbdbd;
}
.green_prog_text{
color: #84bd00;
}
.green_prog{
background-color: #84bd00;
height: 6px;
margin-left: -24px;
}
My current output was like this.
Here is the reference image. Kindly help me I was struggling like anything.
Please do the needful.

You have selected the column grid wrongly, I think For the class which are representing the font awesome circle (green dot) fa fa-circle flw_circle_green can be changed to single grid where you have defined a 4 column grid.
Try updating the four column grid to one column 1 column and use the

Related

Using Bootstrap Grid, Why Can I Not Space Out My Divs?

I'm working on my first web dev portfolio and am trying to incorporate the Bootstrap Grid system to the project links. I've searched through Bootstrap's documentation (v4.5), Stack Overflow, and just googling various searches to death. I've tried every solution I've found and am still getting nowhere. The closest I've come to a result is changing all three col-lg-4 to col-lg33. That did create the space, but then the padding looked super weird and it was more space than I needed. Any help would be super appreciated. I'm a but of a noob still.
<section id="projects">
<h2>My Work</h2>
<div class="container">
<div class="row justify-content-around">
<div class="col-lg-4 col-md-6 projects-grid">
<a href="https://briafly27.github.io/TechnicalDocumentAssignment/" target="_blank">
<img class="project-image" src="Images/TechnicalDoc.png" alt="project"/>
<p class="project-title">CSS Technical Document</p>
</a>
</div>
<div class="col-lg-4 col-md-6 projects-grid">
<a href="https://briafly27.github.io/Javascript30DrumKit/" target="_blank">
<img class="project-image" src="Images/JavascriptDrumkit.png" alt="project"/>
<p class="project-title">Javascript Drumkit</p>
</a>
</div>
<div class="col-lg-4 col-md-6 projects-grid">
<a href="https://briafly27.github.io/FirstPersonalSite/" target="_blank">
<img class="project-image" src="Images/FirstPersonalSite.png" alt="project"/>
<p class="project-title">First Personal Site</p>
</a>
</div>
</div>
</div>
</section>
#projects {
background: #3F3F44;
color: #f7f7f7;
font-family: 'Raleway', sans-serif;
height: 100vh;
}
#projects h2 {
text-shadow: 1px 1px #fdcb9e;
text-align: center;
padding: 60px;
}
.projects-grid {
background-color: #fdcb9e;
box-shadow: 5px 8px black;
border-radius: 10px;
padding: 1% 0;
}
.projects-grid:hover {
background-color: #cceabb;
box-shadow: 7px 10px black;
}
.projects-grid a {
text-decoration: none;
color: #3f3f44;
text-shadow: 1px 1px #cceabb;
}
.project-image {
height: 100%;
max-height: 170px;
width: 100%;
max-width: 300px;
border-radius: 10px;
border: 2px solid #cceabb;
display: flex;
margin: 0 auto;
}
.project-image:hover {
border: 2px solid #fdcb9e;
}
.project-title {
font-size: 1.5rem;
font-weight: 700;
padding-top: 8px;
padding-bottom: 4px;
margin: 0;
text-align: center;
}
Bootstrap is adding the column guttering as a 15px padding, by styling the layout there, you are also styling the padding that is the guttering, hence the project grid 'cards' are touching.
For this, to keep the guttering and to ensure nice even columns, I would style a nested div instead.
<div class="col-md-4">
<div class="projects-grid">
<a href="https://briafly27.github.io/TechnicalDocumentAssignment/" target="_blank">
<img class="project-image" src="Images/TechnicalDoc.png" alt="project" />
<p class="project-title">CSS Technical Document</p>
</a>
</div>
</div>
If the guttering is too large, you can change the sass variable (it's set to 30px by default) or you can use .no-gutters to remove all the guttering and add the padding manually to the nested divs.
<div class="row no-gutters">
<div class="col-md-4 p-2">
<div class="projects-grid">
<a href="https://briafly27.github.io/TechnicalDocumentAssignment/" target="_blank">
<img class="project-image" src="Images/TechnicalDoc.png" alt="project" />
<p class="project-title">CSS Technical Document</p>
</a>
</div>
</div>
</div>
I've created this link on Codepen to try understanding better the problem so that we can help you better:
https://codepen.io/maricaldas/pen/ExPKNzM
<section id="projects">
<h2>My Work</h2>
<div class="container">
<div class="row justify-content-around">
<div class="col-lg-3 col-md-6 projects-grid">
<a href="https://briafly27.github.io/TechnicalDocumentAssignment/" target="_blank">
<img class="project-image" src="Images/TechnicalDoc.png" alt="project" />
<p class="project-title">CSS Technical Document</p>
</a>
</div>
<div class="col-lg-3 col-md-6 projects-grid">
<a href="https://briafly27.github.io/Javascript30DrumKit/" target="_blank">
<img class="project-image" src="Images/JavascriptDrumkit.png" alt="project" />
<p class="project-title">Javascript Drumkit</p>
</a>
</div>
<div class="col-lg-3 col-md-6 projects-grid">
<a href="https://briafly27.github.io/FirstPersonalSite/" target="_blank">
<img class="project-image" src="Images/FirstPersonalSite.png" alt="project" />
<p class="project-title">First Personal Site</p>
</a>
</div>
</div>
</div>
</section>
Do you mean you want a space separating the project-grid columns?
If so, the first thing we need to consider is that when we use 3 columns taking 4 spaces each, we're using the full grid, which is 12, and that's why we can't see spaces around those col-lg-4 columns.
Can you please elaborate a little bit more on the result you want to achieve?
Maybe a way to add that space among the columns while using col-lg-4 is to overwrite the bootstrap pre-set width, which is 33.33%.
#media (min-width: 992px) {
.col-lg-4 {
-ms-flex: 0 0 32%;
flex: 0 0 32%;
max-width: 32%;
}
}

Bootstrap background color works only in small screen

I've different background colors for the different divs. Why does #background only apply, if my screen is xs-sized? On all bigger screens it has #suggestion's color, although #background is a extra defined child of #suggestions.
#suggestion {
background-color: #d9d9d9;
}
div div div.suggestions_button {
width: 100%;
height: 60px;
margin-top: 2%;
margin-bottom: 0.5%;
text-align: left;
background-color: white;
box-shadow: 8px -8px 20px #404040;
}
#background {
background-color: green;
}
<div class="row">
<div class="col-xs-1"></div>
<div id="suggestion" class="col-xs-10">
<div class="suggestions_button" data-toggle="collapse" data-target="#demo1">
<p>Suggestion 1</p>
</div>
<div id="background">
<div id="demo1" class="collapse">
<div id="YouTubeVideo" class="col-sm-12 col-md-6">
<div class="embed-responsive embed-responsive-16by9">
<iframe id="iFrame" src="youtube.com"></iframe>
</div>
</div>
<div id="text" class="col-sm-12 col-md-6">
<p> Wort 1 </p>
</div>
</div>
</div>
</div>
<div class="col-xs-1"></div>
</div>
Your question is not clear to me but all I found out is about the background color in different device sizes.
It works in all breakpoints but there are some points I would like to mention:
1- What ever "cols" you are defining for "xs" will apply to the larger size unless if you define an extra "col" for the other sizes.For example if you define:
<div class="col-xs-1"></div>
this means "col-xs-1 col-sm-1 col-md-1 col-lg-1" unless if you define new cols for them separately.
2- You can use different media queries for defining different properties in different device sizes. what ever that goes outside these queries will apply to mobile "xs".
It is a good link to start with : http://www.w3schools.com/css/css_rwd_mediaqueries.asp
3- I strongly recommend you to use Less or Sass for styling.
4- for defining a class you do not need to write "div div .suggestions_button" you can easily define the class and use it in every "div" you would like to use.
#suggestion {
background-color: yellow;
}
.suggestions_button {
width: 100%;
height: 60px;
margin-top: 2%;
margin-bottom: 0.5%;
text-align: left;
background-color:blue;
box-shadow: 8px -8px 20px #404040;
}
#background {
background-color: green;
}
<div class="row">
<div class="col-xs-1">Hello World </div>
<div id="suggestion" class="col-xs-10">
<div class="suggestions_button"
data-toggle="collapse"
data-target="#demo1">
<p>Suggestion 1</p>
</div>
<div id="background" class="col-xs-12">
<div id="demo1" class="collapse">
<div id="YouTubeVideo" class="col-sm-12 col-md-6">
<div class="embed-responsive embed-responsive-16by9">
<iframe src="http://www.who.com.au/"></iframe>
</div>
</div>
</div>
<div class="col-xs-1">Wort 1</div>
</div>
</div>
</div>

Adapt height of the elements based on siblings height [duplicate]

This question already has answers here:
How can I make Bootstrap columns all the same height?
(34 answers)
Closed 6 years ago.
I have a couple of widgets in line depending on screen size. Here is my layout:
<div class="col-xl-4 col-lg-3 col-md-4 col-sm-6 col-xs-12">
<div class="widget">
<div class="name">
Block name
</div>
<div class="description">
Some description goes here
</div>
</div>
</div>
<div class="col-xl-4 col-lg-3 col-md-4 col-sm-6 col-xs-12">
<div class="widget">
<div class="name">
Block name
</div>
<div class="description">
Some very long description goes here
</div>
</div>
</div>
<div class="col-xl-4 col-lg-3 col-md-4 col-sm-6 col-xs-12">
<div class="widget">
<div class="name">
Block name
</div>
<div class="description">
Some description goes here
</div>
</div>
</div>
and styles are the following:
.widget {
width: 100%;
margin: 10px;
padding: 10px;
background-color: white;
//height: auto;
height: 80px;
border: 1px silver solid;
font-size: 18px;
}
.name {
font-weight: bold;
height: 40px;
color: #082654;
}
.description {
color: #4AB6E1;
}
Here is the jsfiddle
The problem is that I want to be them of certain height: e.g.80px, cause its the size that will look nice for almost all cases, but rarely I have some longer content inside widget description and then it goes out of the box. So in this case I'd like its height to adapt to content size and all other widgets to its height too. When I set widgets height to auto - only single widget stretches in height and they look uneven. Any ideas how to change the styles so that to achieve what I need?
I you can use jQuery look at this JSFiddle
https://jsfiddle.net/cnoof9hb/
Uses the following to set the height:-
var maxheight = 0;
$('div div.widget').each(function () {
maxheight = ($(this).height() > maxheight ? $(this).height() : maxheight);
});
$('div div.widget').height(maxheight);
This seems like a perfect time for flexbox, I've made a container div to surround all 3 elements and given it display: flex; I've also given display: flex; to each div bellow that (as these are the bits that need to change size).
Have a look
* {
box-sizing: border-box;
}
body {
margin: 0;
}
.container {
display: flex;
flex-wrap: wrap;
}
.container > div {
display: flex;
width: 33.33%;
}
.widget {
width: 100%;
margin: 10px;
padding: 10px;
background-color: white;
border: 1px silver solid;
font-size: 18px;
}
.widget .name {
font-weight: bold;
height: 40px;
color: #082654;
}
.widget .description {
color: #4AB6E1;
}
<div class="container">
<div class="col-xl-4 col-lg-3 col-md-4 col-sm-6 col-xs-12">
<div class="widget">
<div class="name">
Block name
</div>
<div class="description">
Some description goes here
</div>
</div>
</div>
<div class="col-xl-4 col-lg-3 col-md-4 col-sm-6 col-xs-12">
<div class="widget">
<div class="name">
Block name
</div>
<div class="description">
Some very long description goes here
</div>
</div>
</div>
<div class="col-xl-4 col-lg-3 col-md-4 col-sm-6 col-xs-12">
<div class="widget">
<div class="name">
Block name
</div>
<div class="description">
Some description goes here
</div>
</div>
</div>
</div>
I hope this helps.
you can try using diplay:table
.widget {
width: 100%;
margin: 10px;
padding: 10px;
background-color: white;
//height: auto;
height: 80px;
display:table;
border: 1px silver solid;
font-size: 18px;
}
.name {
font-weight: bold;
height: 40px;
color: #082654;
}
.description {
color: #4AB6E1;
}
<div class="col-xl-4 col-lg-3 col-md-4 col-sm-6 col-xs-12">
<div class="widget">
<div class="name">
Block name
</div>
<div class="description">
Some description goes here
</div>
</div>
</div>
<div class="col-xl-4 col-lg-3 col-md-4 col-sm-6 col-xs-12">
<div class="widget">
<div class="name">
Block name
</div>
<div class="description">
Some very long description goes here
</div>
</div>
</div>
<div class="col-xl-4 col-lg-3 col-md-4 col-sm-6 col-xs-12">
<div class="widget">
<div class="name">
Block name
</div>
<div class="description">
Some description goes here
</div>
</div>
</div>
Use float:left to float an element to make the parent element take the cumulative height of it's childrens' height. Also height:auto; to be used in the parent element, as the height is unpredictable.
.widget {
width: 100%;
margin: 10px;
padding: 10px;
background-color: white;
/*height: auto;*/ /* removed this */
border: 1px silver solid;
font-size: 18px;
/* Added these 2 lines */
float:left;
height: auto;
}
.name {
font-weight: bold;
height: 40px;
color: #082654;
}
.description {
color: #4AB6E1;
}
Try below code it does "Adapt height of the elements based on siblings height" but you may need to change it little bit to suit ur needs
<div class="t-row">
<div class="col">Some description goes here Some description goes here</div>
<div class="col">on goes here</div>
<div class="col">here</div>
<div class="col">Some description goes here Some description goes here Some description goes here Some description goes hereSome description goes here Some description goes here</div>
</div>
and css
.t-row{
display: table-row;
}
.col{
display: table-cell;
width: 25%;
border: 1px solid silver;
padding: 15px;
background-color: white;
}
see fiddle here

Description does not show in the right position

I have a grid of images like this:
<div class="city-container container" id="popupContainer">
<div class="row">
<div class="col col-33">
<img src="img/images/opera.jpg" ng-click="showTabDialogOpera($event)"/>
<div class="description" style="font-size: 8pt"><strong>Opera de Lyon</strong></div>
</div>
<div class="col col-33">
<img src="img/Image1.jpg" ng-click="showTabDialogBasilique($event)"/>
<div class="description" style="font-size: 8pt"><strong>Basilique de Fourvière</strong></div>
</div>
<div class="col col-33">
<img src="img/images/hoteldeville.jpg" ng-click="showTabDialogHotel($event)"/>
<div class="description" style="font-size: 8pt"><strong>Hotel de villde de Lyon</strong></div>
</div>
</div>
The problem is that the description does not show in the right position.
CSS:
.city-container .description {
position: absolute;
width: 90%;
text-align: center;
padding: 5px;
line-height: 1.5;
background-color: rgba(204, 204, 204, 0.6);
}
I'm not really sure what you're trying to achieve.
If you want the description to show up next to the image, try relpacing
position: absolute;
with
display: inline-block;
Update
I have updated the CSS. Sorry for the delay.
I scaled the image to fit the width of the column. Hope that meets your requirement.
.col-33 {
width: 32%;
display: inline-block;
}
.col-33 img {
width: 100%;
}
.col-33 .description {
width: 100%;
text-align: center;
padding: 5px 0px;
line-height: 1.5;
background-color: rgba(204, 204, 204, 0.6);
}
<div class="city-container container" id="popupContainer">
<div class="row">
<div class="col col-33">
<img src="http://dummyimage.com/150x50/00cf75/fff.png&text=IMG" ng-click="showTabDialogOpera($event)"/>
<div class="description" style="font-size: 8pt"><strong>Opera de Lyon</strong></div>
</div>
<div class="col col-33">
<img src="http://dummyimage.com/150x50/00cf75/fff.png&text=IMG" ng-click="showTabDialogBasilique($event)"/>
<div class="description" style="font-size: 8pt"><strong>Basilique de Fourvière</strong></div>
</div>
<div class="col col-33">
<img src="http://dummyimage.com/150x50/00cf75/fff.png&text=IMG" ng-click="showTabDialogHotel($event)"/>
<div class="description" style="font-size: 8pt"><strong>Hotel de villde de Lyon</strong></div>
</div>
</div>

Twitter Bootstrap Banner - How to render

This is probably a pretty basic question, but I have a banner with an image on the left and text on the right. Under the banner is just a block of color. When the page gets smaller, my expectation is that the bits in the banner would stack (maintaining the background color for both) and the block of color (class="blue-line") would fall beneath them.
Here is the mark-up:
<section>
<div class="row header">
<div class="col-sm-6">
<img src="../images/logo.png" height="100px" />
</div>
<div class="col-sm-6 title">
<h2>Some Title Text</h2>
</div>
</div>
<div class="row">
<div class="col-sm-12 blue-line"></div>
</div>
</section>
and the css
.header {
background-color: #F2EBCC;
border: 10px solid #F2EBCC;
height: 120px;
}
.row > .title {
text-align: right;
top: 45%;
}
Thanks in advance!
JSFiddle: http://jsfiddle.net/3n6Kd/
try this:
<section>
<div class="row header">
<div class="col-sm-6">
<img src="../images/logo.png" height="100px" />
</div>
<div class="col-sm-6 title">
<h2>Some Title Text</h2>
</div>
</div>
<div class="row">
<div class="col-sm-12 blue-line"></div>
</div>
and:
.header {
background-color: #F2EBCC;
height: 120px;
}
.title {
text-align: right;
display: block;
padding: 10px;
}
.blue-line {
margin-top:10px;
height: 15px;
background-color: blue;
}
the text go under the first column not the blue-line, but it seems to appear above the blue-line so try it in your computer because some time jsfiddle.net don't show code correctly.
hope it will help you.

Resources