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>
Related
How to make the <dash> automatically increase the height with respect to <text> and <subtext> like in mobile device ?
Also, how to fit the content of <text> and <subtext> to the <wrapper> class ? Right now, it horizontally overflows and breaks it. The code right now is non-responsive in essence. I've tried using width with fixed px but it's too troublesome to accomodate all devices.
.main .circle{
border-radius: 50%;
width: 36px;
height: 36px;
padding: 8px;
text-align: center;
font-size: 1.7em;
color: white;
/* display: inline-block; */
border: black 2px solid;
}
.main .one{
background: #BDB3FF;
/* display: inline-block; */
}
.main .two{
background: #6F42C1;
/* display: inline-block; */
}
.main .three{
background:#413687;
}
.main .wrapper{
border: black 2px solid;
/* display: inline-block; */
}
.main .dash {
--s:15px; /*control the space between dashes */
border: black 2px solid;
position: relative;
left: 25px;
--s:15px;
height: 6px;
width: 6px;
height: 180px;
/* display: inline-block; */
background:
radial-gradient(circle closest-side,#BDB3FF 98%,#0000) 0 0/100% var(--s),
linear-gradient(#BDB3FF 50%, #0000 0) 0 calc(var(--s)/2)/100% calc(2*var(--s));
}
.main .dash_one{
background:
radial-gradient(circle closest-side,#BDB3FF 98%,#0000) 0 0/100% var(--s),
linear-gradient(#BDB3FF 50%, #0000 0) 0 calc(var(--s)/2)/100% calc(2*var(--s));
}
.main .dash_two{
background:
radial-gradient(circle closest-side,#6F42C1 98%,#0000) 0 0/100% var(--s),
linear-gradient(#6F42C1 50%, #0000 0) 0 calc(var(--s)/2)/100% calc(2*var(--s));
height: 220px;
}
.main .dash_three{
height:250px;
}
.main .subtext{
width:650px;
border: black 2px solid;
display: inline-block;
font-size: 2em;
position: relative;
left: 20px;
}
.main .text{
width: max-content;
color: black;
display: inline-block;
position: relative;
left: 50px;
bottom: 30px;
}
<div class="main">
<div class="wrapper">
<div class="circle one">1 <span class="text">Post Your Question</span></div>
<div class="dash dash_one">
<span class="subtext">Just attach your assignment/question along with the reference materials or any specific guideline/requirement. select your deadline and submit it to get assignment help
</span>
</div>
<div class="circle two">2 <span class="text">Pay To Get Assignment Help</span></div>
<div class="dash dash_two">
<span class="subtext">Our team will contact you once we recieve your request with the quoted price for your assignment help on email/whatsapp. you will have to pay us to do your assignment. Next, we will assign an expert to do your assignment
</span>
</div>
<div class="circle three">3 <span class="text">Get Assignment Solution</span</div>
<div class="dash_three">
<span class="subtext">Our team will contact you once we recieve your request with the quoted price for your assignment help on email/whatsapp. you will have to pay us to do your assignment. Next, we will assign an expert to do your assignment
</span>
</div>
</div>
</div>
One way is to use flex boxes and don't use pixel sizes
.main
{
--circle-size: 2em;
font-family: arial;
font-size: 1.5em;
}
.main .circle{
border-radius: 50%;
min-width: var(--circle-size);
height: var(--circle-size);
line-height: var(--circle-size);
text-align: center;
font-weight: bold;
color: white;
/* display: inline-block; */
/*border: black 2px solid;*/
}
.main .one{
background: #BDB3FF;
/* display: inline-block; */
}
.main .two{
background: #6F42C1;
/* display: inline-block; */
}
.main .three{
background:#413687;
}
.main .wrapper{
/* border: black 2px solid; */
/* display: inline-block; */
}
.main .dash /* changed */
{
display: flex;
}
.main .dashes { /* new */
--s:15px; /*control the space between dashes */
/* border: black 2px solid; */
--s:15px;
--dash-width: 6px;
min-width: var(--dash-width);
/* display: inline-block; */
background:
radial-gradient(circle closest-side,#BDB3FF 98%,#0000) 0 0/100% var(--s),
linear-gradient(#BDB3FF 50%, #0000 0) 0 calc(var(--s)/2)/100% calc(2*var(--s));
/* added */
display: inline-block;
margin: 0 calc((var(--circle-size) - var(--dash-width)) / 2);
vertical-align: top;
}
.main .dash_three > .dashes
{
border: 0;
background: 0;
}
.main .dash_one{
background:
radial-gradient(circle closest-side,#BDB3FF 98%,#0000) 0 0/100% var(--s),
linear-gradient(#BDB3FF 50%, #0000 0) 0 calc(var(--s)/2)/100% calc(2*var(--s));
}
.main .dash_two{
background:
radial-gradient(circle closest-side,#6F42C1 98%,#0000) 0 0/100% var(--s),
linear-gradient(#6F42C1 50%, #0000 0) 0 calc(var(--s)/2)/100% calc(2*var(--s));
/* height: 220px;*/
}
/*
.main .dash_three{
height:250px;
}
*/
.main .subtext{
/* border: black 2px solid; */
display: inline-block;
margin: 0.5em 0 1em 0.5em;
/* removed */
/*
width:650px;
position: relative;
left: 20px;
*/
}
.main .text{
/* width: max-content; */
color: black;
display: inline-block;
font-weight: bold;
margin: 0 0 0 0.5em;
/*
position: relative;
left: 50px;
bottom: 30px;
*/
}
.main .headline
{
display: flex;
align-items: center;
}
<div class="main">
<div class="wrapper">
<div class="headline">
<div class="circle one">1</div>
<span class="text">Post Your Question</span>
</div>
<div class="dash dash_on">
<span class="dashes"></span>
<span class="subtext">Just attach your assignment/question along with the reference materials or any specific guideline/requirement. select your deadline and submit it to get assignment help
</span>
</div>
<div class="headline">
<div class="circle two">2</div>
<span class="text">Pay To Get Assignment Help</span>
</div>
<div class="dash dash_two">
<span class="dashes"></span>
<span class="subtext">Our team will contact you once we recieve your request with the quoted price for your assignment help on email/whatsapp. you will have to pay us to do your assignment. Next, we will assign an expert to do your assignment
</span>
</div>
<div class="headline">
<div class="circle three">3</div>
<span class="text">Get Assignment Solution</span>
</div>
<div class="dash dash_three">
<span class="dashes"></span>
<span class="subtext">Our team will contact you once we recieve your request with the quoted price for your assignment help on email/whatsapp. you will have to pay us to do your assignment. Next, we will assign an expert to do your assignment
</span>
</div>
</div>
</div>
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);*/
}
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.
I am trying to achieve the box-shadow inside the right-border, currently everything is working fine except the shadow is getting display outside the right border. Following is the js-fiddle sample code I have tried...
http://jsfiddle.net/5y1guk6d/1/
HTML:
<div class="header">
<div class="header-bar">
<h1 class="title">Page title</h1>
</div>
</div>
<div class="main">
<div class="left-bar">
<div class="menu">
Menu Content
</div>
</div>
<div class="content">
Main content area
</div>
</div>
CSS:
.header {
width: 100%;
height: 40px;
top: 0;
color: white;
}
.header-bar {
height: 100%;
overflow: hidden;
background-color: #009BE1;
}
h1.title {
display: inline-block;
font: bold 16px Arial, sans-serif;
margin: 0 5px 0 15px;
position: relative;
top: 25%;
}
.main {
width: 100%;
overflow: hidden;
position: absolute;
top: 48px;
bottom: 0;
}
/* left bar */
.left-bar {
width: 160px;
float: left;
padding:10px;
background-color: #F0F0F0;
height: 100%;
position: relative;
border-right:1px solid #aaa;
box-shadow:5px 0 5px #ccc;
}
.content {
overflow: hidden;
left: 12px;
padding: 5px 17px 5px 5px;
height: 100%;
position: relative;
}
Appreciated your help..
If you want the box shadow to appear inside of the element instead of outside, use inset. Then you want to invert the x-offset so it appears on the right side.
box-shadow:inset -5px 0 5px #ccc;
http://jsfiddle.net/5y1guk6d/3/
http://www.jsfiddle.net/Zn4BH/1/
HTML:
<div id="divOutput">
<h1>Output</h1>
<div id="divButtons">
<button>One</button>
<button>Two</button>
</div>
<textarea name="tarOutput" id="tarOutput">[Text]</textarea>
</div>
CSS:
#divOutput {
border: 2px solid #000;
background-color: #f90;
padding: 10px;
height: 300px
}
#divButtons {
border: 2px solid #000;
background-color: #fb0;
margin-top: 10px;
padding: 2px;
}
textarea {
margin-top: 10px;
width: 100%;
height: 100%; /* ??? Doesn't seem to work */
}
Take a look at this post: CSS 100% height with padding/margin