How to get this effect? - html

I try to reach one point using div's and bootstrap. It should be in one line number of points and smaller information about points and in second area should be bootstrap icon and again information about icon.
My code:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row center-block">
<div class="col-md-5" style="padding: 0px; padding-left: 10px; ">
<i class="pull-left h2"><h2>72</h2></i> TWOJE PUNKTY
</div>
<div class="col-md-7" style="padding: 0px">
<i class="fa fa-trophy fa-2x pull-left"></i> WYRÓZNIENIE SZYBKI BILL
</div>
<br>
<table class="table">
<tr>
<th><h2>72</h2></th>
<th>you points</th>
<th><i class="fa fa-trophy fa-2x pull-left"></i></th>
<th>fastL</th>
</tr>
</table>
</div>
</div>

Try below code and you can adjust col- class according to you
.flex-div {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
align-items: center;
}
.icon-text {
float: left;
margin-right: 10px;
font-size: 34px;
}
.icon-text h2 {
margin: 0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row center-block row-eq-height">
<div class="col-xs-6 flex-div">
<div class="icon-text">
<h2>72</h2>
</div>
<div class="info-text">
TWOJE PUNKTY<br/>
WYRÓZNIENIE SZYBKI BILL
</div>
</div>
<div class="col-xs-6 flex-div ">
<div class="icon-text">
<i class="glyphicon glyphicon-certificate"></i>
</div>
<div class="info-text">
Your Achivement Reached
</div>
</div>
</div>
</div>

You can achieve that effect using something like this.
HTML:
<div class="points"> 72 </div>
<div class="points-details">
Your
points
</div>
<div class="icon">+</div>
<div class="icon-details">
Your
Achievment
Reached
</div>
CSS:
.points{
display: inline-block;
}
.points-details{
display: inline-block;
}
.icon{
margin-left: 20px;
display: inline-block;
}
.icon-details{
display: inline-block;
}

Related

How to remove Space CSS overflow-x in mobile design

I try to make a slide card for mobile design by implement overflow-x.
However, this leaves some space on the right side of the screen which is really annoying. How can I fix this?
I have used the following style to get rid of the extra space on the right side of the screen:
Here is my html code
<div class="pet-group">
<!-- Pet List Widget -->
<div class="row justify-content-md-center text-center flex-nowrap2">
<div class="w-25 p-3" data-step="2" data-intro="You also can add your other pet!" data-position='right'
data-scrollTo='tooltip'>
<div class="card widget-profile pet-widget-profile ">
<div class="card-body card-mobile">
<div class="propet-widget-content ">
<div class="pet-info-widget ">
<a href="add-pets.html" class="booking-doc-img ">
<img src="assets/img/addpet.png " alt="users Image ">
</a>
<div class="profile-det-info ">
<h3><a href="add-pets.html " class="stretched-link ">
Add Pet </a> </h3>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="w-25 p-3" data-step="1"
data-intro="Hey, its Ricky! You can click here to view or update your pet story." data-position='left'>
<div class="card widget-profile pet-widget-profile ">
<div class="card-body card-mobile">
<div class="propet-widget-content ">
<a href="profile-pet.html" class="booking-doc-img ">
<div class="pet-info-widget ">
<img src="assets/img/pets/cat1.png " alt="users Image ">
</a>
<div class="profile-det-info ">
<h3><a href="profile-pet.html" class="stretched-link ">
Ricky </a><span class="badge badge-pill bg-success-light gender">Male</span></h3>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="w-25 p-3">
<div class="card widget-profile pet-widget-profile ">
<div class="card-body card-mobile">
<div class="propet-widget-content">
<a href="profile-pet.html" class="booking-doc-img ">
<div class="pet-info-widget ">
<img src="assets/img/pets/cat2.png " alt="users Image ">
</a>
<div class="profile-det-info ">
<h3><a href="profile-pet.html" class="stretched-link ">
Bucky </a><span class="badge badge-pill bg-warning-light gender">Female</span></h3>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Here is my css code
.pet-group {
margin-top: -70px;
display: flex !important;
overflow-x: scroll;
overflow-y: hidden;
white-space: nowrap;
scroll-direction: horizontal;
-webkit-overflow-scrolling: touch;
&::-webkit-scrollbar {
display: none;
}
}
.flex-nowrap2 {
padding: 15px;
list-style: none;
-ms-box-orient: horizontal;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -moz-flex;
display: -webkit-flex;
display: flex;
-webkit-flex-wrap: nowrap;
flex-wrap: nowrap;
}
Try
.flex-nowrap2 {
padding-right: 0px;
}
inside Mobile Size Media Query.
remove padding
.flex-nowrap2 {
padding: 0;
}
If you want padding to text just add padding to title tags only.

Flex Box Menu Alignment Issue

Been researching and adjusting the following code, but aligning the text with even spacing is eluding me. I am able to accomplish this easily with a table element, but I want to master Flex Box methods. Any help appreciated.
Screen Shot of text-alignment issue:
#navbar-menu-button-mobile,
#navbar-container-mobile {
display: flex !important;
}
/* === Navigation Drop-down Menu === */
#navbar-container-mobile {
margin-top: 74px;
padding: 0 1%;
background: white;
}
.navbar-menu-item-mobile {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<div id="navbar-container-mobile" class="container">
<div id="navbar-collapse-mobile" class="collapse w-100">
<div class="navbar-menu-item-mobile">
<div class="fa fa-calendar"></div><div class="pr-2"></div><div>Calendar</div>
</div>
<div class="navbar-menu-item-mobile">
<div class="fa fa-compass"></div><div class="pr-2"></div><div>Locations</div>
</div>
<div class="navbar-menu-item-mobile">
<div class="fa fa-heartbeat"></div><div class="pr-2"></div><div>Physicians</div>
</div>
<div class="navbar-menu-item-mobile">
<div class="fa fa-random"></div><div class="pr-2"></div><div>Trades</div>
</div>
<div class="navbar-menu-item-mobile">
<div class="fa fa-user"></div><div class="pr-2"></div><div>Personal</div>
</div>
<div class="navbar-menu-item-mobile">
<div class="fa fa-cog"></div><div class="pr-2"></div><div>Settings</div>
</div>
<div class="dropdown-divider"></div>
<div class="navbar-menu-item-mobile">
<div class="fa fa-sign-out"></div><div class="pr-2"></div><div>Sign Out</div>
</div>
</div>
</div>
Example below assuming that you're using FontAweosme v4, Please follow this Markup:
<div class="navbar-menu-item-mobile">
<i class="menu icons"></i>
<div>Menu label</div>
</div>
And you need to set width, margin to the icons:
.navbar-menu-item-mobile .fa {
width: 15px;
margin-right: 10px;
}
Example:
#navbar-menu-button-mobile,
#navbar-container-mobile {
display: flex !important;
}
/* Add this */
.navbar-menu-item-mobile .fa {
width: 15px;
margin-right: 10px;
}
/* === Navigation Drop-down Menu === */
#navbar-container-mobile {
margin-top: 74px;
padding: 0 1%;
background: white;
}
.navbar-menu-item-mobile {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<div id="navbar-container-mobile" class="container">
<!-- Removed collapse class for testing -->
<div id="navbar-collapse-mobile" class="w-100">
<div class="navbar-menu-item-mobile">
<i class="fa fa-calendar"></i>
<div>Calendar</div>
</div>
<div class="navbar-menu-item-mobile">
<i class="fa fa-compass"></i>
<div>Locations</div>
</div>
<div class="navbar-menu-item-mobile">
<i class="fa fa-heartbeat"></i>
<div>Physicians</div>
</div>
<div class="navbar-menu-item-mobile">
<i class="fa fa-random"></i>
<div>Trades</div>
</div>
<div class="navbar-menu-item-mobile">
<i class="fa fa-user"></i>
<div>Personal</div>
</div>
<div class="navbar-menu-item-mobile">
<div class="fa fa-cog"></div>
<div>Settings</div>
</div>
<div class="dropdown-divider"></div>
<div class="navbar-menu-item-mobile">
<i class="fa fa-sign-out "></i>
<div>Sign Out</div>
</div>
</div>
</div>
You need to give a min-width to your icons

How to move third element in block down with flexbox?

How move third element down, that first block with logo, and second other full width contain another panel,and down will be another panel?
this block (pastenow.ru/57IX6) need to move and it must be like this : pastenow.ru/57IXE
<nav class="navbar">
<!--start of top_panel-->
<div class="logo"><img src="img/logo.png" alt=""> </div>
<div class="panel">
<div class="nav_title">С нами ловят все!</div>
<div class="phone">8 800 553535</div>
<div class="address_wrapper">
<div class="address">Павлодар, ул. Мира 7</div>
<div class="address">Павлодар, ул. Мира 8</div>
</div>
<div class="call_btn def_btn">Заказать звонок</div>
</div>
<!--end of top_panel-->
<!--start of bottom_panel-->
<div class="bottom_panel">
<div class="main">Главная</div>
<div class="about_us">компании</div>
<div class="tournament">Турниры</div>
<div class="goods">Товары</div>
<div class="news">Новости</div>
<div class="photo">Фото</div>
<div class="video">Видео</div>
<div class="contact">Контакты</div>
<div class="social_icons_wrapper">
<div ><i class="fa fa-youtube icon_size" aria-hidden="true"></i></div>
<div ><i class="fa fa-instagram icon_size" aria-hidden="true"></i></div>
<div ><i class="fa fa-vk icon_size" aria-hidden="true"></i></div>
<div ><i class="fa fa-whatsapp icon_size" aria-hidden="true"></i></div>
<div><i class="fa fa-telegram icon_size" aria-hidden="true"></i></div>
</div>
</div>
<!--end of bottom_panel-->
if add flex-wrap: wrap; so all goes down, but i need only one.
css
.container{
width: 1170px;
height: auto;
min-height: 100vh;
display: flex;
flex-wrap: wrap;
justify-content: center;
margin: auto;
font-family: "Museo Cyrl 900";
}
.header_line{
width: 100%;
height: 122px;
background-color: #fff;
}
.navbar{
width: 100%;
display: inline-flex;
justify-content: space-between;
}
.logo{
width: 200px;
height: auto;
}
.panel{
width: 100%;
display: inline-flex;
justify-content: space-between;
}
.bootom_panel{
width: 100%;
display:inline-flex;
justify-content: flex-end;
}
I have made a codepen demo with slight adjustments in the layout which you have provided. Please click on this link: https://codepen.io/ArunK_UI/pen/qwbXLm?editors=1100
Major change here is I have wrapped upper panel and lower panel in one wrapper and then gave them respective properties.
<div class="panel-wrap">
<div class="panel"></div>
<div class="bottom_panel"></div>
</div>

Column width on table is not following grid container width on bootstrap?

I have been trying to build a table with Bootstrap 4 grid container. Everything looks great (styling, alignment,...) except for one problem: the table doesn't follow the grid container as expected. It seems like only the first column expands/shrinks when I try to resize my browser.
I used the display property to build my table to solve alignment problems, but once I try putting col-# as class names for the columns, it doesn't seem to work.
.my-table {
border: 1px solid grey;
display: table;
padding: 0;
}
.my-table-row-header {
display: table-header-group;
height: 50px;
}
.first-header-column {
display: table-cell;
vertical-align: middle;
text-align: center;
}
.my-table-body {
display: table-row-group;
}
.my-table-row {
height: 50px;
border-left: 1px solid grey;
border-bottom: 1px solid grey;
display: table-row;
}
.row-cell {
display: table-cell;
vertical-align: middle;
border-right: 1px solid grey;
}
.c-column {
display: table-cell;
vertical-align: middle;
text-align: center;
padding-left: 11px;
padding-right: 11px;
}
<div class="container-fluid no-gutters">
<div class="my-table col-9 table">
<div class="my-table-row-header row">
<div class="first-header-column col-1 row-cell">
<span class="c-column">c</span>
</div>
<div class="second-column col-4 row-cell">
<span>text</span>
</div>
<div class="third-column col-4 row-cell">
<span>text</span>
</div>
</div>
<div class="my-table-body">
<div class="my-table-row row">
<div class="first-column col-1 row-cell">
<span class="c-column">c</span>
</div>
<div class="second-column col-4 row-cell">
<span>text</span>
</div>
<div class="third-column col-4 row-cell">
<span>text</span>
</div>
</div>
<div class="my-table-row row">
<div class="first-column col-1 row-cell">
<span class="c-column">c</span>
</div>
<div class="second-column col-4 row-cell">
<span>text</span>
</div>
<div class="third-column col-4 row-cell">
<span>text</span>
</div>
</div>
</div>
</div>
</div>
Jsfiddle: https://jsfiddle.net/4zn5oby6/2/
If you try resizing your browser, you'll see the first column resizes accordingly. I expect it to follow the grid container size strictly.
P.S. Since my table contains other components (not just text), I would like to keep the display properties to assure my styling is on point if possible. Thanks.
I am not clear on what the question is exactly, but I noticed the col-9 needed to be in its own div. Then to equal 12 columns add the col-3 div after.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<style>
.my-table {
border: 1px solid grey;
display: table;
padding: 0;
}
.my-table-row-header {
display: table-header-group;
height: 50px;
}
.first-header-column {
display: table-cell;
vertical-align: middle;
text-align: center;
}
.my-table-body {
display: table-row-group;
}
.my-table-row {
height: 50px;
border-left: 1px solid grey;
border-bottom: 1px solid grey;
display: table-row;
}
.row-cell {
display: table-cell;
vertical-align: middle;
border-right: 1px solid grey;
}
.c-column {
display: table-cell;
vertical-align: middle;
text-align: center;
padding-left: 11px;
padding-right: 11px;
}
</style>
</head>
<body>
<div class="container-fluid no-gutters">
<div class="col-9">
<div class="my-table table">
<div class="my-table-row-header row">
<div class="first-header-column col-1 row-cell">
<span class="c-column">c</span>
</div>
<div class="second-column col-4 row-cell">
<span>text</span>
</div>
<div class="third-column col-4 row-cell">
<span>text</span>
</div>
</div>
<div class="my-table-body">
<div class="my-table-row row">
<div class="first-column col-1 row-cell">
<span class="c-column">c</span>
</div>
<div class="second-column col-4 row-cell">
<span>text</span>
</div>
<div class="third-column col-4 row-cell">
<span>text</span>
</div>
</div>
<div class="my-table-row row">
<div class="first-column col-1 row-cell">
<span class="c-column">c</span>
</div>
<div class="second-column col-4 row-cell">
<span>text</span>
</div>
<div class="third-column col-4 row-cell">
<span>text</span>
</div>
</div>
</div>
</div></div>
<div class="col-3"></div>
</div>
</body>
</html>
So, I found a way around it. Instead of using display: table-cell and all that vertical-align and text-align crap, I used display: flex which respected the bootstrap grid column width (which I'm still not sure why?).

Align 3 divs horizontally with their icons

I've looked at this answer and a few similar ones, but still struggling with alignment.
I have 3 divs in a parent div. Each div has a font-awesome icon and text.
Currently the alignment is spaced evenly horizontally, but with gaps between text and icons. I need each div's text next to the icon.
What I have:
[ icon text icon text icon text ]
What I need:
[ icon text icon text icon text ]
Code:
.question-instructions {
background-color: #3eb6a9;
margin: 0px 0px 0px;
}
.question-line {
margin: 0px auto;
white-space: nowrap;
text-align: center;
}
.question-block {
margin: 10px 0 30px;
align-content: center;
vertical-align: middle;
/*display: inline-block; */
}
.block1 {
/* float: left;*/
}
.block2 {
/*display:inline-block;*/
}
.block3 {
/*float: right;*/
}
<div class="container">
<div class="row">
<div class="question-instructions">
<div class="row text-center">
<div class="col-lg-8 col-lg-offset-2 col-md-8 col-md-offset-2 col-sm-8 col-sm-offset-2 ">
<h2>MY TITLE</h2>
</div>
</div>
<div class="row question-line">
<div class="col-lg-4 col-md-4 col-sm-4 question-block block1">
<div class="pull-left"><i class="fa fa-group fa-fw fa-3x question-icon"></i>
</div>
<h4>My first text</h4>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 question-block block2">
<a class="pull-left" href="#">
<i class="fa fa-question fa-fw fa-3x question-icon"></i>
</a>
<h4 class="">My second text</h4>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 question-block block3">
<div class="pull-left"><i class="fa fa-graduation-cap fa-fw fa-3x question-icon"></i>
</div>
<h4>My third text</h4>
</div>
</div>
</div>
</div>
</div>
I've tried:
adding float left and right to the two divs on the ends and switching the html around so the floats are first and then the centre. Didn't work.
If I remove the text-align: center css property from the .question-line then the text is against the icons how it should be, but everything is then left aligned in the parent div and not centered. I get this then:
[ icon text icon text icon text ]
I've tried display: table-cell on the icons and the h4. also not working.
I made a few changes in your code, see code bellow :
.question-instructions {
background-color: #3eb6a9;
margin: 0px 0px 0px;
}
.question-line {
margin: 0px auto;
white-space: nowrap;
text-align: center;
}
.question-block {
margin: 10px 0 30px;
align-content: center;
vertical-align: middle;
/*display: inline-block; */
}
.block1 {
/* float: left;*/
}
.inline-block {
display: inline-block;
}
.block3 {
/*float: right;*/
}
<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" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="question-instructions">
<div class="row text-center">
<div class="col-lg-8 col-lg-offset-2 col-md-8 col-md-offset-2 col-sm-8 col-sm-offset-2 ">
<h2>MY TITLE</h2>
</div>
</div>
<div class="row question-line">
<div class="col-lg-4 col-md-4 col-sm-4">
<i class="fa fa-group fa-fw fa-3x question-icon"></i>
<h4 class="inline-block">My first text</h4>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 ">
<i class="fa fa-question fa-fw fa-3x question-icon"></i>
<h4 class="inline-block">My second text</h4>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 ">
<i class="fa fa-graduation-cap fa-fw fa-3x question-icon"></i>
<h4 class="inline-block">My third text</h4>
</div>
</div>
</div>
</div>
</div>
Here is updated code. text-align did the trick. Check in "full page" mode to see the effect. http://i.imgur.com/KAYkTMp.png
.question-instructions {
background-color: #3eb6a9;
margin: 0px 0px 0px;
width: 100%;
}
.question-line {
margin: 0px auto;
white-space: nowrap;
text-align: center;
}
.question-block {
margin: 10px 0 30px;
vertical-align: middle;
white-space: nowrap;
}
.block1 {
/* float: left;*/
}
.block2 {
/*display:inline-block;*/
}
.block3 {
/*float: right;*/
}
<div class="container">
<div class="row">
<div class="question-instructions">
<div class="row text-center">
<div class="col-lg-12 col-lg-offset-2 col-md-8 col-md-offset-2 col-sm-8 col-sm-offset-2 ">
<h2>MY TITLE</h2>
</div>
</div>
<div class="row question-line">
<div class="col-lg-4 col-md-4 col-sm-4 question-block block1">
<div style="display: inline-block;">
<i class="fa fa-group fa-fw fa-3x question-icon pull-left"></i>
<h4 class="pull-left">My first text</h4>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 question-block block2">
<div style="display: inline-block;">
<i class="fa fa-question fa-fw fa-3x question-icon pull-left"></i>
<h4 class="pull-left">My second text</h4>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 question-block block3">
<div style="display: inline-block;">
<i class="fa fa-graduation-cap fa-fw fa-3x question-icon pull-left"></i>
<h4 class="pull-left">My third text</h4>
</div>
</div>
</div>
</div>
</div>
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
Check this fiddle.
CSS
.question-instructions {
background-color: #3eb6a9;
margin: 0px 0px 0px;
}
.question-line {
margin: 0px auto;
white-space: nowrap;
text-align: left;
}
.question-block {
margin: 10px 0 30px;
align-content: center;
vertical-align: middle;
}
.question-block h4{
display: inline-block;
}
.block {
float: left;
}