Simple layout with Semantic UI - css

I want to make a simple layout in semantic UI i am new to it, i struggled to make thing work correctly attached is the design :
what you see is the mobile layout. Requirement : The header is fixed, the sidebar is fixed when we scroll through the blog content. We have a simple inverted L shaped, the only moving part is the content.
What is the minimum code to do this in a clean way?

After a few tweak i managed to get this layout
here is the CSS code :
`
/* custom css by me*/
.lateral {
height: 70px;
border-bottom: 1px solid #fff;
margin-left: -1em;
margin-right: -1em;
color: #fff; }
.lateral-item {
background-color: transparent !important;
border: none !important;
box-shadow: none !important;
padding-left: 14px !important; }
.menu-item {
padding-top: 15px !important;
padding-bottom: 0px !important; }
.text-container {
margin-top: 90px !important; }
.lateral-sidebar {
border: 1px solid #FFFFFF;
background-color: #00A42F;
padding-right: 0px !important; }
.custom-green {
background-color: #00A42F !important; }
/* pointer */
.ui.vertical.pointing.menu .item:after {
position: absolute;
top: 50%;
right: 0%;
bottom: auto;
left: auto;
-webkit-transform: translateX(50%) translateY(-50%) rotate(45deg);
-ms-transform: translateX(50%) translateY(-50%) rotate(45deg);
transform: translateX(50%) translateY(-50%) rotate(45deg);
margin: 0em -0.5px 0em 0em;
border: none;
border-top: 1px solid #fff;
border-right: 1px solid #fff; }
.ui.inverted.menu .item:before {
background: rgba(255, 255, 255, 0) none repeat scroll 0 0; }
`
And the HTML Code
`
<div class="ui menu inverted custom-green" style="width: 100%;border:none">
<div class="item custom-green" style="width: 100px;" >
<img class="ui mini image circular centered" src="photo.jpg" />
</div>
<div style="width:100%">
<div>
<div class="ui menu custom-green" style="border: none;box-shadow:none">
<span href="#" class="item">Name</span>
<div class="right menu" style="border: none;box-shadow:none">
Disconnect
</div>
</div>
</div>
<div>
<div class="ui menu custom-green" style="border:none;">
<span style="border:none" href="#" class="item">Page Title</span>
</div>
</div>
</div>
</div>
</div>
`
this is done with Semantic UI, i am not sure if the code is minimal but i needed to override the original css rules.

Related

Folder-like menu css

I'm working with a table-like menu but I can't do it. Here is my CSS.
I'm using bootstrap 5. I can't adjust the padding and also the color of the menu when it's active or not.
.top-nav{
margin-left:0px;
}
.top-bar a {
display: block;
text-align: center;
padding: 20px;
text-decoration: none;
}
.top-bar{
border-bottom: 100px solid white;
border-left: 0 solid transparent;
border-right: 80px solid transparent;
border-top: 80px;
height: 0;
width: 200px;
clip-path: inset(0% 0% 0% 0% round 15px 0px 0px 0px)
}
Here is my HTML
<div class="row top-nav">
<div class="col-md-3 top-bar">
<a class="fw-bold text-primary" href="#home">Users</a>
</div>
<div class="col-md-3 top-bar">
<a class="fw-bold text-primary" href="#home">Warehouse Admin</a>
</div>
<div class="col-md-3 top-bar">
<a class="fw-bold text-primary" href="#home">Sales Rep</a>
</div>
<div class="col-md-3 top-bar">
<a class="fw-bold text-primary" href="#home">Senior Sales Rep</a>
</div>
</div>
My work
This the expected Output
run the snippet and change variables as you like
.folders {
background: lightgray;
padding: 10px;
}
.tabs:after {
content: "";
clear: both;
display: block;
}
.tab {
height: 40px;
line-height: 40px;
width: 150px;
float: left;
background: gray;
border-top-left-radius: 16px 16px;
border-top-right-radius: 16px 16px;
position: relative;
margin-right: 17.5px;
}
.tab.active {
z-index: 100;
background: #fff;
}
.tab:after {
content: "";
display: block;
position: absolute;
border-left: 35px solid gray;
left: 145px;
border-top: 35px solid transparent;
bottom: 0;
}
.tab.active:after {
border-left: 35px solid #fff;
}
.content {
height: 200px;
background: #fff;
}
<div class="folders">
<div class="tabs">
<div class="tab"></div>
<div class="tab active"></div>
<div class="tab"></div>
<div class="tab"></div>
</div>
<div class="contents">
<div class="content"></div>
</div>
</div>

How to get rid of the ribbon border by CSS?

I am trying to create a ribbon around a div using Bootstrap 4.
I can't clean the right border; on mobile, when the page is shrinked, my ribbon overflows to the right, out of parent div: https://jsfiddle.net/auj4q3a2/
Html:
<div class="container-fluid">
<div class="card profile-card">
<div class="container-fluid">
<div class="row user-social-detail">
<div class="col-lg-12 col-sm-12 col-12">
<i class="fa fa-facebook" aria-hidden="true"></i>
<i class="fa fa-twitter" aria-hidden="true"></i>
<i class="fa fa-instagram" aria-hidden="true"></i>
<i class="fa fa-linkedin" aria-hidden="true"></i>
</div>
</div>
</div>
</div>
</div>
CSS:
.profile-card {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
max-width: 475px;
margin: auto;
text-align: center;
}
.user-social-detail{
margin: 0 -30px;
padding: 15px 0px;
background-color: #ffd280;
border-radius: 4px;
}
.user-social-detail a i{
color:#fff;
font-size:23px;
padding: 0px 5px;
}
.user-social-detail::before,
.user-social-detail::after {
content: '';
position: absolute;
z-index: -1;
left: -45px;
top: -28px;
display: block;
width: 40px;
height: 0px;
border: 30px solid transparent;
border-right: 20px solid #e5bd73;
border-bottom-color: transparent;
border-left-color: transparent;
}
.user-social-detail::after {
left: auto;
right: -45px;
border-left: 20px solid #e5bd73;
border-right: 30px solid transparent;
}
How can I fit the ribbon into the container on mobile, as on the left side?
Any suggestion or feedback will be welcomed and greatly appreciated.
Got it!
You have to add
overflow-x: hidden !important; to .container-fluid
EDIT:
Actually, only in 1st .container-fluid this is necessary, so you can add the following to your CSS file:
.container-fluid:first-of-type {
overflow-x: hidden !important;
}

CSS make banner look like it comes from the background

I'm trying to make it look like in the image.
This is what i have done so far:
But i cant figure out how to do the line so that it looks like the banner comes from behind the line.
My markup for the banner is this:
<div class="step-arrows">
<div class="top-line"></div>
<div class="box">
<div>1</div>
</div>
<div class="arrow"></div>
<div class="top-line"></div>
<div class="box">
<div>2</div>
</div>
<div class="arrow"></div>
<div class="top-line"></div>
<div class="box">
<div>3</div>
</div>
<div class="arrow"></div>
</div>
and this is the styles i have done so far:
.step-arrows {
margin-left: 20%;
}
.step-arrows .box {
background-color: #2E8074;
width: 100px;
height: 100px;
color: white;
text-align: center;
}
.step-arrows .box > div {
font-size: 80px;
}
.step-arrows .arrow {
width: 0px;
height: 0px;
border-top: 50px solid #2E8074;
border-left: 50.5px solid transparent;
border-right: 50.5px solid transparent;
margin-top: -1px;
}
I have tried to do it with box-shadow but i haven't been able to make it look very good :(
EDIT: (My last try)
.step-arrows .top-line {
width: 150px;
height: 2px;
margin-left: -25px;
z-index: 99;
position: absolute;
border-radius: 20px;
background-color: rgb(0, 0, 0);
-webkit-box-shadow: 0px 67px 12px 15px rgba(0,0,0,0.68);
-moz-box-shadow: 0px 67px 12px 15px rgba(0,0,0,0.68);
box-shadow: 0px 3px 9px 4px rgb(0, 0, 0);*/
}

CSS3 transform scale covers another elements on hover

I have a blog element which has 2 children: .blog-header (contains background image) and .blog-body.. When hovering the mouse on .blog-header, i expect the image to be scaled perfectly. But here's the problem: the image takes the space where .blog-body should lay on
Here's my code:
.blog {
background: white;
margin-top: 20px;
border-top: 3px primary solid;
border-bottom 3px solid #eee;
}
.blog .blog-header {
overflow: hidden;
z-index 90;
}
.blog .blog-header .blog-bg-header {
height: 275px;
background-position: center;
background-size: cover;
transition: 0.25s ease-in-out;
}
.blog .blog-header .blog-bg-header:hover {
cursor: pointer;
transform: scale(1.3);
}
.blog-body {
margin: -60px 20px 0 20px;
padding: 20px 20px 10px 20px;
background: white;
z-index 100;
}
<article class="blog">
<header class="blog-header">
<div class="blog-bg-header" style="background-image: url('http://placehold.it/1350x750')"></div>
</header>
<div class="blog-body">
<time class="blog-date">24 Jan</time>
<a href="example.com">
<h2>Title</h2>
<p>Content</p>
</a>
</div>
</article>
The external link to see the issue http://jsfiddle.net/a49evb1q/
Is there any solution to overcome the issue?
Your z-index on .blog-body will have no effect because you aren't giving it a position.
.blog-body {
margin: -60px 20px 0 20px;
padding: 20px 20px 10px 20px;
background: white;
z-index 100;
position: relative; <!-- ADD THIS
}
Example...
.blog {
background: white;
margin-top: 20px;
border-top: 3px primary solid;
border-bottom 3px solid #eee;
}
.blog .blog-header {
overflow: hidden;
z-index 90;
}
.blog .blog-header .blog-bg-header {
height: 275px;
background-position: center;
background-size: cover;
transition: 0.25s ease-in-out;
}
.blog .blog-header .blog-bg-header:hover {
cursor: pointer;
transform: scale(1.3);
}
.blog-body {
margin: -60px 20px 0 20px;
padding: 20px 20px 10px 20px;
background: white;
z-index 100;
position:relative;
}
<article class="blog">
<header class="blog-header">
<div class="blog-bg-header" style="background-image: url('http://placehold.it/1350x750')"></div>
</header>
<div class="blog-body">
<time class="blog-date">24 Jan</time>
<a href="example.com">
<h2>Title</h2>
<p>Content</p>
</a>
</div>
</article>
EDIT
Actually, you can remove the z-index values from your code altogether. A position: relative will do the trick on it's own
Updated example...
.blog {
background: white;
margin-top: 20px;
border-top: 3px primary solid;
border-bottom 3px solid #eee;
}
.blog .blog-header {
overflow: hidden;
}
.blog .blog-header .blog-bg-header {
height: 275px;
background-position: center;
background-size: cover;
transition: 0.25s ease-in-out;
}
.blog .blog-header .blog-bg-header:hover {
cursor: pointer;
transform: scale(1.3);
}
.blog-body {
margin: -60px 20px 0 20px;
padding: 20px 20px 10px 20px;
background: white;
position:relative;
}
<article class="blog">
<header class="blog-header">
<div class="blog-bg-header" style="background-image: url('http://placehold.it/1350x750')"></div>
</header>
<div class="blog-body">
<time class="blog-date">24 Jan</time>
<a href="example.com">
<h2>Title</h2>
<p>Content</p>
</a>
</div>
</article>

Right side wrap for ribbon does not vertically align

I'm attempting to make a ribbon for a navbar using bootstrap and my own CSS work. I have the majority of what I need finished, however I cannot seem to make the right side of the ribbon align with the navbar.
(colors purposefully bad to make the example obvious)
Here's an example of my situation: JSBin example
CSS:
nav.navbar {
border-radius: 0px;
border-left: none;
border-right: none;
box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.15), 0 1px 5px -5px rgba(0, 0, 0, 0.075);
box-shadow: none;
}
div.ribbon-left {
left: -13px;
float: left;
width: 13px;
border-right: none;
}
div.ribbon-right {
width: 13px;
float: right;
right: -13px;
border-left: none;
}
div.ribbon-left, div.ribbon-right {
position: relative;
/*background: linear-gradient(to bottom, #fff 0, #f8f8f8 100%) repeat-x;*/
background: white;
height: 100%;
min-height: 52px;
border: 1px solid transparent;
}
div.ribbon-top-back {
z-index: -10;
border-color: transparent transparent #f0f0f0 transparent;
border-style: solid;
border-width: 13px;
height: 0px;
width: 0px;
position: relative;
left: -1px;
top: -27px;
}
div.ribbon-right > div.ribbon-top-back {
left: -14px;
}
/* Temporary coloring to make things obvious */
body {
background-color: blueviolet;
}
.container {
background-color: #c0a16b;
}
html, body, div.container {
height: 100%;
}
A general idea of the ribbon layout:
<div class="row">
<div class="ribbon">
<div class="ribbon-left">
<div class="ribbon-top-back"></div>
</div>
<div class="ribbon-content">
<!-- bootstrap navbar -->
</div>
<div class="ribbon-right">
<div class="ribbon-top-back"></div>
</div>
</div>
</div>
How can I make the element align correctly?
So after some testing, it became apparent that if I wanted the element to be in-line, I would need to declare it before the navbar (seeing as it's relative positioning but float: right):
<div class="row">
<div class="ribbon">
<div class="ribbon-left">
<div class="ribbon-top-back"></div>
</div>
<div class="ribbon-right">
<div class="ribbon-top-back"></div>
</div>
<div class="ribbon-content">
<!-- bootstrap navbar -->
</div>
</div>
</div>

Resources