Skip to content

Instantly share code, notes, and snippets.

View nikolailehbrink's full-sized avatar

Nikolai Lehbrink nikolailehbrink

View GitHub Profile
@nikolailehbrink
nikolailehbrink / style.css
Last active December 14, 2022 13:06
Selection of all elements that are not descendants of another element
p:not(article *) {
max-width: 1920px;
display: flex;
}
@nikolailehbrink
nikolailehbrink / style.css
Created December 14, 2022 13:01
Pseudo-Element with .svg icon that has set width, height and custom color
:after {
content: "";
@apply block w-8 h-8 bg-purple-500;
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' stroke-width='1.25' stroke='currentColor' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cline x1='5' y1='12' x2='19' y2='12'%3E%3C/line%3E%3Cline x1='13' y1='18' x2='19' y2='12'%3E%3C/line%3E%3Cline x1='13' y1='6' x2='19' y2='12'%3E%3C/line%3E%3C/svg%3E")
no-repeat 50% 50%;
mask-size: cover;
}
@nikolailehbrink
nikolailehbrink / style.css
Last active March 6, 2023 09:48
CSS attribute selector for inline height styles
.wp-block-spacer[style="height:6rem"] {
@apply max-sm:!h-8;
}
@nikolailehbrink
nikolailehbrink / index.html
Created March 6, 2023 09:47
Set custom arrow for HTML Select element with TailwindCSS
<select id="language-selector" class="flex p-3 px-12 bg-[95%] border-2 appearance-none border-violet">
<option selected> Deutsch </option>
<option> English </option>
<option> Français </option>
</select>
@nikolailehbrink
nikolailehbrink / script.js
Last active November 24, 2023 10:36
Scroll based navigation bar shadow
window.onscroll = function () {
scrollTop();
};
function scrollTop() {
if (document.body.scrollTop > 0 || document.documentElement.scrollTop > 0) {
document.getElementById("navbar").classList.add("shadow-md");
} else {
document.getElementById("navbar").classList.remove("shadow-md");
}
@nikolailehbrink
nikolailehbrink / style.css
Last active March 7, 2023 10:59
Custom css scrollbar design
/* Firefox */
* {
scrollbar-width: 14px;
scrollbar-color: #a71b71 #ffffff;
}
/* Chrome, Edge, and Safari */
::-webkit-scrollbar {
width: 14px;
}
@nikolailehbrink
nikolailehbrink / style.css
Created March 8, 2023 14:18
Bring all swiper slides to the same height
.swiper-slide {
height: auto;
}
@nikolailehbrink
nikolailehbrink / functions.php
Created March 21, 2023 14:36
Completely remove comments from Wordpress
// Remove comments from Wordpress
add_action('admin_menu', 'theme_remove_admin_menus');
function theme_remove_admin_menus()
{
remove_menu_page('edit-comments.php');
}
// Removes from post and pages
add_action('init', 'theme_remove_comment_support', 100);
function theme_remove_comment_support()
@nikolailehbrink
nikolailehbrink / find_id_attribute.txt
Last active June 28, 2023 10:51
Regular expression for finding id attributes in HTML
\s+id="[^"]*"
@nikolailehbrink
nikolailehbrink / button_border_color.css
Created June 6, 2023 08:02
CSS code to set button border color to match the text color
button {
color: red; /* Change this to your desired text color */
border: 2px solid; /* Change 2px to your desired border width */
border-color: inherit; /* The border color will inherit the text color */
}