So I built a menu and would like to be able to toggle it. I'm simply animation the width using CSS3.
-webkit-transition: width 1s;
transition: width 1s;
Now, when the menu is closed and you re-open it, the menu items "pop in", as shown here: https://gyazo.com/6dfee24687fff026e464323882770959
I think it's because the sentences are wrapping. I've tried everything to stop that from happening, to no avail.
This is my structure:
<div id="menu" class="col-md-2 col-xs-12 nopad closed">
<div id="togglemenu" class="col-xs-12 nopad">
<div class="hidden-xs hidden-sm col-md-3 menu-icon" onclick="document.querySelector('#menu').classList.toggle('closed')">
<div class="vertical">
<div>
<i class="fa fa-bars" aria-hidden="true"></i>
</div>
</div>
</div>
</div>
<div class="nopad menu-header col-xs-12" onclick="document.querySelector('#menu').classList.toggle('closed')">
<div class="vertical">
<div class="pull-right menu-toggle">
<i class="fa fa-bars" aria-hidden="true"></i>
</div>
<div>MENU</div>
</div>
</div>
<div class="col-xs-12 nopad">
<div class="hidden-xs hidden-sm col-md-3 menu-icon">
<div class="vertical">
<div>
<i class="fa fa-usd" aria-hidden="true"></i>
</div>
</div>
</div>
<div class="col-xs-12 col-md-9 menu-item active">
<div class="vertical">
<div>Menu item</div>
</div>
</div>
</div>
<div class="nopad menu-header btop col-xs-12">
<div class="vertical">
<div>Menu divider</div>
</div>
</div>
</div>
And the CSS that goes along with it:
#menu {
min-height: 65vh;
background: #1c2329;
-webkit-transition: width 1s;
transition: width 1s;
}
#menu div {
text-overflow: clip;
}
.togglemenu {
cursor: pointer;
}
.menu-header {
text-align: center;
color: white;
text-transform: uppercase;
background: #181d21;
}
.menu-header.btop {
border-top: 1px solid #3de66e;
}
.vertical {
display: table-cell;
vertical-align: middle;
}
.menu-icon {
background: #1c252a;
text-align: center;
font-size: 2.1vh;
color: #3de66e;
}
.menu-item {
background: #1c2329;
text-transform: uppercase;
cursor: pointer;
}
.menu-item.active {
border-right: 3px solid #3de66e;
}
.menu-icon, .menu-header, .menu-item {
height: 5vh;
display: table;
overflow: hidden;
}
#menu.closed .menu-item, #menu.closed .col-md-9, #menu.closed .menu-header {
display: none;
}
#menu.closed .menu-item div {
display: block;
}
#menu.closed {
width: 3vw;
}
#menu.closed .menu-part {
display: none;
}
#togglemenu {
display: none;
}
#menu.closed #togglemenu {
display: block;
}
I was hoping someone could help me. Thanks in advance!
Related
I want to insert a table HTML on my post.
<div class="page-section">
<div class="container">
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-10">
{!! $post->body !!}
</div>
<div class="col-md-1"></div>
</div>
</div>
</div>
CSS for .page-section:
.page-section {
display: block;
position: relative;
overflow: hidden;
}
The code of table:
li {
list-style: none;
}
/* ------------ pricing table -------------- */
#pricing-table-section .pricing-table {
border: none;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
-webkit-transition: all 400ms linear;
transition: all 400ms linear;
padding: 32px 21px;
border-radius: 8px;
background: #f5f5f5;
}
#pricing-table-section .pricing-table h4 {
color: #74a534;
font-family: "Roboto", sans-serif;
margin-bottom: 25px;
}
#pricing-table-section .pricing-table .price {
padding: 22px 0;
border-top: 1px solid #e1f1ff;
/* border-bottom: 1px solid #d9d9d9; */
}
#pricing-table-section .pricing-table .price h2 {
margin-left: 20px;
position: relative;
font-family: 'Open Sans', sans-serif;
color: #000000;
}
#pricing-table-section .pricing-table .price h2 span {
font-family: "Roboto", sans-serif;
}
#pricing-table-section .pricing-table .price h2 .dollar {
font-size: 18px;
display: inline-block;
position: absolute;
/* left: -20px; */
top: 10px;
}
#pricing-table-section .pricing-table .price h2 .month {
font-size: 10px;
display: inline-block;
position: absolute;
left: 9px;
bottom: -4px;
color: #929292;
}
#media screen and (max-width: 992px) {
#pricing-table-section .pricing-table .price h2 {
margin-left: 10px;
}
}
#pricing-table-section .pricing-table .price p {
color: #929292;
}
#pricing-table-section .pricing-table ul.packages {
padding: 20px 0;
}
#pricing-table-section .pricing-table ul.packages li {
font-size: 16px;
font-weight: 400;
font-family: "Open Sans", sans-serif;
line-height: 40px;
}
#pricing-table-section .pricing-table ul.packages li i {
display: inline-block;
width: 24px;
color: #62be10;
}
#pricing-table-section .pricing-table .button {
background: #07aaa5;
color: #ffffff;
border-color: transparent;
}
/* #pricing-table-section .pricing-table .button:before {
background: #74a534;
} */
#pricing-table-section .pricing-table.black {
background: #07aaa5;
color: #ffffff;
border-color: transparent;
}
#pricing-table-section .pricing-table.black ul.packages li i,
#pricing-table-section .pricing-table.kinhdoanh ul.packages li i,
#pricing-table-section .pricing-table.coban ul.packages li i {
color: #ffffff;
}
#pricing-table-section .pricing-table.black h4,
#pricing-table-section .pricing-table.black h2,
#pricing-table-section .pricing-table.black p,
#pricing-table-section .pricing-table.black h2>.month {
color: #ffffff;
}
#pricing-table-section .pricing-table.black .button {
background: #ffffff;
color: #202125;
}
#pricing-table-section .pricing-table.black .button:before {
background: #74a534;
}
#pricing-table-section .pricing-table.black .button:hover,
#pricing-table-section .pricing-table.black .button:focus,
#pricing-table-section .pricing-table.black .button:active {
color: #ffffff;
}
#media screen and (max-width: 767px) {
#pricing-table-section .pricing-table.black {
margin: 50px 0;
}
}
#pricing-table-section .pricing-table.black:hover .button:before,
#pricing-table-section .pricing-table.coban:hover .button:before,
#pricing-table-section .pricing-table.kinhdoanh:hover .button:before {
background: #202125;
}
#pricing-table-section .pricing-table:hover .button:hover {
color: #ffffff;
}
/* ------------ pricing table end -------------- */
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div id="pricing-table-section" class="mid-level-padding">
<div class="container">
<div class="row">
<div class="col-xs-12 text-center ">
<div class="section-top-heading">
<h2 class="head-content">Bảng giá</h2>
<p>Tùy theo nhu cầu của bạn và chọn gói tốt nhất cho mình.</p>
</div>
</div>
</div>
<div class="row">
<div style="margin-bottom:10px;" class="col-lg-4 col-md-4 col-sm-6 col-xs-12 wow fadeInLeft animated" style="visibility: visible;">
<div class="pricing-table coban">
<div class="type">
<h4>Gói cơ bản</h4>
</div>
<div class="price">
<div class="row">
<div class="col-xs-12">
<h2>2.200.000 <span class="dollar">VNĐ</span></h2>
<span style="margin-left: 20px;">Thiết kế web theo mẫu sẵn có</span>
</div>
</div>
</div>
<div class="underline1 normal no-margin"></div>
<div class="underline2 normal no-margin"></div>
<ul class="packages">
<li><i class="fa fa-check" aria-hidden="true"></i>Chọn mẫu giao diện</li>
<li><i class="fa fa-check" aria-hidden="true"></i><strong>Miễn phí</strong> 1 hosting + tên miền</li>
<li><i class="fa fa-check" aria-hidden="true"></i>Hỗ trợ 24/7</li>
<li><i class="fa fa-check" aria-hidden="true"></i>Bảo hành vĩnh viễn</li>
<li><i class="fa fa-check" aria-hidden="true"></i>Chức năng đặt hàng, thanh toán</li>
</ul>
<button class="btn button btn-block"> Xem Mẫu Web </button>
</div>
</div>
<div style="margin-bottom:10px;" class="col-lg-4 col-md-4 col-sm-6 col-xs-12 wow fadeInUp animated" data-wow-duration="3s" style="visibility: visible; animation-duration: 3s;">
<div class="pricing-table black">
<div class="type">
<h4>Gói theo yêu cầu</h4>
</div>
<div class="price">
<div class="row">
<div class="col-xs-12">
<h2>3.500.000+ <span class="dollar">VNĐ</span></h2>
<span style="margin-left: 20px;">Web giới thiệu công ty, sản phẩm.</span>
</div>
</div>
</div>
<div class="underline1 normal no-margin"></div>
<div class="underline2 normal no-margin"></div>
<ul class="packages">
<li><i class="fa fa-check" aria-hidden="true"></i><strong>Thiết kế web theo yêu cầu</strong></li>
<li><i class="fa fa-check" aria-hidden="true"></i><strong>Miễn phí</strong> 1 hosting + tên miền</li>
<li><i class="fa fa-check" aria-hidden="true"></i>Hỗ trợ 24/7</li>
<li><i class="fa fa-check" aria-hidden="true"></i>Bảo hành vĩnh viễn</li>
<li><i class="fa fa-times" aria-hidden="true"></i>Không hỗ trợ đặt hàng, thanh toán</li>
</ul>
<button onclick="location.href='http://127.0.0.1:8000/#contact-us'" class="btn button btn-block">Đăng ký</button>
</div>
</div>
<div style="margin-bottom:10px;" class="col-lg-4 col-md-4 col-sm-6 col-xs-12 col-md-offset-0 col-lg-offset-0 col-xs-offset-0 col-sm-offset-3 wow fadeInRight animated" style="visibility: visible;">
<div class="pricing-table kinhdoanh">
<div class="type">
<h4>Gói kinh doanh</h4>
</div>
<div class="price">
<div class="row">
<div class="col-xs-12">
<h2>4.200.000+ <span class="dollar">VNĐ</span></h2>
<span style="margin-left: 20px;">Website bán hàng.</span>
</div>
</div>
</div>
<div class="underline1 normal no-margin"></div>
<div class="underline2 normal no-margin"></div>
<ul class="packages">
<li><i class="fa fa-check" aria-hidden="true"></i><strong>Thiết kế web theo yêu cầu</strong></li>
<li><i class="fa fa-check" aria-hidden="true"></i><strong>Miễn phí</strong> 1 hosting + tên miền</li>
<li><i class="fa fa-check" aria-hidden="true"></i>Hỗ trợ 24/7</li>
<li><i class="fa fa-check" aria-hidden="true"></i>Bảo hành vĩnh viễn</li>
<li><i class="fa fa-check" aria-hidden="true"></i><strong>Chức năng đặt hàng, thanh toán</strong></li>
</ul>
<button class="btn button btn-block">Đăng ký</button>
</div>
</div>
</div>
</div>
</div>
<!--pricing table end -->
On $post->body contain this table HTML.
I want the table HTML should be at the center page.
But it have position inside .page-section .container.
I can add class and style in the table HTML. Have any method to change position this table doesn't depend on parent div?
Current my table HTML looks like:
Explain:
On text, you can see dimension is equal.
I want the HTML table should have dimension also equal.
But the HTML table inside div contains text.
Remove div.container inside your table #pricing-table-section. It will be fixed.
From the screen capture you are sharing it seems that the table is overflowing the container.
You can try to add a width and a table-layout: fixed, like that:
#pricing-table-section .pricing-table {
border: none;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
-webkit-transition: all 400ms linear;
transition: all 400ms linear;
padding: 32px 21px;
border-radius: 8px;
background: #f5f5f5;
table-layout: fixed;
width: 100%
}
I have a button near the bottom of the page that is centered. Additionally, I have three images that I centered by making each image a col-lg-2 with 3 empty columns in between each one. I cannot figure out why these two items don't line up nicely, and which one is the one that is off center.
https://codepen.io/colesam/full/OgamyB/
SCSS:
a {
color: $blue;
font-size: 1.4vw;
font-weight: 500;
line-height: 1.7vw;
transition: all 0.2s;
&:hover {
color: $orange;
font-size: 1.7vw;
cursor: pointer;
text-decoration: none;
}
&:focus {
color: $blue;
text-decoration: none;
&:hover {
color: $orange;
cursor: pointer;
}
}
}
body {
background: white;
color: $black;
font-family: 'Roboto', sans-serif;
font-weight: 300;
text-shadow: $text-shadow-light;
}
h2 {
font-size: 5vh;
margin-top: 5vh;
}
p {
font-size: 3vh;
letter-spacing: 2px;
margin-top: 3vh;
text-shadow: none;
}
.btn-next {
bottom: 0;
padding-bottom: 5vh;
position: absolute;
text-align: center;
transition: all 0.3s;
a {
font-size: 5vw;
&:hover {
font-size: 5.5vw;
}
}
}
.center-text {
text-align: center;
}
.left-text {
text-align: left;
}
.no-margin {
margin: 0;
}
.right-text {
text-align: right;
}
.title {
padding-left: 4vw;
h3 {
font-size: 3vw;
text-shadow: $text-shadow;
}
}
#portfolio-page {
min-height: 100vh;
position: relative;
}
h4 {
font-size: 2vw;
}
.active-item {
box-shadow: $box-shadow-o;
-moz-box-shadow: $box-shadow-o;
-webkit-box-shadow: $box-shadow-o;
}
.btn-portfolio {
padding-top: 20vh;
text-align: center;
transition: all 0.3s;
a {
font-size: 5vw;
&:hover {
font-size: 5.5vw;
}
}
}
#featured-content {
background: rgba(0, 0, 0, 0.1);
height: 65vh;
margin-top: 2vh;
padding: 3vh 0;
}
#featured-img img {
box-shadow: $box-shadow-light;
-moz-box-shadow: $box-shadow-light;
-webkit-box-shadow: $box-shadow-light;
}
#primary-featured {
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
height: 45.5vh;
top: 10%;
}
#secondary-featured {
margin-top: 3vh;
}
HTML(inside a div.container):
<div id="portfolio-page">
<div class="row">
<div class="col-lg-4 col-lg-offset-4">
<h2 class="center-text">My Portfolio</h2>
<hr>
</div>
</div>
<div class="row">
<div class="col-lg-12" id="featured-content">
<div class="row no-margin">
<div class="col-lg-1 btn-portfolio" id="left-button">
<a><i class="glyphicon glyphicon-chevron-left"></i></a>
</div>
<div class="col-lg-8 col-lg-offset-1" id="primary-featured">
<div class="row">
<div class="col-lg-5" id="featured-img">
<img src="includes/img/headers.jpg" alt="A cluster of header images." class="img-responsive">
</div>
<div class="col-lg-6 col-lg-offset-1" class="center-text">
<h4 id="featured-title">Placeholder</h4>
<hr>
<p id="featured-description">Placeholder text.</p>
</div>
</div>
</div>
<div class="col-lg-1 col-lg-offset-1 btn-portfolio" id="right-button">
<a><i class="glyphicon glyphicon-chevron-right"></i></a>
</div>
<div class="col-lg-6 col-lg-offset-3" id="secondary-featured">
<div class="row">
<div class="col-lg-2" id="secondary-feature1">
<img src="includes/img/placeholder.jpg" alt="A placeholder image." class="img-responsive">
</div>
<div class="col-lg-2 col-lg-offset-3" id="secondary-feature2">
<img src="includes/img/placeholder.jpg" alt="A placeholder image." class="img-responsive">
</div>
<div class="col-lg-2 col-lg-offset-3" id="secondary-feature3">
<img src="includes/img/placeholder.jpg" alt="A placeholder image." class="img-responsive">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 btn-next">
<a>
<i class="glyphicon glyphicon-chevron-down"></i>
</a>
</div>
</div>
</div>
Edit: Your problem is with position: absolute on .btn-next.
For absolutely positioned elements
This property specifies the distance between the left margin edge of
the element and the left edge of its containing block.
You have margin-left: -15px, so it aligns to center with the margin-left: -15px.
How to fix:
Add this to .btn-next:
right: 0;
left: 0;
...or you can remove position: absolute from .btn-next.
Alternative option:
The "down arrow" at the bottom isn't centered, because it's in the row class and that class has margin-left: 15px and margin-right: 15px.
If you give it margin: 0px, it'll be fine.
Rename div class="row" to something else or give it another class like div class="row down".
Examples:
<div class="down">
<div class="col-lg-12 btn-next">
<a>
<i class="glyphicon glyphicon-chevron-down"></i>
</a>
</div>
</div>
or
<div class="row down">
<div class="col-lg-12 btn-next">
<a>
<i class="glyphicon glyphicon-chevron-down"></i>
</a>
</div>
</div>
CSS (only if using second option):
.row.down {
margin: 0px;
}
body {
margin-left: 50px !important;
margin-right: 50px !important;
}
.section {
background: rgba(255, 255, 255, 0.69);
height: 200px;
border: 1px solid #000;
}
.outer {
display: table;
width: 100%;
height: 100vh;
}
.inner {
display: table-cell;
vertical-align: middle;
text-align: center;
}
.parent-div {
margin: 0 auto;
width: 82%;
}
.table-parent {
display: table;
}
.table-child {
display: table-cell;
vertical-align: middle;
}
.section:hover {
color: #ececeb;
transition: all 0.3s;
cursor: pointer;
}
.table-child .fa {
padding-right: 6px !important;
}
.section:hover .item-overlay.bottom {
bottom: 0;
}
.item-overlay {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
overflow: hidden;
width: 100%;
-moz-transition: top 0.3s, right 0.3s, bottom 0.3s, left 0.3s;
-webkit-transition: top 0.3s, right 0.3s, bottom 0.3s, left 0.3s;
transition: top 0.3s, right 0.3s, bottom 0.3s, left 0.3s;
}
.item-overlay.bottom {
bottom: 100%;
}
.table-child p {
display: inline-block;
text-rendering: auto;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
transform: translate(0, 0);
}
a {
text-decoration: none;
color: #333 !important;
}
#AddProduct {
display: inline-block;
}
#media screen and (max-width: 767px) {
.col-xs-12 {
width: 100% !important;
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<body>
<div class="row outer">
<div class="row inner">
<div class="clearfix parent-div">
<a data-toggle="modal" data-target="#myModal">
<div class="col-md-4 col-sm-6 col-xs-12 section table-parent">
<div class="item-overlay bottom"></div>
<h4 class="table-child"><i class="fa fa-plus-circle" aria-hidden="true"></i>
<p>ADD A PRODUCT</p>
</h4>
</div>
</a>
<a>
<div class="col-md-4 col-sm-6 col-xs-12 section table-parent">
<div class="item-overlay bottom"></div>
<h4 class="table-child"><i class="fa fa-pencil" aria-hidden="true"></i>
<p>EDIT A PRODUCT</p>
</h4>
</div>
</a>
<a data-toggle="modal" data-target="#removeModal">
<div class="col-md-4 col-sm-6 col-xs-12 section table-parent">
<div class="item-overlay bottom"></div>
<h4 class="table-child"><i class="fa fa-minus-circle" aria-hidden="true"></i>
<p>REMOVE A PRODUCT</p>
</h4>
</div>
</a>
<div class="col-md-4 col-sm-6 col-xs-12 section table-parent">
<div class="item-overlay bottom"></div>
<h4 class="table-child"><i class="fa fa-bars" aria-hidden="true"></i>
<p>USER'S LIST</p>
</h4>
</div>
<div class="col-md-4 col-sm-6 col-xs-12 section table-parent">
<div class="item-overlay bottom"></div>
<h4 class="table-child"><i class="fa fa-sort" aria-hidden="true"></i>
<p>ORDERS</p>
</h4>
</div>
<div class="col-md-4 col-sm-6 col-xs-12 section table-parent">
<div class="item-overlay bottom"></div>
<h4 class="table-child"><i class="fa fa-power-off" aria-hidden="true"></i>
<p>LOGOUT</p>
</h4>
</div>
</div>
</div>
</div>
</body>
I am using Bootstrap v3. The divs are not taking 100% width in mobile devices with col-xs-12. Code is working fine for medium and small screens but retaining the 50% width for screens less than 768. Here is the link to the screenshot of the behaviour.
Image
Gone through all other available solutions but none worked for me.
I don't know how to put this into words but I am getting the desired output on resizing the browser window but the code doesn't seem to work on the actual device and the web inspector. Screenshot of the device Image
Additionally I tried with !important as well at the end of css but facing the same problem.
Taken from comment of chetan kalra and posting answer for quick reference for others. I also faced this issue and found viewport meta tag was missing. Adding below line did the trick.
<meta name="viewport" content="width=device-width, initial-scale=1.0">
I have 2 columns inside of a div, with each column containing 3 divs each. As this is for a mobile site, I want them to be aligned in the center responsively. They're aligned fine when resized for a standard mobile (320px, 375px) like so: http://imgur.com/a/WDwSL, but when resized at tablet size, they don't center align at all. http://imgur.com/a/mMTRG
How can I get them to stay in the center no matter what size the phone size? I tried media queries and other responsive grids but they didn't work. Any help would be appreciated. Thanks!
.two-circles {
width: 100%;
}
.circles-left {
width: 37%;
float: left;
margin-left: 18%;
padding: 0;
display: block;
}
.circles-right {
width: 37%;
padding-bottom: 13%;
float: left;
display: block;
}
.clear {
clear: both;
}
.rate-circles {
border: 3px solid white;
border-radius: 50%;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=60)";
filter: alpha(opacity=60);
opacity: 1;
text-align: center;
font-family: 'Montserrat', sans-serif;
font-size: 50px;
line-height: 75px;
color: #0E3475;
text-shadow: none;
-webkit-box-shadow: 0 0 1px 0px rgb( 255, 255, 255);
box-shadow: none;
width: 75px;
height: 75px;
z-index: 86;
-webkit-transition: background-color .5s ease-in-out;
-moz-transition: background-color .5s ease-in-out;
-o-transition: background-color .5s ease-in-out;
-ms-transition: background-color .5s ease-in-out;
transition: background-color .5s ease-in-out;
}
h5.circles {
font-size: 18px;
text-align: center;
margin-top: -25px;
}
h1.rate {
color: #1E53A8;
font-weight: bold;
text-align: center;
}
.two-circles a {
list-style-type: none;
text-decoration: none;
}
<div data-role="content" id="cmp-postlist">
<h1 class="rate"> RATE YOUR ANXIETY</h1>
<div class="two-circles">
<div class="circles-left">
<a href="cmp-grounding.html" rel="external">
<div class="rate-circles">1
<h5 class="circles">Nervous</h5>
</div>
</a>
</div>
<div class="circles-right">
<a href="cmp-grounding.html" rel="external">
<div class="rate-circles">2
<h5 class="circles">Uneasy</h5>
</div>
</a>
</div>
<div class="circles-left">
<a href="cmp-grounding.html" rel="external">
<div class="rate-circles">3
<h5 class="circles">Anxious</h5>
</div>
</a>
</div>
<div class="circles-right">
<a href="cmp-grounding.html" rel="external">
<div class="rate-circles">4
<h5 class="circles">Worried</h5>
</div>
</a>
</div>
<div class="circles-left">
<a href="cmp-grounding.html" rel="external">
<div class="rate-circles">5
<h5 class="circles">Fearful</h5>
</div>
</a>
</div>
<div class="circles-right">
<a href="cmp-grounding.html" rel="external">
<div class="rate-circles">6
<h5 class="circles">Panicked</h5>
</div>
</a>
</div>
</div>
<div class="clear"></div>
</div>
JSFIDDLE
.two-circles {
width: 100%;
}
.circles-left,.circles-right {
width: 45%;
padding-bottom: 13%;
float: left;
}
.circles-right {
text-align:left;
padding-left: 5%;
}
.circles-left {
text-align:right;
padding-right: 5%;
}
.clear {
clear: both;
}
.rate-circles {
border: 3px solid white;
border-radius: 50%;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=60)";
filter: alpha(opacity=60);
opacity: 1;
text-align: center;
font-family: 'Montserrat', sans-serif;
font-size: 50px;
line-height: 75px;
color: #0E3475;
text-shadow: none;
-webkit-box-shadow: 0 0 1px 0px rgb( 255, 255, 255);
box-shadow: none;
width: 75px;
height: 75px;
z-index: 86;
-webkit-transition: background-color .5s ease-in-out;
-moz-transition: background-color .5s ease-in-out;
-o-transition: background-color .5s ease-in-out;
-ms-transition: background-color .5s ease-in-out;
transition: background-color .5s ease-in-out;
display: inline-block;
}
h5.circles {
font-size: 18px;
text-align: center;
margin-top: -25px;
}
h1.rate {
color: #1E53A8;
font-weight: bold;
text-align: center;
}
.two-circles a {
list-style-type: none;
text-decoration: none;
}
<div data-role="content" id="cmp-postlist">
<h1 class="rate"> RATE YOUR ANXIETY</h1>
<div class="two-circles">
<div class="circles-left">
<a href="cmp-grounding.html" rel="external"><div class="rate-circles">1
<h5 class="circles">Nervous</h5>
</div></a>
</div>
<div class="circles-right">
<a href="cmp-grounding.html" rel="external"><div class="rate-circles">2
<h5 class="circles">Uneasy</h5>
</div></a>
</div>
<div class="circles-left">
<a href="cmp-grounding.html" rel="external"><div class="rate-circles">3
<h5 class="circles">Anxious</h5>
</div></a>
</div>
<div class="circles-right">
<a href="cmp-grounding.html" rel="external"><div class="rate-circles">4
<h5 class="circles">Worried</h5>
</div></a>
</div>
<div class="circles-left">
<a href="cmp-grounding.html" rel="external"><div class="rate-circles">5
<h5 class="circles">Fearful</h5>
</div></a>
</div>
<div class="circles-right">
<a href="cmp-grounding.html" rel="external"><div class="rate-circles">6
<h5 class="circles">Panicked</h5>
</div></a>
</div>
</div>
<div class="clear"></div>
</div>
use this css. i didnt make any changes in HTML. my suggestion is you need to do some changes in both HTML and CSS
.wrapper{
width: 1170px;
max-width: 90%;
margin: 0 auto;
padding: 0 20px;
text-align: center;
}
.column{
width: 48%;
display: inline-block;
margin: 0 .5%;
}
.item{
width: 100%;
background-color: blue;
color: white;
margin-bottom: 20px;
display: inline-block;
}
<div class="wrapper">
<h2>2 column center divs</h2>
<div class="column">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
</div>
<div class="column">
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
</div>
</div>
Would personally change your approach
There are many ways to do it but the most efficient and simplest way would be to use the CSS3 Flexbox. Designed to solve exactly these sort of layout issues.
Code reduces significantly as well. All you need is to give the outer .two-circles and inner .circles-left, .circles-right a property display: flex. Most importantly the justify-content: center to the inner circles to align it to the center. Shown below:
.two-circles {
width:100%;
display: flex;
flex-wrap: wrap;
}
.circles-left, .circles-right {
width:48%;
display: flex;
justify-content: center;
padding-bottom: 13%;
}
That's it! The rest of the code from .clear remains the same as you require.
Fiddle updated here
Using FLex will make this easier. See below.
body {
background: #ccc;
}
.two-circles {
width: 100%;
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.circles-left, .circles-right {
width: 37%;
text-align: center;
}
.circles-right {
padding-bottom: 13%;
}
.rate-circles {
border: 3px solid white;
border-radius: 50%;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=60)";
filter: alpha(opacity=60);
opacity: 1;
text-align: center;
font-family: 'Montserrat', sans-serif;
font-size: 50px;
line-height: 75px;
color: #0E3475;
text-shadow: none;
-webkit-box-shadow: 0 0 1px 0px rgb( 255, 255, 255);
box-shadow: none;
width: 75px;
height: 75px;
z-index: 86;
-webkit-transition: background-color .5s ease-in-out;
-moz-transition: background-color .5s ease-in-out;
-o-transition: background-color .5s ease-in-out;
-ms-transition: background-color .5s ease-in-out;
transition: background-color .5s ease-in-out;
}
h5.circles {
font-size: 18px;
text-align: center;
margin-top: -25px;
}
h1.rate {
color: #1E53A8;
font-weight: bold;
text-align: center;
}
.two-circles a {
list-style-type: none;
text-decoration: none;
display: inline-block;
}
<div data-role="content" id="cmp-postlist">
<h1 class="rate"> RATE YOUR ANXIETY</h1>
<div class="two-circles">
<div class="circles-left">
<a href="cmp-grounding.html" rel="external">
<div class="rate-circles">1
<h5 class="circles">Nervous</h5>
</div>
</a>
</div>
<div class="circles-right">
<a href="cmp-grounding.html" rel="external">
<div class="rate-circles">2
<h5 class="circles">Uneasy</h5>
</div>
</a>
</div>
<div class="circles-left">
<a href="cmp-grounding.html" rel="external">
<div class="rate-circles">3
<h5 class="circles">Anxious</h5>
</div>
</a>
</div>
<div class="circles-right">
<a href="cmp-grounding.html" rel="external">
<div class="rate-circles">4
<h5 class="circles">Worried</h5>
</div>
</a>
</div>
<div class="circles-left">
<a href="cmp-grounding.html" rel="external">
<div class="rate-circles">5
<h5 class="circles">Fearful</h5>
</div>
</a>
</div>
<div class="circles-right">
<a href="cmp-grounding.html" rel="external">
<div class="rate-circles">6
<h5 class="circles">Panicked</h5>
</div>
</a>
</div>
</div>
<!--<div class="clear"></div> Remove-->
</div>
.heading{
margin: 40px 0px;
}
.heading h1{
text-align: center;
}
.block{
width: 100%;
text-align: center;
display: inline-flex;
}
.block_left, .block_right{
width: 50%;
}
.sub_block{
background: transparent;
border: 1px solid #ccc;
padding: 25px 30px;
border-radius: 50%;
}
.block_head{
margin: 40px 0px;
font-weight: bold;
}
<div class="heading">
<h1 class="">
RATE YOUR ANXIETY
</h1>
</div>
<div class="block">
<div class="block_left">
<span class="sub_block">
1
</span>
<div class="block_head">
Nervous
</div>
</div>
<div class="block_right">
<span class="sub_block">
2
</span>
<div class="block_head">
Uneasy
</div>
</div>
</div>
<!-- Third block row -->
<div class="block">
<div class="block_left">
<span class="sub_block">
5
</span>
<div class="block_head">
Fearful
</div>
</div>
<div class="block_right">
<span class="sub_block">
6
</span>
<div class="block_head">
Panicked
</div>
</div>
</div>
<!-- second block row -->
<div class="block">
<div class="block_left">
<span class="sub_block">
3
</span>
<div class="block_head">
Anxious
</div>
</div>
<div class="block_right">
<span class="sub_block">
4
</span>
<div class="block_head">
Worried
</div>
</div>
</div>
Since you mentioned grids, have you tried the concepts of display:inline-blocks?
CSS
.circles {
width:48%;
margin:1%; //not really required
display: inline-block;
}
.circle-wrapper {
text-align: center;
}
HTML
<div class="circle-wrapper">
<div class="circle">
<!-- content here -->
</div>
</div>
What display:inline-block does is that it wraps the space required to be exactly as much as the content it has (unless you define the width and height of course)
Thus with that you are able to place your elements the way you want.
What i have done in circles is I have defined the width of the circle to be 48% of the entire screen. Thus the content inside receives that much amount of space. (i could go for 50 but then there won't be space for margins and stuffs).
The wrapper class aligns these inline blocks to the center just like text blocks. :)
After all. text can be treated as inline-blocks
I'm currently testing html list using bootstrap and some of my own custom css items. For the last day I have been stuck on how to remove a parents :active state when a sub link is clicked with its own :active state.
Below is a like to my code, I have tried changing z-index, and also tried removing it with jquery with no luck.
My main goal is to keep the list items hover state but once the setting icon is click the item go back to normal view.
Any help would be great.
My Current Code on CodePen
.genericItem, .item img, .item .item-description, .item .item-settings {
display: inline-block;
vertical-align: middle;
}
/*List-group*/
.list-group-item:hover,
.list-group-item:focus {
text-decoration: none;
background-color: whitesmoke;
}
.list-group-item:active {
background-color: #2980b9;
Color: white;
}
/*Items*/
.item {
-webkit-user-select: none;
}
.item .item-description {
margin-left: 5px;
}
.item .item-description p {
margin-top: -4px;
}
.item .item-settings {
color: black;
text-decoration: none;
float: right;
}
.item .item-settings:hover, .item .item-settings:focus {
color: red;
text-decoration: none;
}
.item .item-settings:active {
color: green;
text-decoration: none;
}
.item .item-settings:visited {
color: black;
}
<div class="list-group">
<div class="list-group-item item">
<img src="https://cdn2.iconfinder.com/data/icons/files-color/104/46-files-console-32.png" alt="" />
<div class="item-description">
<h4 class="list-group-item-heading">Dev Console</h4>
<p class="list-group-item-text"><i>Powershell Console, No Profile Loaded</i></p>
</div>
<a class="fa fa-cog item-settings" aria-hidden="true"></a>
</div>
<div class="list-group-item item">
<img src="https://cdn1.iconfinder.com/data/icons/miscellaneous-4/32/toolbox-32.png" alt="" />
<div class="item-description">
<h4 class="list-group-item-heading">Computer Management</h4>
</div>
<a class="fa fa-cog item-settings" aria-hidden="true"></a>
</div>
</div>
You should change your structure of use javascript
here is an example of how I would change the structure
HTML
<div class="list-group">
<div class=" item">
<div class="list-group-item">
<img src="https://cdn2.iconfinder.com/data/icons/files-color/104/46-files-console-32.png" alt="" />
<div class="item-description">
<h4 class="list-group-item-heading">Dev Console</h4>
<p class="list-group-item-text"><i>Powershell Console, No Profile Loaded</i></p>
</div>
</div>
<a class="fa fa-cog item-settings" aria-hidden="true"></a>
</div>
<div class=" item">
<div class="list-group-item item">
<img src="https://cdn1.iconfinder.com/data/icons/miscellaneous-4/32/toolbox-32.png" alt="" />
<div class="item-description">
<h4 class="list-group-item-heading">Computer Management</h4>
</div>
</div>
<a class="fa fa-cog item-settings" aria-hidden="true"></a>
</div>
</div>
And CSS
/*List-group*/
.item > div:hover,
.item > div:focus {
text-decoration: none;
background-color: rgb(245, 245, 245);
}
.item > div:active {
background-color: rgb(41, 128, 185);
Color: white;
}
.item{
position: relative;
}
.item > a{
position: absolute;
right: 15px;
top: 10px;
}
Example : http://codepen.io/anon/pen/aBXGQy?editors=1111