Button padding modified on icon added to materialize dropdown - css

I am using a materialize dropdown.
Without any icon the button looks ok, however if I add an icon like this:
{/* <!-- Dropdown Trigger --> */}
<a className='dropdown-trigger btn' href='#!' data-target='dropdown1'>Type<i className="large material-icons">arrow_drop_down</i></a>
The padding gets affected and the text goes down, see picture:
What would be the way to solve this? On the other hand is there any way to see or get materialize code into a project to check the code and check what the css classes do, so as to correct small issues like this or extend some?
By the way, I am using react.
Thanks
Edit: What I tried:
<div className="row" style={{alignItems:'center'}}>
<a className='dropdown-trigger btn' href='#!' data-target='dropdown1'>Type<i className="large material-icons">arrow_drop_down</i></a>
</div>

You can try to put the materalize helper valign-wrapper div under the a tag like this:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<a class='dropdown-trigger btn' href='#!' data-target='dropdown1'>
<div class="valign-wrapper">
Type<i class="large material-icons">arrow_drop_down</i>
</div>
</a>
In your case, the your code should be:
<a className='dropdown-trigger btn' href='#!' data-target='dropdown1'>
<div className="row" style={{alignItems:'center'}}>
Type<i className="large material-icons">arrow_drop_down</i>
</div>
</a>

Related

How can i increase the size of an icon

As a backend developer, I prefer to use bootstrap or materialize css to design a web page, now I want to increase the size an icon, but the only way to do this, is by using pure css, but i have little knowledge about it, is there anyone who can help me to increase the size of this google icon:
I'am using materialize css:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
google icons links:
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD#20..48,100..700,0..1,-50..200" />
<div class="col">
<a href="{% url 'Create-Primary-Albums' %}"><span class="material-symbols-outlined">
create_new_folder
</span></a>
</div>
You can increase the icon size by increasing your font-size value in css. You can either use SaaS to modify your martialize CSS file or you need to add your custom css to increase the icon-size.
You can increase size by using in-line css. You can adjust the font-size value is pixel or other varients like rem to get the size you want. See the code below...
<div class="col">
<a href="{% url 'Create-Primary-Albums' %}">
<span class="material-symbols-outlined" style="font-size: 20px;">
create_new_folder
</span>
</a>
</div>

<Link> component in NextJS seems to lose the cursor-pointer with a <div> as child component

I'm using NextJS and wanted to configure a top navigation header bar. In the left-hand side of my nav bar, I have a small svg and text that I would like to be Link's to the site's root. The Link component will not allow multiple children, so I have done this:
<Link href="/">
<div className="">
<img className="" src="/whistle.svg" />
<span className="">Root!</span>
</div>
</Link>
however, when I do this the entire div block loses it cursor-pointer and I need to then set a specific class of cursor pointer. I am also using tailwindCSS. I'm not sure what I'm doing wrong here in this instance - any help is appreciated!
<Link> must have <a> tag inside. You define your styles by yourself, so just add cursor pointer class of style to your div. You can add className="cursor-pointer" to your div instead of the style described.
<Link href="/">
<a>
<div className="" style={{cursor: 'pointer'}}>
<a>
<img className="" src="/whistle.svg" />
<span className="">Root!</span>
</a>
</div>
</a>
</Link>
next/link no longer requires manually adding as a child:
https://nextjs.org/blog/next-13#nextlink
import Link from 'next/link'
// Before
// Next.js 12: `<a>` has to be nested otherwise it's excluded
<Link href="/about">
<a>About</a>
</Link>
// Next.js 13: `<Link>` always renders `<a>`
<Link href="/about">
About
</Link>

Hide div on medium / small resolution

I have two main divs on page and I want to hide on of them in case user comes from tablet / phone.
Based on documentation I tried something like:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<div class="contrainer row">
<div class="col-lg-6 col-md-12">
SHOW ME ALWAYS!
</div>
<div class="col-lg-6 hidden-md-down">
HIDE ME ON SMALL
</div>
</div>
Unfortunately it doesn't work. Second div will display all the time. Any idea what I'm doing wrong?
4.0.0-beta no longer has hidden-*, see Migrating to v4:
Our responsive utility classes have largely been removed in favor of explicit display utilities.
The .hidden and .show classes have been removed because they conflicted with jQuery’s $(...).hide() and $(...).show() methods. Instead, try toggling the [hidden] attribute or use inline styles like style="display: none;" and style="display: block;".

Align badge items in bootstrap list-group without custom css file

I am trying bootstrap 3
here is the code
<body>
<div class="container">
<div class="list-group">
All inbox <span class="badge">1099</span>
<div class="list-group-item">
Unread <span class="badge">100</span>
<br>
Today <span class="badge">10</span>
<br>
This week <span class="badge">23</span>
<br>
This month <span class="badge">67</span>
</div>
Bookmarked <span class="badge">3</span>
Deleted <span class="badge">10</span>
</div>
</div>
<!-- scripts here -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
the result is
how do I get the numbers of links Unread, Today, This week, This month align to the right like the rest? Unread should be heading item and Today, This week, This month need to be subitems.
without using custom css file?
CSS would be a simpler solution. But if you can't use CSS, you must change your HTML. The key is to take advantage of the existing Bootstrap CSS rule that makes the badges float to the right on All Inbox, Bookmarked, and Deleted:
.list-group-item > .badge {
float: right;
}
This means elements with the class badge must be directly inside an element with the class list-group-item- not nested inside another element, like you have it now.
This might change your layout, though. If you want to keep your layout as-is, add the class pull-right to each span with the class badge. This will make the badges float to the right.

On-demand hide or show block in responsive view with CSS

I have always found replies to my questions here even before I asked them. Right now I am facing a problem regarding the responsive adaption of a site I created (www.cichlidae.com) that led me to post this question after several years of just reading.
In my site, when a break-point is reached, a left side menu bar seen in all pages hides. I would like this bar to be displayed over the content on demand, when a mobile device is used. I was able to make the top menu bar adapt responsively to display and the #bar to hide.
For trying to display the left bar menu (with a div labelled “bar”) I used the following CSS code:
#bar {
display:none;
}
#bar ~ .display_bar:focus {
display:block;
}
I set #bar first as that is the order in which the code for #bar loads once the page is loaded (I tried .display_bar:focus ~#bar as well). I created an icon displayed in mobile view to activate the display switch:
<div class=\"display_bar\">Some graphic</div>
I have tried all combinations and browsers, validated CSS and HTML, but the bar just won’t show when the icon is clicked on. I have tried with a single <p> tag with a class name instead of #bar but it ignores it as well. One of the example of pages could be seen in the URL:
http://www.cichlidae.com/index_catalog.php
What could I be doing wrong? I need the left bar to show on demand when in mobile view, preferably just with CSS. Thanks so much for any help you could provide me.
The relevant HTML code follows:
<!DOCTYPE html>
<html lang="en">
<head>
<title>All cichlid species - Cichlid ..</title>
<link rel="stylesheet" type="text/css" href="design/styles/indexstyle.css" title="Cichlid ...">
...
</head>
<body>
<!-- left frame -->
<div id="bar">
<img src="design/graphics/logos/logo_menu.jpg" width="200" height="165" alt="Cichlid Room Companion"><br><br>
...
<div style="padding-left:10px;">
<h3>Catalog</h3>
Classification<br>
....
</div>
</div>
<!-- right frame -->
<div id="main">
<div id="canvas" style="max-width:800px">
<!-- Menu bar -->
<ul id="menu" class="r-hide">
<li>Home
<div class="dropdown_3columns">
<h2>Welcome ...</h2>
</div>
</li>
</ul>
<div class="r-only">
<div id="r-navigation-menu">
<input type="checkbox" id="r-navigation-button">
<ul class="r-menu-items">
<h2>News</h2>
<li>What's new</li>
....
</ul>
<label for="r-navigation-button" id="r-navigation-label">
<div class="r-drop-icon">
<img src="design/graphics/icons/menu-hamburger.png" class="icon" width="32" height="32" alt="">
...
</div>
</label>
</div>
<div class="display_bar" tabindex="-1"><img src="design/graphics/icons/menu-collapse.png" class="icon" width="32" height="32" alt=""></div>
</div>

Resources