Modify style with b-collapse and css - css

what I am trying to do is modify the style of my b-collapse since by default it has a vertical style that I think and what I want is to give my menu a horizontal style
This is how I implement it:
<div style="background-color:white;">
<b-collapse id="collapse-cat-lvl1-469">
<div data-cat-acc="473" class="grid-item parent-lvl-2">
<a class="link -1 grid-sty-1" href="#" target="_self" data-menu-item-id="473">
<span class="text">GTI</span>
</a>
</div>
<div data-cat-acc="474" class="grid-item parent-lvl-2">
<a class="link sty-1 grid-sty-1" href="#" target="_self" data-menu-item-id="474">
<span class="text">Pets</span>
</a>
</div>
</b-collapse>
</div>
You can modify in if this: collapse-cat-lvl1-469 ???
What I intend is to give it better style with CSS, or some way that I can see my menu horizontally and not vertically
I have this:
I want to get to this:
My CSS:
.navbar-greetings, .login-section{display: none}
#menu-header.collapse:not(.show){
display: block;
}
#menu-header{
position: fixed;
top: 25px;
max-width: 83%;
margin: 0 auto;
left: 8.32%;
.panel{
button{
display: block;
color: white;
font-size: 13px;
font-family: 'VWHead-Bold';
}
}
#accordion-mbl-menu{
display: flex;
}
}
I am really new to this, searching the web I have not been able to solve this problem

I believe that you can do this by just CSS without using b-collapse, and maybe using b-dropdown is better than b-collapse but I understand your problem and make a code snippet.
Look at this solution and maybe it'll be useful for you.
new Vue({
el: '#app',
})
.customHorizontalList {
list-style: none;
display: flex;
flex-direction: row;
}
.customHorizontalList>li {
margin-right: 1rem;
}
<link type="text/css" rel="stylesheet" href="https://unpkg.com/bootstrap#4.5.3/dist/css/bootstrap.min.css" />
<script src="https://unpkg.com/vue#2.6.12/dist/vue.min.js"></script>
<script src="https://unpkg.com/bootstrap-vue#2.21.2/dist/bootstrap-vue.min.js"></script>
<div id="app">
<b-button v-b-toggle.collapse-1 variant="primary">Toggle Collapse</b-button>
<b-collapse id="collapse-1" class="mt-2">
<ul class="customHorizontalList">
<li>ITEM 1</li>
<li>ITEM 2</li>
<li>ITEM 3</li>
</ul>
</b-collapse>
</div>

Use display: flex on containing element

Related

Dynamically generated ul(s) are not aligning in center

I am stuck at it for very long time and googling did not helped me much. I am generating ul(s) dynamically, their count may also very according to number of items found from db.
Here's what its looking like:
The code:
CSS:
#container{
align-content: center;
}
ul{
display:inline-flex;
padding: 5px;
}
pug:
div(id="container")
each item in items_list
ul
a(href=somelink)
div(class="image")
//- a(href=url)
img(src="/images.link", alt="", height="120px", width="160px", class="dp")
p(id="title") Title:- #{item.title}
p(id="stuff") stuff:- #{item.stuff}
I have tried align-content, justify content, etc. Also I am not giving a property like margin-left or something as number of uls will vary. (I want them to get displayed in a horizontal manner.)
First think you missed li tag which need to list after ul
I am not sure which you want but i guess you want this. This is simple demo code
#container {
align-content: center;
}
ul {
padding: 5px;
}
li {
list-style: none;
}
a {
float: right;
}
div {
float: left;
}
p {
float: left;
margin-left: 20px;
}
<div id="container">
<ul>
<li>
<a href="#">
<div>
<p id="title">Test Code title1</p>
<p id="stuff">Test Code stuff1</p>
</div>
</a>
</li>
<li>
<a href="#">
<div>
<p id="title">Test Code title2</p>
<p id="stuff">Test Code stuff2</p>
</div>
</a>
</li>
<li>
<a href="#">
<div>
<p id="title">Test Code title3</p>
<p id="stuff">Test Code stuff3</p>
</div>
</a>
</li>
</ul>
</div>

Why is ul aligned to the bottom

I have been seriously messing with this one thing for over an hour now. Basically I have a navigation bar, there is an icon on the far left, and the links are aligning to the bottom of the image.
I have tried messing with padding, margins, line height, vertical-align and everything else I could think of. I also tried having the image inside and before the ul. I need the ul items (will be links) to be vertically aligned to the center of the icon.
I have put all the code into one file that I will copy here. Also, when you post please explain why a solution will work, not just post code. The other posts I searched for about this before I posted here didn't explain anything, just included code that didn't help when I tried it. Unfortunately, because I have no idea what the solution is or what it relates to I am including all of the code.
body {
margin: 0;
/*background-color: #10f009;*/
font-size: 62.5%;
font-family: sans-serif;
}
img {
margin: 0 0 0 0;
max-width: 100%;
height: 50%;
}
.smallSection {
margin: 100px;
}
.paragraph {
font-size: 2em;
max-width: 500px;
}
.title {
font-size: 2.4em;
}
.list {
list-style: solid inside url("");
font-size: 2em;
}
.nav-link {
list-style-type: none;
display: inline-block;
text-align: center;
font-size: 2em;
width: 200px;
border: 1px solid red;
}
.nav-icon {
display: inline-block;
border: 1px solid red;
}
.largeSection {} #section1 {
background-image: url("../img/placeholder.jpg")
}
#nav {
border: 1px solid red;
margin: 0;
padding: 0;
align: top;
height: 100px;
line-height: 1;
}
/*temporary*/
div {
border: 1px solid red;
}
<!-- Dawn Little -->
<div id="section1" class="largeSection">
<!-- Navigation -->
<div>
<ul id="nav">
<div style="width:70px;height:70px;border: 1px solid red;display: inline-block;">
<!-- The img link is obviously broken so this is here instead. -->
</div>
<!-- <img src="img/herbfalife-icon.png" width="70px" height="70px" class="nav-icon"> -->
<li class="nav-link">Who am I</li>
<li class="nav-link">What I do</li>
<li class="nav-link">3-Day Trial</li>
<li class="nav-link">Challenges</li>
<li class="nav-link">Become a Coach</li>
</ul>
</div>
<div class="smallSection">
<p class="paragraph">
<span class="title">Client Name<br /></span> Hi, I'm a wife, mother, and Personal Wellness Coach with Herbalife Nutrition. My super power - I change lives.
</p>
</div>
</div>
<!-- What I do -->
<div id="section2" class="largeSection">
<div class="smallSection">
<p class="paragraph">
<span class="title">What I do</span>
<ul class="list">
<li>Wellness Evaluations</li>
<li>Nutrition Coaching</li>
<li>Impact Lifestyle</li>
<li>Get Results</li>
<li>Coach Coaches</li>
</ul>
</p>
</div>
</div>
<!-- 3-day trial -->
<div id="section3" class="largeSection">
<div class="smallSection">
<p class="title">
Try Our 3-Day Trial
</p>
<p class="title">
What you get:
</p>
<ul class="list">
<li>Personal Wellness Coach</li>
<li>Wellness Evaluation</li>
<li>Meal Plan</li>
<li>Daily Support</li>
<li>Plan of Action</li>
<li>6 Meals</li>
<li>Metabolism Booster</li>
</ul>
</div>
</div>
<!-- Challenges -->
<div id="section4" class="largeSection">
<div class="smallSection">
<p class="title">
Join a Weight Loss Challenge
</p>
<p class="title">What you get:</p>
<ul class="list">
<li>Personal Wellness Evaluation</li>
<li>Personalized Program</li>
<li>Nutrition Classes</li>
<li>ommunity of Support</li>
<li>Accountability</li>
<li>Opportunity to Win Cash &amp Prizes</li>
</ul>
</div>
</div>
<!-- Become a coach -->
<div id="section5" class="largeSection">
<div class="smallSection">
<p class="title">
Become a Coach
</p>
<p class="title">
What you get:
</p>
<ul class="list">
<li>Opportunity to Change Lives</li>
<li>Opportunity for Personal &amp Financial Growth</li>
<li>Training</li>
<li>Potential to Change Lives in Over 90 Countries</li>
<li>Be Part of a Team</li>
<li>Get in the Best Shape You've Ever Been</li>
</ul>
</div>
</div>
This way that you are coding is a bit tricky to align.I will rewrite your code. However, I recommend you to use a CSS framework like bootstrap or zurb.
Firstly, you need to rewrite HTML part like
<!-- Navigation -->
<div class="header clearfix">
<div class="logo">
<!-- The img link is obviously broken so this is here instead. -->
</div>
<div class="nagivation">
<ul id="nav">
<li class="nav-link">Who am I</li>
<li class="nav-link">What I do </li>
<li class="nav-link">3-Day Trial</li>
<li class="nav-link">Challenges</li>
<li class="nav-link">Become a Coach</li>
</ul>
</div>
</div>
I have added header and nagivation
then add these lines to your css to
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.clearfix { display: inline-block; }
/* start commented backslash hack \*/
* html .clearfix { height: 1%; }
.clearfix { display: block; }
/* close commented backslash hack */
.header{
min-height:70px;
clear:both
}
.logo{
width:20%;
float:left;
}
.nagivation{
width:80%;
float:right;
}
you need to remove #nav also in your CSS code.
based on your needs, you can change this class
.nagivation #nav{
// add needed adjustment
}
you can have an access to all codes here https://jsfiddle.net/mhadaily/7f152z3r/
The easiest way to accomplish what you want is to simply float the icon as seen in the css below and in this pen.
#nav {
border: 1px solid red;
height:100px;
line-height:1;
display:inline-block;
}
.nav-icon {
display: inline-block;
border: 1px solid red;
float:left;
}
Floats force other elements to flow around the floated element. You just want to be wary of floats because they wreak havoc on your layout if you're not vigilant (they collapse their parent containers). You can read all about it here.
I am not a UI expert. But By looking at the following tag I can asked you few question to understand? Because You are writing non-li tags within ul. Try ti wrap your code with li tag.
Just go to w3cshool link.
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_lists_menu
http://www.w3schools.com/html/html_lists.asp
<ul id="nav">
<div style="width:70px;height:70px;border: 1px solid red;display: inline-block;">
<!-- The img link is obviously broken so this is here instead. -->
</div>
<!-- <img src="img/herbfalife-icon.png" width="70px" height="70px" class="nav-icon"> -->
<li class="nav-link">Who am I</li>
<li class="nav-link">What I do </li>
What about simply moving the li elements up a little bit?
.nav-link {
position: relative;
bottom: 20px;
}
First off, the only elements that should be inside a <ul> are <li>. That <div> (or link or whatever it is in reality) may cause you grief.
The real problem, however, is that you're using the wrong CSS property on the wrong element. You want vertical-align (not "align"), and it should be applied to the list-items (not the container).
Try this:
<ul>
<li class="nav-link"><!-- img here --></li>
<li class="nav-link">Who am I</li>
<li class="nav-link">What I do</li>
<li class="nav-link">3-Day Trial</li>
<li class="nav-link">Challenges</li>
<li class="nav-link">Become a Coach</li>
</ul>
with
.nav-link { vertical-align: middle; }

Automatically resize li and add space between them (rtMedia masonry)

I'm using the rtMedia plugin to display a masonry gallery with images uploaded by users. My question is: how can I add space between the images to distribute them evenly inside the ul? When I add margin, the li elements aren't displayed next to each other anymore (the third one appears in the next row). But when I add padding the div inside the li appears larger than the rest.
I added the following CSS code to resize the li elements automatically.
.rtmedia-container {
display: table;
width: 100%;
}
.rtmedia-container ul {
display: table-row;
}
.rtmedia-container ul li {
display: table-cell;
max-width: 33%;
}
<div class="rtmedia-container">
<div id="rtm-gallery-title-container">...</div>
<ul class="rtmedia-list">
<li class="rtmedia-list-item">
<div class="rtmedia-gallery-item-actions">...</div>
<a class="rtmedia-list-item-a"> ... </a>
</li>
<li class="rtmedia-list-item">
<div class="rtmedia-gallery-item-actions">...</div>
<a class="rtmedia-list-item-a"> ... </a>
</li>
<li class="rtmedia-list-item">
<div class="rtmedia-gallery-item-actions">...</div>
<a class="rtmedia-list-item-a"> ... </a>
</li>
</ul>
</div>
I just noticed that the gallery is overlaping the div (rtm-gallery-title-container) in every browser except for Firefox. Does someone know how to solve this problem?
I also had to add "position: relative" to the div .rtmedia-container, because the gallery hasn't been displayed on the right position in other browsers.
You can use border-collapse:separate + border-spacing
Snippet
.rtmedia-container {
display: table;
width: 100%;
table-layout: fixed; /* optional */
border-collapse: separate;
border-spacing: 5px;
/*demo */
border: 1px dashed red
}
.rtmedia-container ul {
display: table-row;
}
.rtmedia-container ul li {
display: table-cell;
width: 33%;
}
.rtmedia-container ul li img {
max-width: 100%;
height:auto;
display:block
}
<div class="rtmedia-container">
<ul class="rtmedia-list">
<li class="rtmedia-list-item">
<div class="rtmedia-gallery-item-actions">...</div>
<a class="rtmedia-list-item-a">
<img src="//lorempixel.com/700/300" />
</a>
</li>
<li class="rtmedia-list-item">
<div class="rtmedia-gallery-item-actions">...</div>
<a class="rtmedia-list-item-a">
<img src="//lorempixel.com/700/300" />
</a>
</li>
<li class="rtmedia-list-item">
<div class="rtmedia-gallery-item-actions">...</div>
<a class="rtmedia-list-item-a">
<img src="//lorempixel.com/700/300" />
</a>
</li>
</ul>
</div>

Ionic: Unable to stack li vertically

Following is code:
<div class="row">
<div class="col-40">
<ul class="">
<li class="payment-type">Visa</li>
<li class="payment-type">Mastercard</li>
</ul>
</div>
<div class="col-60">60</div>
</div>
CSS
.payment-type {
background-color: lightgray;
text-align: center;
margin-top: 5px;
height: 50px;
}
AS you can see it only shows Visa rather both divs. The desired result is to to make a box like li with certain padding.

Materialize framework: responsive logo in navbar

I'm creating a website in materialize framework. I have a problem with logo in navbar. So my logo is very big (6202x3800 px) and I don't have any other version. I want to put this logo in navbar but it always exceeds the frame of nav-wrapper. I tried to add class responsive-img but it didn't work at all.
Here is my code:
#allcontent {
background-color: white;
margin: 2%;
}
body {
background: #d26335;
}
nav {
color: black;
}
<div class="row" id="allcontent">
<div class="navbar-default" id="navbar">
<nav class="white">
<div class="nav-wrapper">
<img class="responsive-img" id="logo" src="<!-- my image -->"/>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><i class="material-icons">search</i>
</li>
<li>colors</li>
</ul>
</div>
</nav>
</div>
</div>
All you have to do is control the size of the image with CSS to whatever dimensions you want:
.navbar-material .nav-wrapper .brand-logo img {
height: 64px;
}
Or use a image editor to resize the image to something more reasonable for a logo to start with. See Photoshop, GIMP or Sketch to name a few.
(*And definitely compress images; if you're not using a build system to do this there's always something like TINYpng)
See working example Snippet.
(**note all classes used are default MaterialCSS minus the .navbar-material class and it looks like you're mixing Bootstrap3 classes with MaterialCSS classes)
$(".button-collapse").sideNav();
body {
background: #d26335;
}
nav.navbar-material {
background: #d26335;
border: none;
box-shadow: none;
}
.navbar-material .nav-wrapper {
background: white;
margin: 20px;
}
.navbar-material .nav-wrapper > ul > li > a {
color: black;
}
.navbar-material .nav-wrapper .brand-logo img {
height: 64px;
}
.navbar-material .nav-wrapper .button-collapse i {
color: black;
}
#media (max-width: 600px) {
.navbar-material .nav-wrapper .brand-logo img {
height: 56px;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.1/js/materialize.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.1/css/materialize.min.css" rel="stylesheet" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<nav class="navbar-material">
<div class="nav-wrapper">
<a href="#!" class="brand-logo">
<img src="http://placehold.it/6202x3800/FF001E/fff">
</a>
<i class="material-icons">menu</i>
<ul class="right hide-on-med-and-down">
<li>Sass
</li>
<li>Components
</li>
<li>Javascript
</li>
<li>Mobile
</li>
</ul>
<ul class="side-nav" id="mobile-demo">
<li>Sass
</li>
<li>Components
</li>
<li>Javascript
</li>
<li>Mobile
</li>
</ul>
</div>
</nav>

Resources