I would really appreciate your help if you could check below in the codepen my css animation.
I'm trying to make this work better. I want this underline to start from below the icon, not to be stuck to the window, but to have some space from right just under the first icon.
* {
box-sizing: border-box;
}
body {
font: 300 100% 'Helvetica Neue', Helvetica, Arial;
}
.container {
width: 100%;
margin: 0 auto;
}
ul li {
display: inline;
text-align: center;
}
a {
display: inline-block;
width: 25%;
padding: .75rem 0;
margin: 0;
text-decoration: none;
color: #333;
}
.two:hover ~ hr {
margin-left: 40%;
}
.one:hover ~ hr {
margin-left: 12.5%;
}
.three:hover ~ hr {
margin-left: 66%;
}
.four:hover ~ hr {
margin-left: 75%;
}
hr {
height: .25rem;
width: 20%;
margin: 0;
background: tomato;
border: none;
transition: .3s ease-in-out;
}
.home-content-1{background-color: #F7F8F9; text-align: center;padding:5em 0em 2em;}
.home-content-1 .row{margin-top: 2em;}
.home-content-1 h3{font-weight: 700;text-transform: uppercase;color: #646464;font-size: 1.3125em;}
.hc-icon{width: 150px;height: 150px;border-radius: 50%;margin: 0px auto 2.25em;}
.hc-icon img{padding-top: 30px;}
.hc-icon1{background: #b5d73c;}
.hc-icon2{background: #32aaeb;}
.hc-icon3{background: #ef3f54;}
.circles li { padding: 10px;}
hr {
height: .25rem;
width: 22%;
margin-left: 12.5%;
background: tomato;
border: none;
transition: .3s ease-in-out;
}
<div class="home-content-1">
<div class="container">
<h1>The Blabla Approach</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.</p>
<div class="row">
<div class="col span_1_of_4">
<ul class="circles">
<li class="one"><a href="#">
<div class="hc-icon hc-icon1"></div>
<h3>Demand Generation</h3></a></li>
<li class="two"><a href="#"><div class="hc-icon hc-icon1">
</div>
<h3>Demand Generation</h3></a>
</li>
<li class="three">
<a href="#">
<div class="hc-icon hc-icon1"></div>
<h3>Demand Generation</h3></a></li>
<hr />
</ul>
</div>
Please see all my code here -
http://codepen.io/anetk/pen/QyZLNb
Personally, I would do this. I eliminated all the title stuff to isolate what you're trying to do. I substituted your 'hr' element with a 'div'. Changing the div's relative position to the parent container feels a lot safer than changing margins on an 'hr' element that's sized to the body. This responsively sizes the 'highlight' div with the 'li' elements. You can adjust the 'circles' container's margins and widths to your liking.
HTML:
<ul class="circles">
<li class="one">
<a href="#">
<div class="hc-icon hc-icon1"></div>
<h3>Demand Generation</h3>
</a>
</li>
<li class="two">
<a href="#">
<div class="hc-icon hc-icon1"></div>
<h3>Demand Generation</h3></a>
</li>
<li class="three">
<a href="#">
<div class="hc-icon hc-icon1"></div>
<h3>Demand Generation</h3>
</a>
</li>
<div class="highlight"></div>
</ul>
CSS:
body {
font: 300 100% 'Helvetica Neue', Helvetica, Arial;
margin:0;
}
.circles {
display:inline-block;
width:80%;
margin:0 10%;
padding:0;
}
.circles li {
display:inline-block;
list-style-type:none;
text-align:center;
width:33%;
}
.highlight {
position:relative;
left:0;
height:5px;
width:33%;
background: tomato;
transition: .3s ease-in-out;
}
a {
display: inline-block;
width: 100%;
margin: 0;
text-decoration: none;
color: #333;
}
.two:hover ~ .highlight {
left: 33%;
}
.three:hover ~ .highlight {
left: 66%;
}
.circles h3{font-weight: 700;text-transform: uppercase;color: #646464;font-size: 1.3125em;}
.hc-icon{width: 150px;height: 150px;border-radius: 50%;margin: 0px auto 2.25em;}
.hc-icon1{background: #b5d73c;}
.hc-icon2{background: #32aaeb;}
.hc-icon3{background: #ef3f54;}
http://codepen.io/midgitsuu/pen/VeEKgQ
Easiest solution is to put a style on the <hr> to shift it's starting position.
css:
hr {
height: .25rem;
width: 20%;
margin-left: 12.5%;
background: tomato;
border: none;
transition: .3s ease-in-out;
}
The idea is to align the hr with the first circle. You want to use a % and not px so that the align will be responsive with the size of the window.
The change was from margin: 0; to margin-left: 12.5%;
Related
First of all excuse me if the title is unclear. I dont really know how to describe the problem which also makes it harder for me to google for solutions.
I've inserted my code in a fiddle so I can explain it better:
https://jsfiddle.net/Lzbavyu9/2/
I want the X always to be on the same height as the first line of the text. I've tried things as vertical-align but that doesnt work. It always moves down with the last line of the text.
code is below
<div class="panel-title">
<h3>test sdfjsdf sdjfk sjkdf sdjk fjksd fjskdf jksdfj ksdfjk sfd jksd</h3>
<span class="collapse-button">
<i class="pull-right" aria-hidden="true">X</i>
</span>
</div>
CSS
.panel-title {
width: 200px;
}
.panel-title h3 {
margin: 8px 0 -1em 0;
display: block;
width: calc(100% - 30px);
}
.panel-title span.collapse-button {
padding: 0px;
height: 25px;
margin: 0px;
display: block;
}
.collapse-button i {
width: 25px;
height: 15px;
}
.pull-right {
float: right !important;
}
Does anybody have an idea?
Thanks in advance
div h3{
display: inline-block;
max-width: 10em;
vertical-align: top;
margin: 0;
}
<div>
<h3>test sdfjsdf sdjfk sjkdf sdjk fjksd fjskdf jksdfj ksdfjk sfd jksd</h3>
<i>X</i>
</div>
Flexbox can do that
* {
margin: 0;
padding: 0;
}
.panel-title {
width: 200px;
display: flex;
margin: 1em;
border: 1px solid grey;
}
.panel-title h3 {
display: block;
flex: 1;
}
.panel-title span.collapse-button {
padding: 0px;
height: 25px;
margin: 0px;
display: block;
}
.collapse-button i {
width: 25px;
height: 15px;
}
<div class="panel-title">
<h3>test sdfjsdf sdjfk sjkdf sdjk fjksd fjskdf jksdfj ksdfjk sfd jksd</h3>
<span class="collapse-button">
<i aria-hidden="true">X</i>
</span>
</div>
<div class="panel-title">
<h3>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Exercitationem alias est ex, reiciendis expedita natus distinctio quos ipsam cumque soluta, iusto incidunt molestias mollitia, ullam labore aliquid iure inventore voluptate!</h3>
<span class="collapse-button">
<i aria-hidden="true">X</i>
</span>
</div>
You should use position: absolute on your .collapse-button class. Add position: relative in your .panel-title class. If you want to adjust the position of the X, you can change the values of top, right, left and bottom properties in .collapse-button class
.panel-title {
width: 200px;
}
.panel-title h3 {
margin: 8px 0 -1em 0;
display: block;
width: calc(100% - 30px);
position: relative;
}
.panel-title span.collapse-button {
padding: 0px;
height: 25px;
margin: 0px;
display: block;
position: absolute;
top: 10px;
right: 0;
}
.collapse-button i {
width: 25px;
height: 15px;
}
.pull-right {
float: right !important;
}
<div class="panel-title">
<h3>test sdfjsdf sdjfk sjkdf sdjk fjksd fjskdf jksdfj ksdfjk sfd jksd</h3>
<span class="collapse-button">
<i class="pull-right" aria-hidden="true">X</i>
</span>
</div>
Put this:
.panel-title { position: relative; width: 200px; }
and
.collapse-button i { position: absolute; top: 5px; right: 0px; }
I have a push-left menu, when I clicked the hamburger icon, push menu will slide in and “push” the main content aside when toggled, but I can swipe the page to the right. See this :
I want to make the main area unswipeable when push menu is toggled. Here is my code :
html {
position: relative;
min-height: 100%;
}
body {
font-family: 'Titillium Web', sans-serif;
background-color: #fbfbfb;
overflow-x: hidden;
}
#sidebar {
height: 100%;
padding-right: 0;
padding-top: 20px;
max-width: 300px;
}
#sidebar .nav {
width: 95%;
}
/* collapsed sidebar styles */
#media screen and (max-width: 767px) {
.row-offcanvas {
position: relative;
-webkit-transition: all 0.25s ease-out;
-moz-transition: all 0.25s ease-out;
transition: all 0.25s ease-out;
}
.row-offcanvas-right .sidebar-offcanvas {
right: -41.6%;
}
.row-offcanvas-left .sidebar-offcanvas {
left: -41.6%;
}
.row-offcanvas-right.active {
right: 41.6%;
}
.row-offcanvas-left.active {
left: 41.6%;
}
.sidebar-offcanvas {
position: absolute;
top: 0;
width: 41.6%;
}
}
/* navbar override */
.navbar-toggle,
.navbar-toggle:hover,
.navbar-toggle:focus,
.navbar-toggle:active {
float: left;
background-color: #fff !important;
margin: 12px 0px 8px 15px;
}
.navbar-toggle .icon-bar {
background-color: #ddd !important;
}
.navbar-toggle:hover .icon-bar,
.navbar-toggle:focus .icon-bar,
.navbar-toggle:active .icon-bar {
background-color: #03A9F4 !important;
}
.navbar-default {
background-color: #fff;
}
.navbar-brand {
padding-top: 10px;
/* padding-left: 28px; */
}
.navbar {
min-height: 60px;
margin-bottom: 0px;
border-bottom: 1px solid #E2F1FF;
}
.navbar-dashboard .navbar-brand {
padding-left: 28px;
}
.paket-navbar {
font-size: 1.3em;
}
.paket-navbar a {
color: #3E3E3E;
line-height: 30px;
}
.paket-navbar a:hover {
color: #03A9F4;
background-color: transparent !important;
}
.paket-navbar-secondary {
margin-top: 10px;
}
.paket-navbar-secondary > li > a {
padding-left: 57px;
}
#media screen and (max-width: 767px) {
.paket-navbar-secondary > li > a {
padding-left: 47px;
}
}
.paket-navbar-secondary a {
color: #858585;
line-height: 25px;
}
.paket-navbar-secondary a:hover {
color: #03A9F4;
background-color: transparent !important;
}
.paket-navbar>li.active>a {
color: #03A9F4;
}
#sidebar > ul.nav.paket-navbar > li > a > i {
margin-right: 20px;
}
#media screen and (max-width: 767px) {
#sidebar > ul.nav.paket-navbar > li > a > i {
margin-right: 10px;
}
}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<body>
<div class="page-container">
<!-- top navbar -->
<div class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header navbar-dashboard">
<button type="button" class="navbar-toggle" data-toggle="offcanvas" data-target=".sidebar-nav">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="<?php echo base_url('home') ;?>"><img src="<?php echo base_url('asset/img/paketid-logo-240.png')?>" alt="Paket ID" height="40" width="120"></a>
<p class="nav-username pull-right navbar-text visible-xs"><?php echo ($this->session->username ? $this->session->username : strtok($this->session->user_email,'#')); ?></p>
</div>
<p class="nav-username pull-right navbar-text hidden-xs">
<?php echo ($this->session->username ? $this->session->username : strtok($this->session->user_email,'#')); ?>
</p>
</div>
</div>
<div class="container-fluid">
<div class="row row-offcanvas row-offcanvas-left">
<!-- sidebar -->
<div class="col-xs-6 col-sm-3 sidebar-offcanvas" id="sidebar" role="navigation">
<ul class="nav paket-navbar">
<li <?php if ($_controller=="dashboard")echo "class='active'"?>><i class="fi flaticon-home"></i> Dashboard</li>
<li <?php if ($_controller=="book")echo "class='active'"?>><i class="fi flaticon-copy"></i> Book</li>
<li <?php if ($_controller=="settings")echo "class='active'"?>><i class="fi flaticon-setting"></i> Settings</li>
<li><i class="fi flaticon-caret-left"></i> Sign out</li>
</ul>
</div>
What did I do wrong? Thanks in advance..
Here is a basic example of side menu.
At first look at structure of html. There are two blocks: header and page.
Header isn't interesting, it just contain hamburger button (red).
Pagecontains two blocks: menu and content. It has display: flex and hides menu by transform: translateX(-200px). Menu has fixed width that equals width: 200px. When you click button, you add class opened to page and remove transform: translateX(-200px). So you can see now a menu. But page has overflow-x: hidden and there is no horizontal scroll.
$('.button').on('click', function() {
$('.page').toggleClass('opened');
});
* {
box-sizing: border-box;
}
.screen {
width: 320px;
height: 480px;
border: 1px solid;
overflow-x: hidden;
overflow-y: auto;
}
.page {
display: flex;
align-items: stretch;
transition: transform ease .3s;
transform: translateX(-200px);
}
.page.opened {
transform: translateX(0);
}
.menu {
flex: 0 0 auto;
width: 200px;
background: black;
color: white;
}
.content {
flex: 0 0 100%;
width: 100%;
padding: 20px;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 20px;
background: gray;
}
.button {
width: 30px;
height: 30px;
background: red;
cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="screen">
<header class="header">
<div class="button"></div>
<span>Header</span>
</header>
<div class="page">
<div class="menu">
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
<div class="content">
<h1>Title</h1>
<h2>Subtitle</h2>
<p>Some text.</p>
<p>Horace Greeley (1811–1872) was editor of the New-York Tribune, as well as the Democratic and Liberal Republican candidate in the 1872 U.S. presidential election. Born to a poor family in New Hampshire, Greeley in 1831 went to New York City to seek his fortune. He lived there the rest of his life, but also spent much time at his farm in Chappaqua. In 1841, he founded the Tribune, which became the highest-circulating newspaper in the country. He urged the settlement of the American West, popularizing the phrase "Go West, young man, and grow up with the country", though it is uncertain if he invented it. Greeley was briefly a Whig congressman from New York, and helped found the Republican Party in 1854. When the Civil War broke out, he mostly supported President Abraham Lincoln, and urged the end of slavery. Greeley ran in 1872 in an attempt to unseat President Ulysses Grant, whose administration he deemed corrupt, but lost in a landslide. Devastated at the defeat, he died three weeks after Election Day.</p>
</div>
</div>
</div>
I have a CSS transition which takes place on hover of a link - the transition happens to some of the contents of this link.
My issue is that the transition (which primarily animates width and height properties) works fine when hovering over the link, but on stopping hover, the elements simply spring back to their unhovered state - rather than transitioning.
The styles defined are this:
a.transition {
display: block;
width: 300px;
height: 200px;
position: relative;
border: 1px solid #000;
color: #000'
}
a.transition .category_info_container {
position: absolute;
left: 0;
right: 0;
top: 0;
height: 70px;
transition: height 0.5s, width 0.5s, color 0.5s;
}
a.transition .category_info_container .category_info {
background-color: #aaa;
padding: 0 20px;
}
a.transition .category_info_container .category_info .category_name {
color: #fff;
text-transform: uppercase;
font-size: 18px;
line-height: 70px;
}
a.transition .category_info_container .category_info .category_desc {
display: none;
}
a.transition:hover .category_info_container {
background: #eee;
width: 48%;
height: 100%;
}
a.transition:hover .category_info_container .category_info {
position: absolute;
bottom: 20%;
background: none;
}
a.transition:hover .category_info_container .category_info .category_name {
color: #000;
line-height: 50px;
}
a.transition:hover .category_info_container .category_info .category_desc {
display: block;
}
And my markup:
<a href="#" class="transition">
<div class="category_info_container">
<div class="category_info">
<div class="category_name">
Test Name
</div>
<div class="category_desc">
Lorem ipsum dolar sit amet...
</div>
</div>
</div>
</a>
I have created a JSFiddle with my code.
I think, It will be better, if you use different blocks for elements:
checkout my example:
http://jsfiddle.net/bo5o3q18/3/
<a href="#" class="transition">
<div class="category_info">
<div class="category_name">
Test Name
</div>
</div>
<div class="category_info-add">
<div class="category_name">
Test Name
</div>
<div class="category_desc">
Lorem ipsum dolar sit amet...
</div>
</div>
</a>
I'm trying to use angular to create list of elements. The page will be an app on mobile phone.
The list itself can have many elements so what I expect is that the ul element should be scrollable ("swipable"?). I tried to follow some example like http://jsfiddle.net/sirrocco/9z48t/ and http://jsfiddle.net/qcv5Q/1/..
This is the html code:
<div class="container">
<div id="spinner-icon" style="display:none">
<span class = "icon-spinner"></span>
</div>
<div class="col-xs-12 indentation push-down bg-white" ng-repeat="cei in completeElementInfo">
<div class="clearfix">
<div class="pull-left">
<h4>{{cei.description}}</h4>
<p>{{cei.name}}</p>
</div>
</div>
<div class="log-widget-list">
<ul class="list scroller clearfix" id="elements-list">
<li class="pull-left" ng-repeat="tinfo in cei.techInfo | orderBy: 'tinfo.sentTime'">
<h4 class="align-center">{{tinfo.elementShortCode}}</h4>
<div class="clearfix">
<span class="icon-clock pull-left"></span>
<span class="pull-right"> {{tinfo.sentTime}}min</span>
</div>
</li>
</ul>
</div>
</div>
</div>
and this is the css code:
.list {
margin: 0;
padding: 0;
}
.log-widget-list {
height:100px;
width: 720px;
overflow: hidden;
}
.log-widget-list .scroller{
overflow-x: scroll;
list-style-type: none;
width: 1500px; /* combined width of all LI's */
}
#elements-list li {
width: 100px;
list-style: none;
box-sizing: border-box;
border-top: none!important;
background-color: #0accf8;
padding: 4px;
}
#elements-list li:not(:last-of-type) {
border-right: 3px solid #ffffff;
}
#elements-list [class^="icon-"], #elements-list [class*=" icon-"] {
margin-top: 4px;
font-size: 12px;
}
Now the problem is that i don't want that the horizontal scrollbar appears, but it appears and i don't understand why... Any idea?
add overflow:hidden in #wrapper css.
CSS:
#wrapper {
background: transparent;
width: 550px;
color: white;
height:100%;
overflow:hidden;
}
Demo: http://jsfiddle.net/lotusgodkk/9z48t/5/
DEMO
http://jsfiddle.net/FTUrF/6/
Changed some CSS here:
.log-widget-list {
width: 200px;
height: 300px;
border: 1px solid #000;
overflow: hidden;
}
.log-widget-list .scroller {
width: 215px;
height: 300px;
overflow: scroll;
padding-bottom: 15px;
list-style-type: none;
}
Added height and padding-bottom in .scroller and border in .log-widget-list
and added some more of these:
<span class="pull-right"> {{tinfo.sentTime}}min</span>
Using the following markup, I'm creating an image with two floated text overlays, one for the heading and one for the summary text. It's rendering how I wish and I'm able to use the entire image as well as the headline & summary to access the link except for the area immediately to the right of the 'headline' up to the end of the 'summary'. This happens in all browsers (except IE9 and lower). Any ideas why and how I can get around it?
HTML:
<div class="image">
<img src="Assets/Images/Picture.jpg" alt="Picture" />
<div class="overlay">
Headline
Summo eirmod appareat ex mel. Vim odio error labores ex. Mea alii abhorreant et. Ad has nominati constituam. Sit falli nominati suavitate in.
</div>
</div>
CSS:
body {
border: 0;
color: #5B6064;
font-family: Helvetica, Arial, Sans-Serif;
font-size: .75em;
line-height: 1.6em;
margin: 0;
padding: 0;
background-color: #a5a5a5;
}
a {
text-decoration: none;
color: #5B6064;
}
a:visited {
text-decoration: none;
}
img {
border: 0;
}
.image {
position: relative;
width: 100%;
/* For IE6 */
display: block;
overflow: hidden;
}
.overlay {
position: absolute;
bottom: 10px;
left: 0;
display: block;
}
.headline {
color: #FFF;
font: bold 24px/45px Helvetica, Sans-Serif;
letter-spacing: -1px;
background: #e87b10;
/* Fallback for older browsers */
background: rgba(232,123,16,0.8);
padding: 10px;
float: left;
clear: left;
}
.summary {
max-width: 350px;
margin-top: 3px;
color: #FFF;
font: 14px/14px Helvetica, Sans-Serif;
letter-spacing: 0;
background: #e87b10;
/* Fallback for older browsers */
background: rgba(232,123,16,0.8);
padding: 10px;
float: left;
clear: left;
}
.summary a {
color: #FFF;
}
I'd wrap the whole thing in an a tag (cleaner code). You would need to adjust a bit of your css.
EDIT
I changed the div elements to span so it is syntactically correct (thanks for the reminder Phrogz). Since your css already had display: block for the div elements, changing them to span is not an issue.
<a href="Default.aspx">
<span class="image">
<img src="Assets/Images/Picture.jpg" alt="Picture" />
<span class="overlay">
<span class="headline">Headline</span>
<span class="summary">Summo eirmod appareat ex mel. Vim odio error labores ex. Mea alii abhorreant et. Ad has nominati constituam. Sit falli nominati suavitate in.</span>
</span>
</span>
</a>
The headline is being floated left. If you remove the float and add display:block; to the anchor, it will take up the full image width.