Jump to content

Blogger

Blog Bot
  • Joined

  • Last visited

    Never

Blog Entries posted by Blogger

  1. AI Prompt Examples

    by: aiparabellum.com
    Wed, 26 Mar 2025 03:13:15 +0000

    Crafting effective prompts is both an art and a science. The right prompt can unlock the full potential of AI models, leading to more accurate, creative, and useful outputs. This guide explores various prompt categories and provides detailed AI prompt examples to help you master the skill of prompt engineering.
    Whether you’re a developer, content creator, or AI enthusiast, these examples will help you understand how to communicate more effectively with AI systems and achieve better results.
    150+ Best AI Prompt Examples
    The following are the 16 most commonly used categories, each containing 10 examples of AI prompts.
    If you find these prompts useful and want to organize them, try our free AI Prompt Manager tool. For creating additional prompts at no cost, check out our free AI Prompt Generator tool.
    Creative Writing Code Generation Data Analysis Business Writing Educational Image Prompts Philosophy & Ethics Science & Technology Health & Wellness Personal Development Social & Cultural Analysis Food & Cooking Marketing & Branding Travel & Adventure Environmental Issues Psychology & Human Behavior Creative Writing
    Prompts designed to generate creative content like stories, poems, and scripts.
    Short Story Generator
    Generate a complete short story with a specific theme and elements.
    Write a 500-word science fiction story about time travel that includes a paradox, a historical figure, and ends with a twist. Use vivid descriptions and include meaningful dialogue. Pro tip: Specify word count, genre, and required elements for more controlled outputs. Character Development
    Create detailed character profiles for creative writing.
    Create a detailed character profile for a complex anti-hero in a dystopian setting. Include their background, motivations, flaws, physical description, speech patterns, and a sample dialogue that showcases their personality. Pro tip: The more specific details you provide about the character’s world, the more coherent the result will be. Poetry Composition
    Generate poetry in specific styles or addressing particular themes.
    Write a sonnet in Shakespearean style about the relationship between technology and nature. Use appropriate meter and rhyme scheme, and include at least one powerful metaphor. Pro tip: Specifying the poetic form (sonnet, haiku, free verse) helps the AI understand structural constraints. Dialogue Writing
    Create realistic dialogue between characters in specific scenarios.
    Write a dialogue between a parent and a teenager who has just been caught sneaking out at night. Make the conversation emotionally charged but realistic, showing both perspectives and the underlying tensions. Pro tip: Describe the characters’ emotions and relationship dynamics for more authentic dialogue. Plot Outline
    Generate structured plot outlines for longer works.
    Create a detailed three-act plot outline for a mystery novel about a small-town detective investigating a series of disappearances. Include key plot points, red herrings, character arcs, and a satisfying resolution. Pro tip: Mention specific plot structures (three-act, hero’s journey) if you want the AI to follow them. Setting Description
    Create vivid descriptions of locations and environments.
    Describe an abandoned amusement park 50 years after its closure. Focus on sensory details, the atmosphere, signs of decay, and hints of its former glory. Make it both eerie and melancholic. Pro tip: Ask for specific sensory details (sights, sounds, smells) to make settings more immersive. Metaphor and Simile Creation
    Generate creative comparisons for use in writing.
    Create 5 original metaphors and 5 similes that describe the feeling of anxiety. Make them vivid, unexpected, and avoid clichés. Explain why each comparison works effectively. Pro tip: Requesting explanations helps ensure the comparisons are meaningful rather than just creative. Flash Fiction
    Generate very short but complete stories.
    Write a 100-word flash fiction piece about a life-changing encounter between strangers on a train. Make every word count and end with a line that resonates emotionally. Pro tip: Tight word count constraints challenge the AI to be concise and impactful. Alternate History Scenario
    Explore creative “what if” historical scenarios.
    Write a brief alternate history scenario describing how the world would be different today if the Internet had been invented in the 1920s instead of decades later. Consider technological, social, and political implications. Pro tip: Provide a clear divergence point in history for more focused and plausible scenarios. Genre Mashup
    Combine different genres for unique creative writing.
    Write the opening paragraph of a story that combines elements of Western and Horror genres. Set it in a remote frontier town in the 1880s where something supernatural has begun to occur. Use language that evokes both genres. Pro tip: Specify which elements from each genre you want to see for more controlled fusion. Code Generation
    Prompts for generating code snippets, functions, and programming solutions.
    Function Implementation
    Generate specific functions with detailed requirements.
    Write a JavaScript function that takes an array of objects with ‘name’ and ‘score’ properties and returns a new array with only the objects where the score is above a threshold passed as a second parameter. Include error handling and comments explaining the code. Pro tip: Specify input/output types, edge cases to handle, and performance considerations. Algorithm Solution
    Generate solutions to algorithmic problems.
    Write a Python function to find the longest palindromic substring in a given string. Explain the algorithm’s approach, time complexity, and space complexity. Include comments and handle edge cases. Pro tip: Ask for explanations of time/space complexity to ensure efficient solutions. Code Refactoring
    Improve existing code for readability, performance, or maintainability.
    Refactor this React component to use hooks instead of class components, improve performance by preventing unnecessary re-renders, and follow current best practices: class UserProfile extends React.Component { … } Pro tip: Include the original code and specify what aspects need improvement. API Integration
    Generate code for integrating with specific APIs.
    Write a Node.js function that fetches weather data from the OpenWeatherMap API for a given city name. Handle errors gracefully, implement caching to avoid redundant API calls, and return the data in a simplified format with only temperature, conditions, and forecast. Pro tip: Specify exactly which API endpoints and features you need to implement. Data Structure Implementation
    Create custom data structures for specific use cases.
    Implement a priority queue in Java that supports the following operations: insert with priority, remove highest priority element, peek at highest priority element, and change the priority of an existing element. Include a complete class with appropriate methods and documentation. Pro tip: List all required operations and any performance constraints. Unit Test Generation
    Create comprehensive tests for existing code.
    Write Jest unit tests for this JavaScript authentication utility function. Include tests for successful authentication, invalid credentials, expired tokens, and network failures. Use mocks where appropriate: async function authenticateUser(username, password) { … } Pro tip: Include the code to be tested and specify which scenarios need test coverage. Database Query
    Generate SQL or NoSQL queries for specific data operations.
    Write a SQL query to find the top 5 customers who have spent the most money in the last 6 months. The database has tables for customers, orders, and order_items with appropriate foreign keys. Include comments explaining the query logic. Pro tip: Describe the database schema and the exact data you need to retrieve. UI Component
    Generate frontend components with specific functionality.
    Create a React component for a paginated data table that supports sorting by columns, filtering, and row selection. Use TypeScript with proper typing, and styled-components for styling. Make it accessible and responsive. Pro tip: Specify the framework, styling approach, and all required features. Command Line Tool
    Create scripts for automation or system tasks.
    Write a Python script that recursively searches directories for duplicate files based on content (not just filename). The script should take a directory path as input, report all duplicates found, and offer options to delete or move duplicates. Include proper error handling. Pro tip: Detail the exact functionality, input parameters, and output format. Design Pattern Implementation
    Implement specific software design patterns.
    Implement the Observer design pattern in TypeScript to create a weather monitoring system. Include a WeatherStation class (the subject) and multiple display classes (observers) that update when the weather changes. Show example usage of the implementation. Pro tip: Name the specific design pattern and provide context for its application. Data Analysis
    Prompts for analyzing data, generating insights, and creating visualizations.
    Data Cleaning Script
    Generate code to clean and preprocess datasets.
    Write a Python function using pandas to clean a dataset with the following issues: missing values in numerical columns, inconsistent date formats, duplicate rows, and outliers in the ‘salary’ column. The function should handle each issue appropriately and return the cleaned DataFrame. Pro tip: Specify the exact data issues and how you want them handled (e.g., impute, remove, transform). Statistical Analysis
    Generate code for statistical tests and analysis.
    Write Python code to perform a comprehensive statistical analysis on two groups of test scores to determine if a new teaching method had a significant impact. Include descriptive statistics, visualization, normality testing, and the appropriate statistical test with interpretation of results. Pro tip: Specify the hypothesis you’re testing and what kind of data you’re working with. Data Visualization
    Create code for specific data visualizations.
    Create a Python script using matplotlib or seaborn to visualize the relationship between multiple variables in a housing dataset. Include a correlation heatmap, scatter plots with regression lines, distribution plots for key variables, and a pair plot. Add proper titles, labels, and a cohesive color scheme. Pro tip: Describe the exact visualizations needed and any styling preferences. Machine Learning Model
    Generate code for implementing ML models for specific tasks.
    Write Python code using scikit-learn to build a customer churn prediction model. Include data preprocessing, feature selection, model selection with cross-validation, hyperparameter tuning, and evaluation metrics appropriate for an imbalanced classification problem. Pro tip: Specify the ML task, evaluation metrics, and any constraints or preferences. Time Series Analysis
    Generate code for analyzing time-based data.
    Create a Python script to analyze and forecast monthly sales data for a retail business. Include trend and seasonality decomposition, autocorrelation analysis, and implement both ARIMA and Prophet models. Compare their performance and visualize the forecasts with confidence intervals. Pro tip: Mention the time frequency of your data and how far you need to forecast. Data Extraction
    Generate code to extract data from various sources.
    Write a Python script that extracts financial data from quarterly PDF reports. The PDFs have tables with revenue, expenses, and profit margins. The script should identify these tables, extract the data into a structured format, and save it as a CSV file with appropriate headers. Pro tip: Provide details about the data source format and the specific information you need. Dashboard Creation
    Generate code for interactive data dashboards.
    Create a Python script using Dash or Streamlit to build an interactive dashboard for COVID-19 data analysis. Include time series charts of cases/deaths, geographical visualization, key metrics, comparison tools, and filters for different countries and date ranges. Pro tip: Specify which dashboard library you prefer and all required components. A/B Test Analysis
    Generate code to analyze experimental results.
    Write R or Python code to analyze the results of an A/B test comparing two website designs. The data includes user IDs, group assignment (A or B), conversion (boolean), and time spent on site. Calculate the statistical significance of differences in conversion rate and provide visualizations to communicate the results. Pro tip: Describe the metrics you’re comparing and the format of your experimental data. Natural Language Processing
    Generate code for text analysis tasks.
    Create a Python script that analyzes customer reviews to extract sentiment, common topics, and key phrases. Use appropriate NLP libraries, implement text preprocessing, sentiment analysis, topic modeling, and visualization of the results. The output should help identify product issues and customer satisfaction trends. Pro tip: Specify the exact NLP tasks and what insights you’re looking to extract. ETL Pipeline
    Generate code for data extraction, transformation, and loading processes.
    Write Python code for an ETL pipeline that extracts data from a MongoDB database, transforms it by cleaning missing values and aggregating by customer, and loads it into a PostgreSQL database. Include error handling, logging, and make it schedulable via cron or Airflow. Pro tip: Detail the source and destination data structures and all required transformations. Business Writing
    Prompts for creating professional business content and communications.
    Executive Summary
    Generate concise summaries of longer business documents.
    Write an executive summary for a 20-page market research report on the electric vehicle industry. The report covers market growth projections (15% CAGR over 5 years), key players (Tesla, VW Group, BYD), regulatory trends, and consumer adoption barriers. Keep the summary under 500 words while capturing all critical insights and recommendations. Pro tip: Provide the key points that must be included and specify the desired length. Business Proposal
    Create professional proposals for specific business opportunities.
    Write a business proposal for a digital marketing agency pitching services to a mid-sized retail chain looking to increase online sales. Include an understanding of their challenges, proposed services (SEO, PPC, social media), expected outcomes, timeline, pricing structure, and why your agency is uniquely qualified. Use persuasive but professional language. Pro tip: Specify the industry, target client, services offered, and unique selling points. Professional Email
    Generate effective emails for various business scenarios.
    Write a professional email to a client who has missed their payment deadline by two weeks. This is a valued long-term client who has never missed a payment before. Strike a balance between firmness about the payment requirement and maintaining the good relationship. Include a clear call to action. Pro tip: Describe the relationship context and the specific tone needed (formal, friendly, urgent). Meeting Agenda
    Create structured agendas for different types of meetings.
    Create a detailed agenda for a quarterly strategic planning meeting for a software company’s leadership team. The meeting will be 3 hours long and needs to cover: Q2 performance review, product roadmap updates, competitive analysis, resource allocation for Q3, and team structure changes. Include time allocations, discussion questions, and required pre-work for participants. Pro tip: Specify meeting duration, participants, and all topics that need to be covered. SWOT Analysis
    Generate structured analysis of strengths, weaknesses, opportunities, and threats.
    Conduct a SWOT analysis for a small bakery considering expansion to a second location in a neighboring town. The bakery has strong local brand recognition, award-winning products, but limited management bandwidth and increasing ingredient costs. The new location has higher foot traffic but also three established competitors. Pro tip: Provide specific details about the business and its current situation for a more accurate analysis. Job Description
    Create detailed and effective job postings.
    Write a job description for a Senior UX Designer position at a fintech startup. The ideal candidate needs 5+ years of experience, expertise in design systems, financial application design experience, and strong research skills. Include responsibilities, requirements, benefits, and company culture information. Make it both appealing to candidates and specific about expectations. Pro tip: Specify required experience, skills, and any unique aspects of the role or company. Customer Service Response
    Generate professional responses to customer inquiries or complaints.
    Write a response to a customer who left a negative review complaining about shipping delays and poor communication for an e-commerce business. The delay was caused by an unexpected supplier issue, but the communication failure was an internal oversight. Apologize appropriately, explain without making excuses, and offer a specific remedy to rebuild trust. Pro tip: Specify what caused the issue and what remedies you’re willing to offer. Marketing Copy
    Create persuasive content for marketing materials.
    Write marketing copy for a landing page promoting a new productivity app for remote teams. The app’s key features include real-time collaboration, automated task prioritization using AI, and integration with major work tools. The target audience is team managers at medium to large companies. Focus on benefits rather than just features and include a compelling call to action. Pro tip: Describe the product features, target audience, and desired tone (professional, conversational, etc.). Business Plan Section
    Generate specific sections of a business plan.
    Write the market analysis section of a business plan for a new meal prep delivery service targeting health-conscious professionals in urban areas. Include market size, growth trends, customer demographics, competitor analysis, regulatory considerations, and how this business will differentiate itself. Use data-driven language and maintain a professional tone. Pro tip: Specify which section you need and provide relevant details about the business concept. Press Release
    Create professional announcements for media distribution.
    Write a press release announcing a tech company’s new AI-powered customer service platform that reduces resolution times by 40%. The company has secured $5M in funding and has partnerships with two Fortune 500 companies already using the platform. Include a compelling headline, dateline, company information, quotes from the CEO, and contact information. Pro tip: Include all key facts, figures, and quotes that should appear in the release. Educational
    Prompts for creating learning materials, explanations, and educational content.
    Concept Explanation
    Generate clear explanations of complex topics for different audiences.
    Explain quantum computing to three different audiences: 1) a 10-year-old child, 2) a high school student with basic physics knowledge, and 3) a computer science undergraduate. For each explanation, use appropriate analogies, vocabulary, and depth while maintaining accuracy. Pro tip: Specify the target audience’s background knowledge and the desired level of detail. Lesson Plan
    Create structured plans for teaching specific topics.
    Create a detailed 60-minute lesson plan for teaching photosynthesis to 7th-grade students. Include learning objectives, a warm-up activity, main instruction with visual aids, a hands-on experiment, assessment method, and homework assignment. Align with Next Generation Science Standards and include accommodations for different learning styles. Pro tip: Specify grade level, duration, and any specific educational standards to follow. Practice Problems
    Generate exercises with solutions for various subjects.
    Create 5 calculus problems on integration by parts with varying difficulty levels. For each problem, provide a clear solution showing all steps, common mistakes students might make, and a tip for approaching similar problems. Make the problems relevant to real-world applications where possible. Pro tip: Specify the exact topic, number of problems, and whether you want step-by-step solutions. Study Guide
    Create comprehensive review materials for exams or topics.
    Create a study guide for an introductory macroeconomics course final exam. Cover key concepts including GDP calculation, fiscal policy, monetary policy, inflation, unemployment, and economic growth. Include definitions, formulas, graphs, example problems, and memory aids. Organize it in a way that shows connections between concepts. Pro tip: List all topics that should be included and specify the format (bullet points, Q&A, etc.). Historical Context
    Provide background information on historical events or periods.
    Provide historical context for the American Civil Rights Movement of the 1950s-60s. Include the social and political conditions that preceded it, key events and figures, opposition faced, legislative changes achieved, and its lasting impact on American society. Include a timeline of pivotal moments and their significance. Pro tip: Specify the time period, geographical focus, and aspects you want emphasized. Comparative Analysis
    Generate comparisons between related concepts, theories, or works.
    Create a comparative analysis of three major learning theories: Behaviorism, Cognitivism, and Constructivism. For each theory, explain the core principles, key theorists, view of how learning occurs, classroom applications, strengths, and limitations. Conclude with how these theories might be combined in modern educational practice. Pro tip: List the specific items to compare and the aspects to address for each. Experiment Design
    Create scientific experiments for educational purposes.
    Design a middle school science experiment that demonstrates the greenhouse effect using common household materials. Include a hypothesis, materials list, step-by-step procedure, safety precautions, expected results, explanation of the underlying science, and extension questions for further inquiry. Pro tip: Specify the age group, available resources, and the scientific concept to demonstrate. Language Learning Dialogue
    Create conversations for language practice with translations and notes.
    Create a dialogue in Spanish between two friends planning a weekend trip. The conversation should use common travel vocabulary, different verb tenses, and natural expressions. Provide the dialogue, English translation, vocabulary notes for key terms, and grammar explanations for complex structures. Target intermediate Spanish learners. Pro tip: Specify the language, proficiency level, and any specific vocabulary or grammar to include. Case Study
    Generate detailed scenarios for analysis and discussion.
    Create a business ethics case study about a technology company facing a dilemma regarding user privacy and data monetization. Include background information, the specific ethical dilemma, stakeholder perspectives, relevant ethical frameworks, discussion questions, and potential courses of action with their implications. Pro tip: Describe the type of scenario, key issues to explore, and the learning objectives. Educational Game Design
    Create concepts for games that teach specific skills or knowledge.
    Design an educational card game that teaches basic chemistry concepts to high school students. Include the game objective, components needed, detailed rules, how the game mechanics reinforce chemistry concepts (elements, compounds, reactions), scoring system, and 10 example cards. The game should be engaging while ensuring scientific accuracy. Pro tip: Specify the subject, age group, and whether you want physical or digital game concepts. Image Prompts
    Prompts designed for text-to-image AI models to generate specific visual outputs.
    Detailed Scene Description
    Create rich, detailed prompts for generating complex scenes.
    A cozy bookstore cafe at dusk, warm golden lighting spilling from windows onto a rain-slicked cobblestone street. Inside, vintage bookshelves reach the ceiling, a spiral staircase connects two floors, and customers read in worn leather armchairs. Steam rises from coffee cups, and a cat sleeps on a windowsill. Photorealistic style, shallow depth of field, soft lighting. Pro tip: Include setting, time of day, lighting conditions, specific objects, and desired artistic style. Character Design
    Generate detailed character concepts with specific attributes.
    A female elven ranger, mid-30s, with sharp features, piercing green eyes, and intricate silver tattoos flowing across her face. She has braided auburn hair with small leaves woven in, and wears layered leather armor in forest tones with a weathered cloak. She carries an ornate longbow and has a knowing, determined expression. Fantasy illustration style, dramatic lighting, detailed textures. Pro tip: Describe physical attributes, clothing, expressions, poses, and the artistic style. Product Visualization
    Create prompts for realistic product renderings.
    A minimalist smart home speaker with a cylindrical design in matte white ceramic. The device has a subtle light ring at the top that glows soft blue, and fabric texture covering the lower half. Place it on a modern wooden side table in a bright, Scandinavian-style living room. Product photography style with soft, natural lighting, shallow depth of field, and clean background. Pro tip: Include product details, materials, setting, lighting, and photographic style. Concept Art
    Generate prompts for imaginative concept art of environments or objects.
    Concept art of a futuristic floating city built on massive interconnected platforms above a polluted Earth. The architecture blends Art Deco elements with advanced technology, featuring gleaming spires, hanging gardens, and anti-gravity transport systems. Flying vehicles move between levels, and massive energy collectors harvest sunlight. Wide establishing shot, detailed, cinematic lighting, sci-fi illustration style. Pro tip: Describe the concept in detail, including architectural style, technology, scale, and atmosphere. Style Transfer
    Create prompts that apply specific artistic styles to subjects.
    A serene Japanese garden with a red maple tree, stone lanterns, and a small bridge over a koi pond, rendered in the style of Studio Ghibli animation. Use soft watercolor textures, gentle pastel colors, and the characteristic whimsical lighting and atmosphere that defines Ghibli films. Include small details like ripples in the water and leaves floating in the breeze. Pro tip: Name the specific artistic style and describe its key characteristics (colors, textures, lighting). Mood and Atmosphere
    Create prompts focused on evoking specific emotions through imagery.
    A solitary lighthouse on a rocky cliff during a violent storm at night. Massive waves crash against the rocks, and dark storm clouds swirl overhead illuminated by occasional lightning. The lighthouse beam cuts through the darkness and heavy rain. Create a sense of isolation, danger, and resilience. Dramatic, high-contrast lighting, photorealistic style with detailed textures of wet surfaces. Pro tip: Name the emotion explicitly and include environmental elements that evoke that feeling. Abstract Concept Visualization
    Generate prompts that visualize abstract ideas or emotions.
    A surreal visualization of the concept of ‘time passing’ showing a landscape split between seasons, with objects in various states of growth, decay, and transformation. Include clock elements melting or fragmenting, hourglasses, and human figures at different life stages. Use rich symbolism and dreamlike quality with a color palette transitioning from warm to cool tones. Inspired by Salvador Dali and Rob Gonsalves. Pro tip: Name the abstract concept and suggest symbolic elements, color schemes, and artistic influences. Composite Imagery
    Create prompts that combine multiple elements in unexpected ways.
    A half-underwater photography showing both above and below the water line of a tropical coral reef. Above: a small wooden boat, clear blue sky, and distant island. Below: vibrant coral formations, schools of colorful fish, and a sea turtle. The composition should be split horizontally across the middle with perfect clarity both above and below the waterline. Photorealistic style with natural lighting. Pro tip: Clearly describe how elements should be combined and the composition you want. Technical Illustration
    Generate prompts for detailed technical or scientific visualizations.
    A detailed cross-section technical illustration of a modern electric vehicle showing the battery system, electric motors, power electronics, cooling system, and passenger compartment. Label key components with thin lines pointing to each part. Use a clean, precise technical illustration style with a limited color palette on a white background, similar to technical documentation or engineering textbooks. Pro tip: Specify the technical subject, viewpoint (cutaway, exploded view, etc.), labeling, and illustration style. Sequential Imagery
    Create prompts for images that tell a sequential story.
    A four-panel sequential image showing the transformation of an urban lot across seasons: 1) Winter: an abandoned, snow-covered vacant lot with litter and chain-link fence. 2) Spring: people clearing debris and preparing soil for a community garden. 3) Summer: a thriving garden with vegetables, flowers, and people of diverse ages working together. 4) Fall: a community harvest festival with tables of food made from the garden produce. Consistent perspective across all panels, illustrative style with warm lighting. Pro tip: Clearly number and describe each panel while maintaining consistent elements across the sequence. Philosophy & Ethics
    Prompts that explore philosophical concepts, ethical dilemmas, and thought experiments.
    Ethical Dilemma Analysis
    Explore complex ethical scenarios from multiple perspectives.
    Analyze the trolley problem from utilitarian, deontological, and virtue ethics perspectives. Present the strongest arguments from each framework, address potential objections, and explain how different philosophical traditions might resolve the dilemma differently. Pro tip: Specify which ethical frameworks you want considered for a more structured analysis. Modern Philosophy Thought Experiment
    Create new thought experiments to explore contemporary issues.
    Design a thought experiment similar to the ‘Brain in a Vat’ that explores the ethical and philosophical implications of consciousness uploading. Include key questions, potential paradoxes, and what this reveals about personal identity. Pro tip: Reference classic thought experiments as models if you want a similar structure. Philosophical Dialogue
    Generate a conversation between philosophers or philosophical viewpoints.
    Write a dialogue between Nietzsche and Buddha discussing the nature of suffering, the meaning of life, and the concept of self. Make their positions authentic to their philosophical works while creating engaging interaction. Pro tip: Name specific thinkers and topics to ensure the dialogue reflects their actual philosophical positions. Applied Ethics Case Study
    Analyze real-world ethical problems in specific domains.
    Create a comprehensive ethical analysis of the use of predictive algorithms in criminal justice. Consider questions of fairness, accountability, transparency, potential biases, and competing values like public safety and individual rights. Pro tip: Focusing on a specific industry or technology will yield more detailed ethical considerations. Philosophical Concept Exploration
    Deep dive into philosophical concepts and their implications.
    Explore the concept of ‘authenticity’ across existentialist philosophy. Compare how Sartre, Heidegger, and Camus understood the term, its relationship to freedom and responsibility, and its relevance to contemporary life. Pro tip: Ask for concrete examples that illustrate abstract concepts for better understanding. Cross-Cultural Philosophy Comparison
    Compare philosophical traditions from different cultures.
    Compare Eastern and Western philosophical approaches to the concept of the self. Contrast Confucian, Buddhist, and Hindu conceptions with those of Descartes, Locke, and Hume. Identify key differences, similarities, and potential areas of integration. Pro tip: Specify time periods for more historically accurate philosophical comparisons. Philosophical Argument Reconstruction
    Break down and analyze philosophical arguments.
    Reconstruct Plato’s argument for the immortality of the soul from the Phaedo. Present it in premise-conclusion form, identify key assumptions, evaluate its logical validity, and assess its soundness from a contemporary perspective. Pro tip: Request specific argument forms (syllogisms, inferences) for more structured responses. Virtue Ethics Application
    Apply virtue ethics to modern scenarios and character development.
    Analyze what Aristotelian virtues would look like in the context of social media use. Identify potential vices of excess and deficiency, describe what virtuous moderation would involve, and how one might cultivate these virtues. Pro tip: Name specific virtues you’re interested in exploring for more focused analysis. Political Philosophy Design
    Design political systems based on philosophical principles.
    Design a political system that balances John Rawls’ principles of justice with libertarian concerns about individual freedom. Address governance structures, rights protections, economic arrangements, and how conflicts between values would be resolved. Pro tip: Specify which aspects of governance (economy, rights, participation) you want emphasized. Metaphysical Problem Analysis
    Explore fundamental questions about reality and existence.
    Examine the problem of free will versus determinism in light of modern neuroscience. Present compatibilist and incompatibilist positions, address how scientific findings challenge or support different views, and explore the implications for moral responsibility. Pro tip: Connecting metaphysical questions to concrete implications helps make abstract concepts accessible. Science & Technology
    Prompts that explore scientific concepts, emerging technologies, and their implications.
    Technology Impact Assessment
    Evaluate the potential impacts of emerging technologies.
    Assess the potential societal impacts of widespread brain-computer interfaces over the next 20 years. Consider implications for privacy, inequality, education, employment, mental health, and human relationships. Include both opportunities and risks. Pro tip: Specifying a timeframe helps focus the analysis on near-term vs. long-term impacts. Scientific Concept Explanation
    Explain complex scientific concepts in accessible terms.
    Explain quantum entanglement to a curious high school student. Use analogies, avoid unnecessary jargon, address common misconceptions, and explain why this phenomenon is significant to both physics and potentially future technologies. Pro tip: Specifying your audience helps tailor the explanation to the appropriate level. Interdisciplinary Research Proposal
    Generate ideas connecting different scientific fields.
    Develop a research proposal that combines neuroscience and artificial intelligence to address the problem of algorithmic bias. Include research questions, methodology, potential applications, and ethical considerations. Pro tip: Name specific subfields within each discipline for more targeted connections. Future Technology Scenario
    Envision plausible future technological developments.
    Describe a detailed scenario of how urban transportation might function in 2050, assuming significant advances in autonomous vehicles, renewable energy, and smart city infrastructure. Include technical details, economic models, and social adaptations. Pro tip: Establishing constraints (like energy limitations or economic factors) creates more plausible scenarios. Scientific Controversy Analysis
    Explore multiple sides of scientific debates.
    Analyze the scientific controversy surrounding geoengineering as a climate change solution. Present the strongest evidence and arguments from different perspectives, explain areas of consensus, remaining uncertainties, and the values informing different positions. Pro tip: Request a focus on methodological differences to understand why scientists reach different conclusions. Technology Ethics Framework
    Develop ethical guidelines for emerging technologies.
    Create an ethical framework for the development and deployment of emotion recognition AI. Include principles for consent, privacy, accuracy, potential misuse, vulnerable populations, and accountability measures for developers and users. Pro tip: Referencing established ethical frameworks (like bioethics principles) provides useful structure. Scientific Method Application
    Apply scientific thinking to everyday questions.
    Design a rigorous experiment to test whether plants grow better when talked to. Include hypothesis, variables, controls, measurement methods, potential confounding factors, and how you would analyze the results. Pro tip: Focus on one specific question rather than broad topics for more detailed methodology. Technology Accessible Design
    Explore ways to make technology more inclusive.
    Propose design principles and specific features that would make virtual reality technology accessible to users with visual impairments. Consider hardware, software, interaction methods, and how to provide equivalent experiences. Pro tip: Focusing on specific disabilities leads to more concrete and useful design solutions. Scientific History Analysis
    Examine the history and development of scientific ideas.
    Trace the historical development of our understanding of evolution from Darwin to modern genomics. Highlight key discoveries, paradigm shifts, controversies, and how multiple disciplines contributed to our current knowledge. Pro tip: Requesting focus on social and political contexts provides richer historical analysis. Speculative Biology
    Imagine plausible alien or future organisms based on scientific principles.
    Design a plausible ecosystem for a tidally-locked exoplanet (one side always facing its star) with Earth-like gravity and atmospheric composition. Describe 3-5 organisms, their adaptations, ecological niches, and relationships. Pro tip: Establishing specific environmental constraints leads to more scientifically grounded creations. Health & Wellness
    Prompts focused on physical and mental health, fitness, nutrition, and overall wellbeing.
    Habit Formation Strategy
    Develop personalized approaches to building healthy habits.
    Create a comprehensive 30-day plan to establish a daily meditation habit for a busy professional with anxiety. Include progression schedule, addressing common obstacles, tracking methods, environmental modifications, and motivation strategies based on behavioral science. Pro tip: Specifying personality traits and lifestyle factors enables more tailored strategies. Nutrition Education Guide
    Create educational material about nutritional concepts.
    Develop an accessible guide explaining macronutrients and micronutrients for someone new to nutrition science. Define key terms, explain functions in the body, recommended intake levels, common food sources, and signs of deficiency or excess. Pro tip: Requesting visuals like charts or comparison tables can make complex nutrition information clearer. Mental Health Resource Toolkit
    Compile strategies and resources for managing mental health conditions.
    Create a comprehensive toolkit for managing social anxiety, including cognitive-behavioral techniques, gradual exposure exercises, self-care practices, communication scripts, professional treatment options, and recommended books and apps. Pro tip: Specifying severity level helps tailor strategies to appropriate intervention levels. Exercise Program Design
    Develop structured fitness plans for specific goals.
    Design a 12-week strength training program for a 45-year-old beginner with lower back issues. Include progressive workouts, proper form guidance, modification options, recovery protocols, and how to track progress safely. Pro tip: Detailed information about physical conditions and limitations results in safer program design. Sleep Optimization Plan
    Create strategies for improving sleep quality and habits.
    Develop a comprehensive sleep improvement protocol for a night shift worker. Include timing strategies, environmental modifications, nutrition considerations, light exposure management, and relaxation techniques specifically adapted for irregular schedules. Pro tip: Including both immediate interventions and long-term habit changes provides more actionable advice. Wellness Challenge Creator
    Design structured challenges to improve health behaviors.
    Create a 21-day workplace wellness challenge focused on reducing sedentary behavior. Include daily micro-challenges, team and individual components, tracking mechanisms, realistic progression, and ways to sustain changes after the challenge ends. Pro tip: Specifying the environment (workplace, home, school) helps tailor the challenge to realistic constraints. Health Condition Management Guide
    Compile lifestyle strategies for managing chronic conditions.
    Develop a comprehensive lifestyle management guide for someone newly diagnosed with type 2 diabetes. Include nutrition principles, physical activity recommendations, stress management, sleep importance, medication adherence strategies, and monitoring practices. Pro tip: Request focus on the psychological aspects of condition management for more holistic guidance. Mind-Body Practice Script
    Create guided scripts for relaxation and mind-body practices.
    Write a 15-minute progressive muscle relaxation script specifically designed for tension headache relief. Include precise timing, breathing instructions, body scanning elements, and guidance for releasing specific head, neck, and shoulder muscle groups. Pro tip: Specifying the intended outcome (stress relief, focus, sleep) helps tailor the practice appropriately. Health Information Simplifier
    Translate complex health information into accessible explanations.
    Explain the autoimmune disease lupus to a newly diagnosed teenager and their family. Cover causes, common symptoms, treatment approaches, lifestyle factors, and what to expect in language that’s accurate but accessible without unnecessary medical jargon. Pro tip: Requesting analogies or metaphors can make complex bodily processes more understandable. Preventative Health Protocol
    Develop comprehensive prevention strategies for health conditions.
    Create a holistic heart disease prevention protocol for someone with a strong family history but no current symptoms. Include screening recommendations, dietary approaches, fitness components, stress management, sleep hygiene, and when to consult healthcare providers. Pro tip: Specifying age and current health status helps customize prevention strategies appropriately. Personal Development
    Prompts focused on self-improvement, productivity, goal setting, and personal growth.
    Life Vision Exercise
    Create structured exercises for clarifying personal direction and purpose.
    Design a comprehensive ‘future self’ visualization exercise with specific guided questions to help someone clarify their ideal life 10 years from now across career, relationships, personal growth, health, and contribution. Include reflection prompts and steps to translate insights into present-day decisions. Pro tip: Including both aspirational and practical elements creates more actionable life visions. Productivity System Design
    Develop personalized productivity frameworks and workflows.
    Create a customized productivity system for a creative professional who struggles with ADHD. Include task management methods, environment optimization, energy management techniques, accountability structures, and technology recommendations that accommodate attention challenges. Pro tip: Specifying work type and cognitive style leads to more suitable productivity recommendations. Personal Decision Framework
    Develop structured approaches to making important life decisions.
    Design a comprehensive decision-making framework for evaluating a major career change. Include methods for clarifying values, researching options, weighing tradeoffs, addressing risks, testing assumptions, managing emotions, and establishing review triggers after the decision. Pro tip: Requesting a focus on managing decision biases leads to more objective frameworks. Habit Stacking Blueprint
    Create strategies for combining and establishing multiple related habits.
    Develop a morning routine habit stack for a parent of young children that incorporates mindfulness, light exercise, planning, and self-care in under 30 minutes. Include implementation intention scripts, environment design tips, minimal effective doses, and contingency plans. Pro tip: Specifying time constraints helps create realistic and sustainable habit combinations. Personal Feedback System
    Design methods for gathering and using feedback for personal growth.
    Create a comprehensive personal feedback system for a mid-level manager to gather insights about their leadership style. Include self-assessment tools, structured questions for different stakeholders, anonymous collection methods, analysis frameworks, and action planning templates. Pro tip: Focusing on specific skills or traits you want feedback on produces more actionable insights. Values Clarification Exercise
    Develop exercises to identify and prioritize personal values.
    Design a multistage values clarification process that helps distinguish between inherited, aspirational, and actual core values. Include narrative exercises, prioritization methods, values-in-action assessments, conflict resolution frameworks, and alignment evaluation tools. Pro tip: Requesting examples of how values manifest in daily decisions makes abstract values more concrete. Resilience Building Protocol
    Create structured approaches to developing personal resilience.
    Develop a comprehensive resilience-building program for someone recovering from burnout. Include cognitive reframing techniques, boundary-setting frameworks, stress response regulation methods, social support activation strategies, and identity reconstruction exercises. Pro tip: Specifying the type of adversity helps tailor resilience strategies to relevant challenges. Personal Knowledge Management System
    Design systems for capturing, organizing and using personal knowledge.
    Create a comprehensive personal knowledge management system for a graduate student researching across multiple disciplines. Include information capture workflows, organization taxonomies, connection-making protocols, retrieval methods, and application frameworks. Pro tip: Specifying your content types (articles, books, ideas) helps customize the system appropriately. Conflict Resolution Script
    Develop communication templates for navigating difficult conversations.
    Create a comprehensive conflict navigation script template for addressing recurring conflicts with a defensive colleague. Include opening statements, perspective-taking prompts, needs articulation frameworks, solution generation models, and follow-up protocols. Pro tip: Describing relationship dynamics and history helps tailor communication approaches effectively. Identity Shift Framework
    Design approaches for intentionally evolving personal identity.
    Develop a framework for transitioning identity from ’employee’ to ‘entrepreneur’ during a career change. Include narrative revision exercises, belief examination tools, new behavior adoption strategies, social reinforcement methods, and environmental restructuring techniques. Pro tip: Specifying both current and desired identities creates more targeted transition strategies. Social & Cultural Analysis
    Prompts that examine social phenomena, cultural trends, and human interactions.
    Cultural Comparison Framework
    Analyze differences and similarities between cultural practices and values.
    Create a nuanced comparison of attitudes toward aging and elderly care in Japanese, American, and Brazilian cultures. Examine historical influences, value systems, family structures, economic factors, and how these manifest in contemporary practices and institutions. Pro tip: Requesting analysis of specific practices rather than entire cultures yields more insightful comparisons. Social Trend Analysis
    Examine emerging social trends and their potential implications.
    Analyze the growing ‘digital nomad’ lifestyle trend. Explore its economic drivers, technological enablers, demographic patterns, environmental impacts, effects on local communities, potential future developments, and what it reveals about changing values toward work and place. Pro tip: Requesting both macro (societal) and micro (individual) perspectives provides more comprehensive analysis. Subculture Deep Dive
    Examine specific subcultures and their practices, values, and dynamics.
    Provide a comprehensive analysis of the mechanical keyboard enthusiast subculture. Examine its history, key practices, specialized language, status markers, community structures, economic ecosystem, and relationship to broader technology culture. Pro tip: Focusing on specific elements like language, rituals, or values yields deeper subcultural insights. Social Institution Comparative Analysis
    Compare how social institutions function across different contexts.
    Compare higher education systems in Germany, South Korea, and the United States. Analyze funding models, access patterns, curriculum approaches, cultural purposes, student experiences, and relationships to employment markets and social mobility. Pro tip: Specifying evaluation criteria helps focus institutional comparisons on relevant dimensions. Intergenerational Dialogue Construction
    Create frameworks for understanding across generational divides.
    Design a structured dialogue process for Baby Boomers and Gen Z to explore different perspectives on work ethics and career expectations. Include key discussion questions, perspective-taking exercises, shared value identification methods, and collaborative problem-solving frameworks. Pro tip: Focusing on specific issues rather than general generational differences leads to more productive dialogue. Ritual Analysis Framework
    Examine the functions and meanings of social and cultural rituals.
    Analyze modern graduation ceremonies as social rituals. Examine their symbolic elements, historical evolution, social functions, economic aspects, emotional impacts, power dynamics, and how they compare to other transition rituals across cultures. Pro tip: Requesting comparisons between traditional and emerging forms of the same ritual reveals cultural shifts. Cross-Cultural Communication Guide
    Develop strategies for effective communication across cultural differences.
    Create a practical guide for American business professionals working with Japanese counterparts. Include communication style differences, nonverbal interpretation frameworks, hierarchy navigation strategies, conflict resolution approaches, and relationship-building best practices. Pro tip: Focusing on specific contexts (business, education, healthcare) yields more practical communication guidance. Social Movement Comparative Analysis
    Analyze the development, strategies, and impacts of social movements.
    Compare the environmental movements in India, Germany, and Kenya. Analyze their historical development, key organizations, tactical approaches, messaging strategies, policy impacts, and relationships with other social justice concerns. Pro tip: Requesting analysis of specific campaigns rather than entire movements provides more detailed insights. Media Representation Analysis
    Examine how groups or concepts are portrayed in media and entertainment.
    Analyze the evolution of disability representation in mainstream television from the 1990s to the present. Examine changing narrative patterns, character development approaches, actor inclusion, production practices, audience reception, and impacts on public perception. Pro tip: Narrowing to specific media formats or time periods allows for more detailed representation analysis. Social Identity Construction Framework
    Explore how identities are formed, maintained, and transformed.
    Analyze how professional identities are constructed and maintained among emergency medical workers. Examine training socialization, language practices, symbolic markers, boundary maintenance, coping mechanisms, and how these relate to self-concept and group cohesion. Pro tip: Focusing on specific identity aspects rather than whole identities produces more nuanced analysis. Food & Cooking
    Prompts related to culinary techniques, recipe development, food culture, and dietary approaches.
    Recipe Adaptation Framework
    Transform recipes to accommodate different dietary needs or preferences.
    Adapt a traditional beef bourguignon recipe for a plant-based diet while preserving the depth of flavor and texture. Explain ingredient substitutions with ratios, technique modifications, nutrition considerations, and why each change works from a food science perspective. Pro tip: Specifying which aspects of the original dish are most important helps preserve the essence while adapting. Culinary Technique Mastery Guide
    Detailed instructions for mastering specific cooking methods.
    Create a comprehensive guide to pan-searing proteins to restaurant quality. Include equipment selection, temperature management, timing techniques, testing methods, troubleshooting common issues, and variations for different proteins from fish to tofu. Pro tip: Asking for common mistakes and how to correct them makes technique guides more practical. Flavor Pairing Analysis
    Explore complementary flavor combinations and their principles.
    Analyze why chocolate pairs well with certain ingredients. Explore its compatibility with chili, orange, mint, and sea salt from both chemical and cultural perspectives. Explain the underlying flavor compounds, contrasting elements, and cultural origins of these pairings. Pro tip: Focusing on a specific ingredient as the base yields more in-depth pairing analyses. Culinary Cultural History
    Explore the historical and cultural development of dishes or ingredients.
    Trace the historical journey of noodles from their origins through their spread and adaptation across Asian, Middle Eastern, and European cuisines. Analyze technological developments, cultural exchanges, regional adaptations, and how economic factors shaped their evolution. Pro tip: Narrowing geographic focus or time period allows for more detailed culinary history. Food Science Explanation
    Explain the scientific principles behind cooking phenomena.
    Explain the science behind bread baking, including gluten development, fermentation processes, Maillard reactions, starch gelatinization, and moisture management. Include how these processes affect texture, flavor, and shelf life, with troubleshooting for common issues. Pro tip: Requesting practical applications of the science leads to more useful explanations. Seasonal Menu Planning
    Develop cohesive menus based on seasonal ingredients and themes.
    Create a complete early autumn dinner party menu for 8 people featuring local, seasonal ingredients from the northeastern United States. Include cocktails, appetizers, main course, sides, and dessert with a cohesive flavor story and make-ahead preparation timeline. Pro tip: Specifying dietary restrictions and equipment limitations helps create realistic menus. Cooking Method Comparison
    Analyze different cooking techniques for specific ingredients.
    Compare five methods for cooking eggplant (grilling, roasting, frying, steaming, and braising), analyzing how each affects flavor, texture, appearance, nutrition, and best culinary applications. Include optimal execution tips for each method. Pro tip: Requesting specific evaluation criteria helps create more structured cooking method comparisons. Ingredient Substitution Guide
    Comprehensive frameworks for replacing ingredients in recipes.
    Create a detailed sugar substitution guide for baking that covers honey, maple syrup, coconut sugar, stevia, monk fruit, and artificial sweeteners. Include conversion ratios, texture impacts, flavor profiles, recipe adjustments needed, and best applications for each. Pro tip: Focusing on a specific category of ingredients creates more thorough substitution guides. Food Preservation Tutorial
    Instructions for various food preservation methods.
    Develop a comprehensive guide to fermenting vegetables at home. Include equipment recommendations, food safety protocols, basic process steps, troubleshooting common issues, storage guidelines, and specific recipes for kimchi, sauerkraut, and pickled carrots. Pro tip: Requesting information about shelf life and storage methods creates more practical preservation guides. Global Cooking Technique Adaptation
    Adapt cooking techniques from various cultures to different contexts.
    Explain how to adapt traditional Chinese wok cooking techniques for Western home kitchens with electric stoves. Address equipment alternatives, heat management strategies, ingredient substitutions, timing adjustments, and how to achieve authentic flavors despite limitations. Pro tip: Being specific about available equipment and ingredients leads to more practical adaptations. Marketing & Branding
    Prompts focused on marketing strategies, brand development, customer engagement, and promotion.
    Brand Voice Development
    Create distinctive and consistent communication styles for brands.
    Develop a comprehensive brand voice guide for a sustainable outdoor apparel company targeting environmentally conscious millennials. Include personality attributes, tone spectrum for different situations, vocabulary preferences, sample messaging across platforms, and do’s and don’ts with examples. Pro tip: Providing competitor examples helps create more distinctive brand voice guidelines. Customer Persona Creation
    Develop detailed profiles of target customer segments.
    Create a detailed customer persona for a premium home fitness app targeting busy professionals in their 30-40s. Include demographic details, psychographic profiles, goals and pain points, media consumption habits, purchasing behaviors, and day-in-the-life narrative. Pro tip: Requesting both emotional and functional needs creates more three-dimensional customer personas. Marketing Campaign Concept
    Develop conceptual frameworks for multi-channel marketing initiatives.
    Develop a comprehensive marketing campaign concept for launching a new plant-based protein product to health-conscious consumers who aren’t vegetarian. Include campaign theme, key messaging, visual direction, channel strategy, content pillars, and success metrics. Pro tip: Specifying campaign objectives (awareness, conversion, loyalty) helps focus the strategic approach. Content Strategy Framework
    Create structured approaches to content development and distribution.
    Design a 3-month content strategy for a B2B software company targeting financial institutions. Include content pillars, format mix, channel distribution, repurposing framework, engagement tactics, lead nurturing integration, and measurement approach. Pro tip: Specifying the buyer journey stages you want to target creates more focused content strategies. Brand Storytelling Framework
    Develop narrative structures for authentic brand stories.
    Create a brand storytelling framework for a family-owned restaurant celebrating its 25th anniversary. Include origin story structure, key narrative themes, character archetypes, conflict and resolution elements, and how to adapt the core story across different channels. Pro tip: Providing information about brand history and values leads to more authentic storytelling frameworks. Value Proposition Development
    Craft compelling statements of customer value and differentiation.
    Develop three potential value proposition statements for a premium virtual assistant service targeting small law firms. Include the core benefit focus, differentiation elements, proof points for each, and evaluation criteria to determine the strongest option. Pro tip: Requesting competitive analysis integration creates more distinctive value propositions. Social Media Content Calendar
    Create structured plans for social media content.
    Design a monthly social media content calendar for a local fitness studio across Instagram and Facebook. Include content categories, posting frequency, engagement tactics, user-generated content integration, promotional balance, and seasonal themes for January. Pro tip: Specifying business objectives for social channels helps align content with strategic goals. Rebranding Strategy Framework
    Develop approaches for refreshing or transforming brand identities.
    Create a comprehensive rebranding strategy framework for a 15-year-old financial services company looking to appear more innovative and accessible to younger clients. Include assessment methods, stakeholder management, elements to preserve, implementation phasing, and launch approach. Pro tip: Clarifying what should change versus what should remain consistent creates more strategic rebranding plans. Customer Journey Mapping
    Visualize and optimize the customer experience across touchpoints.
    Develop a detailed customer journey map for someone purchasing a major kitchen appliance online. Include research, consideration, purchase, delivery, first use, and support phases with emotions, touchpoints, pain points, opportunities, and optimization recommendations for each stage. Pro tip: Focusing on specific customer segments creates more accurate and actionable journey maps. Brand Extension Evaluation Framework
    Assess potential new product or service lines for brand fit.
    Create an evaluation framework for a premium coffee shop chain considering launching packaged coffee products in grocery stores. Include brand alignment criteria, market opportunity assessment, cannibalization risk, operational feasibility, and financial potential dimensions. Pro tip: Including both quantitative and qualitative evaluation criteria provides more balanced assessment. Travel & Adventure
    Prompts related to travel planning, cultural exploration, outdoor adventures, and unique experiences.
    Immersive Travel Itinerary
    Create detailed travel plans focused on cultural immersion.
    Design a 10-day immersive cultural itinerary for Oaxaca, Mexico that goes beyond tourist highlights. Include authentic food experiences, artisan workshops, local festivals or events, meaningful cultural exchanges, lesser-known natural sites, and suggested Spanish phrases for each interaction. Pro tip: Specifying interests (art, history, food) helps create more personalized immersive itineraries. Adventure Activity Guide
    Comprehensive guides for outdoor and adventure activities.
    Create a comprehensive guide for a first-time backpacker planning a 3-day trip in mountain terrain. Include gear selection principles, packing strategy, navigation basics, camp setup, food planning, water management, safety protocols, and leave-no-trace practices. Pro tip: Specifying fitness level and experience creates more appropriate adventure recommendations. Cultural Etiquette Briefing
    Prepare travelers for cultural norms and expectations.
    Develop a cultural etiquette briefing for business travelers to Japan. Include greeting protocols, gift-giving customs, dining etiquette, meeting behaviors, communication styles, relationship-building expectations, and key faux pas to avoid with recovery strategies. Pro tip: Focusing on specific contexts (business, homestay, religious sites) creates more relevant guidance. Budget Travel Optimization
    Strategies for maximizing experiences while minimizing costs.
    Create a comprehensive budget travel guide for exploring Southeast Asia for one month on $2000 (excluding flights). Include accommodation strategies, transportation optimization, food approaches, experience prioritization, money management, and country-specific cost considerations. Pro tip: Specifying travel style preferences helps balance comfort and cost in budget recommendations. Local Experience Curation
    Discover authentic local experiences beyond typical tourist activities.
    Curate a collection of 10 authentic local experiences in Barcelona that most tourists miss. For each, include what makes it culturally significant, best timing, local etiquette tips, how to access it independently, and phrases in Catalan/Spanish that would enhance the experience. Pro tip: Requesting experiences in specific neighborhoods leads to more discoverable local recommendations. Themed Journey Planning
    Create travel itineraries around specific themes or interests.
    Design a 14-day literary-themed journey through the United Kingdom for book lovers. Include sites associated with famous authors, unique bookstores, literary museums, writing workshops, locations that inspired classic works, and recommended reading to enhance each experience. Pro tip: Narrowing the theme specificity (gothic literature vs. all literature) creates more focused journeys. Responsible Tourism Framework
    Develop approaches for minimizing negative impacts while traveling.
    Create a comprehensive responsible tourism guide for visiting indigenous communities in Central America. Include research preparation, appropriate compensation practices, photography ethics, cultural preservation considerations, environmental impact minimization, and meaningful exchange creation. Pro tip: Focusing on specific destinations provides more actionable responsibility guidelines. Family Travel Strategy
    Plan enriching travel experiences that accommodate multiple generations.
    Develop a strategy for a 7-day intergenerational family trip to Costa Rica with ages 5-75. Include activity pacing, accommodation considerations, contingency planning, age-appropriate engagement methods, memory-making opportunities, and conflict prevention approaches. Pro tip: Providing specific information about mobility issues or interests helps tailor family recommendations. Culinary Tourism Roadmap
    Plan travel experiences centered around food and culinary traditions.
    Create a 5-day culinary exploration itinerary for Sicily that traces the island’s diverse cultural influences. Include market visits, cooking experiences, producer tours, signature dishes, historical context for regional specialties, and wine pairings with cultural significance. Pro tip: Requesting focus on specific aspects (street food, fine dining, agriculture) creates more specialized culinary journeys. Transformational Travel Design
    Plan journeys focused on personal growth and perspective shifts.
    Design a 10-day transformational journey to Peru for someone seeking perspective after a major life transition. Include mindfulness practices, cultural exchange opportunities, challenging but meaningful experiences, reflection prompts, and methods to integrate insights after returning home. Pro tip: Sharing the specific transformation sought creates more purposeful journey recommendations. Environmental Issues
    Prompts exploring sustainability, conservation, climate solutions, and environmental challenges.
    Environmental Solution Assessment
    Evaluate approaches to addressing environmental challenges.
    Analyze vertical farming as a solution for sustainable urban food production. Assess current technologies, environmental benefits and drawbacks, economic viability, scalability challenges, social implications, and comparison with alternative approaches. Pro tip: Requesting both optimistic and pessimistic perspectives creates more balanced solution assessments. Sustainability Framework Development
    Create structured approaches to sustainability implementation.
    Develop a comprehensive sustainability framework for a medium-sized food manufacturer. Include governance structures, priority assessment methods, goal-setting processes, measurement approaches, stakeholder engagement strategies, and implementation roadmap with key milestones. Pro tip: Specifying industry contexts creates more relevant and actionable sustainability frameworks. Environmental Communication Strategy
    Develop approaches for effectively communicating environmental issues.
    Create a communication strategy for engaging suburban homeowners on watershed protection. Include message framing, barrier identification, behavior change triggers, visual approaches, community-based tactics, and methods for making abstract impacts tangible. Pro tip: Specifying audience values and priorities helps create more persuasive environmental messaging. Circular Economy Innovation
    Generate ideas for reducing waste through circular systems.
    Develop circular economy innovations for the footwear industry. Include materials recapture systems, product design transformations, business model adaptations, consumer engagement approaches, supply chain modifications, and implementation phasing for transitioning from linear models. Pro tip: Focusing on specific product categories creates more detailed circular economy recommendations. Environmental Justice Analysis
    Examine the intersection of environmental issues and social equity.
    Analyze environmental justice dimensions of urban heat island effects in major U.S. cities. Examine historical development patterns, current temperature and health disparities, contributing policies, community impacts, existing interventions, and potential equity-centered solutions. Pro tip: Focusing on specific communities or locations creates more grounded environmental justice analyses. Sustainable Lifestyle Transition
    Create practical approaches for adopting more sustainable habits.
    Develop a comprehensive 6-month plan for a suburban family transitioning to a lower-waste lifestyle. Include baseline assessment methods, prioritization framework, room-by-room transformations, shopping alternatives, family engagement tactics, and progress tracking systems. Pro tip: Including both high-impact and easy-win changes creates more motivating sustainability plans. Ecological Restoration Design
    Develop approaches for restoring damaged ecosystems.
    Create a framework for restoring an urban stream that has been channelized in concrete. Include assessment methodology, stakeholder engagement approach, phased intervention design, native species selection principles, community participation opportunities, and monitoring protocols. Pro tip: Specifying the ecosystem type and degradation factors leads to more relevant restoration approaches. Climate Adaptation Strategy
    Develop approaches for adapting to climate change impacts.
    Design a climate adaptation strategy for a coastal community facing sea level rise and increased storm intensity. Include vulnerability assessment methods, infrastructure modifications, retreat considerations, economic transition planning, and governance approaches. Pro tip: Providing specific geographic and socioeconomic context creates more relevant adaptation strategies. Conservation Education Program
    Design educational initiatives about environmental protection.
    Develop a comprehensive conservation education program about local pollinators for elementary school students. Include age-appropriate learning objectives, hands-on activities, outdoor components, assessment methods, family engagement elements, and community connection opportunities. Pro tip: Specifying learning environments (classroom, nature center, online) helps tailor educational approaches. Environmental Impact Assessment
    Analyze the environmental effects of products, policies, or activities.
    Create an environmental impact assessment framework for music festivals. Include energy use, transportation, waste generation, water consumption, land impact, noise pollution, local ecosystem effects, and recommendations for measurement and mitigation approaches. Pro tip: Requesting both direct and indirect impact analysis creates more comprehensive assessments. Psychology & Human Behavior
    Prompts exploring cognitive processes, behavioral patterns, emotional intelligence, and social dynamics.
    Cognitive Bias Analysis
    Examine how cognitive biases affect decision-making and perceptions.
    Analyze how confirmation bias influences political polarization. Explain the psychological mechanisms involved, how social media amplifies this bias, real-world consequences, evidence from research studies, and potential interventions at individual and platform levels. Pro tip: Focusing on specific contexts (workplace, relationships, health) creates more applicable bias analyses. Psychological Framework Application
    Apply psychological theories to understand specific behaviors or phenomena.
    Apply attachment theory to explain patterns in adult romantic relationships. Include the four attachment styles, their developmental origins, characteristic behaviors, impact on conflict resolution, healing approaches, and recent research developments in this field. Pro tip: Requesting multiple theoretical perspectives provides more comprehensive psychological analysis. Behavior Change Strategy
    Develop evidence-based approaches to modifying habits and behaviors.
    Create a comprehensive behavior change strategy for reducing smartphone overuse based on psychological principles. Include habit loop analysis, environmental modification tactics, replacement behavior development, cognitive restructuring techniques, and accountability systems. Pro tip: Specifying the target population helps tailor behavior change strategies to relevant motivations and barriers. Emotional Intelligence Development
    Create frameworks for understanding and improving emotional capabilities.
    Design a progressive emotional intelligence development program for technical professionals. Include self-awareness assessment methods, emotion regulation techniques, empathy-building exercises, practical workplace applications, and measurement approaches. Pro tip: Focusing on specific EI components (recognition, regulation, empathy) creates more targeted development plans. Psychological Safety Framework
    Develop approaches for creating environments of trust and openness.
    Create a comprehensive framework for building psychological safety in product development teams during periods of organizational change. Include leader behaviors, meeting practices, feedback mechanisms, conflict navigation approaches, and measurement methods. Pro tip: Specifying organizational context and challenges helps create more relevant psychological safety strategies. Motivation System Design
    Create structures to enhance motivation and engagement.
    Design a motivation system for a long-term health behavior program based on self-determination theory. Include autonomy support mechanisms, competence development approach, relatedness cultivation strategies, intrinsic/extrinsic balance considerations, and individualization frameworks. Pro tip: Requesting incorporation of specific motivational theories creates more evidence-based systems. Persuasion Ethics Framework
    Examine ethical considerations in influence and persuasion.
    Develop an ethical framework for persuasive design in mental health applications. Include boundary principles between encouragement and manipulation, transparency requirements, autonomy preservation methods, vulnerable population considerations, and application evaluation criteria. Pro tip: Focusing on specific contexts (marketing, healthcare, politics) creates more relevant ethical frameworks. Group Dynamic Analysis
    Examine patterns of interaction and influence in groups.
    Analyze group dynamics in cross-functional teams with significant power imbalances. Examine communication patterns, decision-making processes, conflict manifestations, status behavior, psychological safety challenges, and evidence-based interventions to improve collaboration. Pro tip: Specifying group composition and purpose helps create more relevant dynamic analyses. Decision-Making Process Optimization
    Improve how decisions are made based on psychological principles.
    Design a decision-making process for complex healthcare decisions involving multiple stakeholders. Include cognitive bias mitigation techniques, emotion integration methods, stakeholder input frameworks, tradeoff evaluation approaches, and post-decision review protocols. Pro tip: Clarifying decision types (high-stakes, frequent, technical) helps tailor appropriate processes. Psychological Need Assessment
    Identify core psychological needs in specific contexts.
    Create a comprehensive assessment framework for evaluating how well remote work environments fulfill employees’ core psychological needs. Include autonomy, competence, relatedness, meaning, security dimensions with measurement approaches and enhancement recommendations. Pro tip: Specifying demographic factors helps identify more relevant psychological needs and priorities. Final Thoughts
    The AI prompt examples provided are just starting points. As you become more familiar with AI systems, you’ll develop your own style and approach to prompt crafting. Remember that effective prompts are clear, specific, and provide the right amount of context.
    Experiment with different formats, levels of detail, and instructions to find what works best for your specific use case. The field of prompt engineering is constantly evolving, so stay curious and keep refining your techniques.
    With practice, you’ll be able to harness the full potential of AI tools, turning them into powerful extensions of your own creativity and problem-solving abilities.
    div#secondary { display: none; } .g1-column.g1-column-2of3 { width: 1200px; } /* Layout */ .container { max-width: 1000px !important; margin: 0 auto; padding: 0 1rem; } .intro { margin-bottom: 2rem; } /* Tab interface */ .tab-container { display: flex; border: 1px solid #333; border-radius: 0.5rem; overflow: hidden; margin-bottom: 2rem; } .tab-navigation { width: 250px; background-color: #321a3c; flex-shrink: 0; } .tab-button { width: 100%; text-align: left; padding: 0.75rem 1rem; background: none; border: none; color: white; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: background-color 0.2s; } .tab-button:hover { background-color: #c235c1; } .tab-button.active { background-color: #c235c1; font-weight: 500; } .tab-button .chevron { display: none; width: 16px; height: 16px; } .tab-button.active .chevron { display: inline; } .tab-content { flex: 1; padding: 1.5rem; overflow-y: auto; } .tab-panel { display: none; } .tab-panel.active { display: block; } .prompt-card { border: 1px solid #333; border-radius: 0.5rem; padding: 1rem; margin-bottom: 1.5rem; } .prompt-description { color: #aaa; margin-bottom: 0.75rem; } .prompt-example { background-color: #111; padding: 0.75rem; border-radius: 0.375rem; font-family: monospace; font-size: 0.875rem; margin-bottom: 0.75rem; white-space: pre-wrap; } .prompt-tips { font-size: 0.875rem; } .prompt-tips-label { font-weight: 600; color: #ddd; } .conclusion { padding: 1rem; border: 1px solid #333; border-radius: 0.5rem; } /* Responsive adjustments */ @media (max-width: 640px) { .tab-container { flex-direction: column; } .tab-navigation { width: 100%; display: flex; flex-wrap: wrap; } .tab-button { padding: 0.5rem; } .tab-content { max-height: none; } } The post AI Prompt Examples appeared first on AI Parabellum • Your Go-To AI Tools Directory for Success.
  2. by: Abhishek Kumar
    Tue, 25 Mar 2025 13:41:16 GMT

    Ollama has been a game-changer for running large language models (LLMs) locally, and I've covered quite a few tutorials on setting it up on different devices, including my Raspberry Pi.
    But as I kept experimenting, I realized there was still another fantastic way to run Ollama: inside a Docker container.
    Now, this isn’t exactly breaking news. The first Ollama Docker image was released back in 2023. But until recently, I always used it with a native install.
    It wasn’t until I was working on an Immich tutorial that I stumbled upon NVIDIA Container Toolkit, which allows you to add GPU support to Docker containers.
    That was when I got hooked on the idea of setting up Ollama inside Docker and leveraging GPU acceleration.
    In this guide, I’ll walk you through two ways to run Ollama in Docker with GPU support:
    Using a one liner docker run command. With Docker compose Now, let’s dive in.
    📋Before we get started, if you haven’t installed Docker yet, check out our previous tutorials on setting up Docker on Linux. Prerequisite: Installing Nvidia Container toolkit
    The NVIDIA Container Toolkit includes the NVIDIA Container Runtime and the NVIDIA Container Toolkit plugin for Docker, which enable GPU support inside Docker containers.
    Before installation, make sure that you have already installed the GPU drivers on your specific distro.
    Now, to install the NVIDIA Container Toolkit, follow these steps:
    Enable the NVIDIA CUDA repository on your system by running the following commands in a terminal window: distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list sudo apt updateIf your Nvidia GPU driver is not properly installed, you might encounter some problems when installing nvidia-container-toolkit on your system just like in my case on Debian 12.Install the NVIDIA Container Toolkit by running the following command in a terminal window: sudo apt install -y nvidia-container-toolkit Restart the Docker service to apply the changes: sudo systemctl restart docker Method 1: Running Ollama with Docker run (Quick Method)
    If you just want to spin up Ollama in a container without much hassle, this one-liner will do the trick:
    docker run -d --name ollama -p 11434:11434 -v ollama:/root/.ollama ollama/ollama Or, if you want the GPU support:
    docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollamaHere's a breakdown of what's going on with this command:
    docker run -d: Runs the container in detached mode. --name ollama: Names the container "ollama." -p 11434:11434: Maps port 11434 from the container to the host. -v ollama:/root/.ollama: Creates a persistent volume for storing models. ollama/ollama: Uses the official Ollama Docker image. Once the container is running, you can check its status with:
    docker psMethod 2: Running Ollama with Docker compose
    I personally find that docker compose is a more structured approach when setting up a service inside a container, as it's much easier to manage.
    💡If you're setting up Ollama with Open WebUI, I would suggest to use docker volumes instead of bind mounts for a less frustrating experience. We'll start with creating a docker-compose.yml file, to manage the Ollama container:
    version: '3.8' services: ollama: image: ollama/ollama container_name: ollama ports: - "11434:11434" volumes: - ollama:/root/.ollama deploy: resources: reservations: devices: - driver: nvidia count: all capabilities: [gpu] restart: unless-stopped volumes: ollama: With the docker-compose.yml file in place, start the container using:
    docker-compose up -d This will spin up Ollama with GPU acceleration enabled.
    Accessing Ollama in Docker
    Now that we have Ollama running inside a Docker container, how do we interact with it efficiently?
    There are two main ways:
    1. Using the Docker shell
    This is really easy, you can access Ollama container shell by typing:
    docker exec -it ollama <commands>but typing this same command overtime can be tiring. We can create an alias to make it shorter.
    Add this to your .bashrc file:
    echo 'alias ollama="docker exec -it ollama ollama"' >> $HOME/.bashrc source $HOME/.bashrcand since I'm using zsh shell, I'll be using this command:
    echo 'alias ollama="docker exec -it ollama ollama"' >> $HOME/.zshrc Now, instead of typing the full docker exec command, you can just run:
    ollama ps ollama pull llama3 ollama run llama3 This makes interacting with Ollama inside Docker feel just like using a native install.
    2. Using Ollama’s API with Web UI Clients
    Ollama exposes an API on http://localhost:11434, allowing other tools to connect and interact with it.
    If you prefer a graphical user interface (GUI) instead of the command line, you can use several Web UI clients.
    Some popular tools that work with Ollama include:
    Open WebUI – A simple and beautiful frontend for local LLMs. LibreChat – A powerful ChatGPT-like interface supporting multiple backends. We’ve actually covered 12 different tools that provide a Web UI for Ollama.
    Whether you want something lightweight or a full-featured alternative to ChatGPT, there’s a UI that fits your needs.
    Conclusion
    Running Ollama in Docker provides a flexible and efficient way to interact with local AI models, especially when combined with a UI for easy access over a network.
    I’m still tweaking my setup to ensure smooth performance across multiple devices, but so far, it’s working well.
    On another note, diving deeper into NVIDIA Container Toolkit has sparked some interesting ideas. The ability to pass GPU acceleration to Docker containers opens up possibilities beyond just Ollama.
    I’m considering testing it with Jellyfin for hardware-accelerated transcoding, which would be a huge boost for my media server setup.
    Other projects, like Stable Diffusion or AI-powered upscaling, could also benefit from proper GPU passthrough.
    That said, I’d love to hear about your setup! Are you running Ollama in Docker, or do you prefer a native install? Have you tried any Web UI clients, or are you sticking with the command line?
    Drop your thoughts in the comments below.
  3. by: Daniel Schwarz
    Tue, 25 Mar 2025 12:47:18 +0000

    I came across this awesome article navigator by Jhey Tompkins:
    CodePen Embed Fallback It solved a UX problem I was facing on a project, so I’ve adapted it to the needs of an online course — a “course navigator” if you will — and built upon it. And today I’m going to pick it apart and show you how it all works:
    CodePen Embed Fallback You can see I’m imagining this as some sort of navigation that you might find in an online learning management system that powers an online course. To summarize what this component does, it:
    links to all course lessons, smoothly scrolls to anchored lesson headings, indicates how much of the current lesson has been read, toggles between light and dark modes, and sits fixed at the bottom and collapses on scroll. Also, while not a feature, we won’t be using JavaScript. You might think that’s impossible, but the spate of CSS features that have recently shipped make all of this possible with vanilla CSS, albeit using bleeding-edge techniques that are only fully supported by Chrome at the time I’m writing this. So, crack open the latest version and let’s do this together!
    The HTML
    We’re looking at a disclosure widget (the <details> element) pinned to the bottom of the page with fixed positioning. Behind it? A course lesson (or something of that effect) wrapped in an <article> with ids on the headings for same-page anchoring. Clicking on the disclosure’s <summary> toggles the course navigation, which is wrapped in a ::details-content pseudo-element. This navigation links to other lessons but also scrolls to the aforementioned headings of the current lesson.
    The <summary> contains a label (since it functions as a toggle-disclosure button), the name of the current lesson, the distance scrolled, and a dark mode toggle.
    With me so far?
    <details> <!-- The toggle (flex →) --> <summary> <span><!-- Toggle label --></span> <span><!-- Current lesson + % read --></span> <label><!-- Light/dark-mode toggle --></label> </summary> <!-- ::details-content --> <!-- Course navigation --> <!-- /::details-content --> </details> <article> <h1 id="sectionA">Section A</h1> <p>...</p> <h2 id="sectionB">Section B</h2> <p>...</p> <h2 id="sectionC">Section C</h2> <p>...</p> </article> Getting into position
    First, we’ll place the disclosure with fixed positioning so that it’s pinned to the bottom of the page:
    details { position: fixed; inset: 24px; /* Use as margin */ place-self: end center; /* y x */ } Setting up CSS-only dark mode (the new way)
    There are certain scenarios where dark mode is better for accessibility, especially for the legibility of long-form content, so let’s set that up.
    First, the HTML. We have an ugly checkbox input that’s hidden thanks to its hidden attribute, followed by an <i> which’ll be a better-looking faux checkbox once we’ve sprinkled on some Font Awesome, followed by a <span> for the checkbox’s text label. All of this is then wrapped in an actual <label>, which is wrapped by the <summary>. We wrap the label’s content in a <span> so that flexbox gaps get applied between everything.
    Functionally, even though the checkbox is hidden, it toggles whenever its label is clicked. And on that note, it might be a good idea to place an explicit aria-label on this label, just to be 100% sure that screen readers announce a label, since implicit labels don’t always get picked up.
    <details> <summary> <!-- ... --> <label aria-label="Dark mode"> <input type="checkbox" hidden> <i></i> <span>Dark mode</span> </label> </summary> <!-- ... --> </details> Next we need to put the right icons in there, subject to a little conditional logic. Rather than use Font Awesome’s HTML classes and have to mess around with CSS overwrites, we’ll use Font Awesome’s CSS properties with our rule logic, as follows:
    If the <i> element is followed by (notice the next-sibling combinator) a checked checkbox, we’ll display a checked checkbox icon in it. If it’s followed by an unchecked checkbox, we’ll display an unchecked checkbox icon in it. It’s still the same rule logic even if you don’t use Font Awesome.
    /* Copied from Font Awesome’s CSS */ i::before { font-style: normal; font-family: "Font Awesome 6 Free"; display: inline-block; width: 1.25em; /* Prevents content shift when swapping to differently sized icons by making them all have the same width (this is equivalent to Font Awesome’s .fa-fw class) */ } /* If followed by a checked checkbox... */ input[type=checkbox]:checked + i::before { content: "\f058"; font-weight: 900; } /* If followed by an unchecked checkbox... */ input[type=checkbox]:not(:checked) + i::before { content: "\f111"; font-weight: 400; } We need to implement the modes at the root level (again, using a little conditional logic). If the root :has the checked checkbox, apply color-scheme: dark. If the root does :not(:has) the unchecked checkbox, then we apply color-scheme: light.
    /* If the root has a checked checkbox... */ :root:has(input[type=checkbox]:checked) { color-scheme: dark; } /* If the root does not have a checked checkbox... */ :root:not(:has(input[type=checkbox]:checked)) { color-scheme: light; } If you toggle the checkbox, your web browser’s UI will already toggle between light and dark color schemes. Now let’s make sure that our demo does the same thing using the light-dark() CSS function, which takes two values — the light mode color and then the dark mode color. You can utilize this function instead of any color data type (later on we’ll even use it within a conic gradient).
    In the demo I’m using the same HSL color throughout but with different lightness values, then flipping the lightness values based on the mode:
    color: light-dark(hsl(var(--hs) 90%), hsl(var(--hs) 10%)); background: light-dark(hsl(var(--hs) 10%), hsl(var(--hs) 90%)); I don’t think the light-dark() function is any better than swapping out CSS variables, but I don’t believe it’s any worse either. Totally up to you as far as which approach you choose.
    Displaying scroll progress
    Now let’s display the amount read as defined by the scroll progress, first, as what I like to call a “progress pie” and then, second, as a plain-text percentage. These’ll go in the middle part of the <summary>:
    <details> <summary> <!-- ... --> <span> <span id="progress-pie"></span> <span>1. LessonA</span> <span id="progress-percentage"></span> </span> <!-- ... --> </summary> <!-- ... --> </details> What we need is to display the percentage and allow it to “count” as the scroll position changes. Normally, this is squarely in JavaScript territory. But now that we can define our own custom properties, we can establish a variable called --percentage that is formatted as an integer that defaults to a value of 0. This provides CSS with the context it needs to read and interpolate the value between 0 and 100, which is the maximum value we want to support.
    So, first, we define the variable as a custom property:
    @property --percentage { syntax: "<integer>"; inherits: true; initial-value: 0; } Then we define the animation in keyframes so that the value of --percentage is updated from 0 to 100:
    @keyframes updatePercentage { to { --percentage: 100; } } And, finally, we apply the animation on the root element:
    :root { animation: updatePercentage; animation-timeline: scroll(); counter-reset: percentage var(--percentage); } Notice what we’re doing here: this is a scroll-driven animation! By setting the animation-timeline to scroll(), we’re no longer running the animation based on the document’s timeline but instead based on the user’s scroll position. You can dig deeper into scroll timelines in the CSS-Tricks Almanac.
    Since we’re dealing with an integer, we can target the ::before pseudo-element and place the percentage value inside of it using the content property and a little counter() hacking (followed by the percentage symbol):
    #progress-percentage::before { content: counter(percentage) "%"; min-width: 40px; display: inline-block; /* Prevents content shift */ } The progress pie is just as straightforward. It’s a conic gradient made up of two colors that are positioned using 0% and the scroll percentage! This means that you’ll need that --percentage variable as an actual percentage, but you can convert it into such by multiplying it by 1% (calc(var(--percentage) * 1%))!
    #progress-pie { aspect-ratio: 1; background: conic-gradient(hsl(var(--hs) 50%) calc(var(--percentage) * 1%), light-dark(hsl(var(--hs) 90%), hsl(var(--hs) 10%)) 0%); border-radius: 50%; /* Make it a circle */ width: 17px; /* Same dimensions as the icons */ } Creating a (good) course navigation
    Now for the table contents containing the nested lists of lesson sections within them, starting with some resets. While there are more resets in the demo and more lines of code overall, two specific resets are vital to the UX of this component.
    First, here’s an example of how the nested lists are marked up:
    <details> <summary> <!-- ... --> </summary> <ol> <li class="active"> <a>LessonA</a> <ol> <li><a href="#sectionA">SectionA</a></li> <li><a href="#sectionB">SectionB</a></li> <li><a href="#sectionC">SectionC</a></li> </ol> </li> <li><a>LessonB</a></li> <li><a>LessonC</a></li> </ol> </details> Let’s reset the list spacing in CSS:
    ol { padding-left: 0; list-style-position: inside; } padding-left: 0 ensures that the parent list and all nested lists snap to the left side of the disclosure, minus any padding you might want to add. Don’t worry about the indentation of nested lists — we have something planned for those. list-style-position: inside ensures that the list markers snap to the side, rather than the text, causing the markers to overflow.
    After that, we slap color: transparent on the ::markers of nested <li> elements since we don’t need the lesson section titles to be numbered. We’re only using nested lists for semantics, and nested numbered lists specifically because a different type of list marker (e.g., bullets) would cause vertical misalignment between the course’s lesson titles and the lesson section titles.
    ol ol li::marker { color: transparent; } Finally, so that users can more easily traverse the current lesson, we’ll dim all list items that aren’t related to the current lesson. It’s a form of emphasizing something by de-emphasizing others:
    details { /* The default color */ color: light-dark(hsl(var(--hs) 90%), hsl(var(--hs) 10%)); } /* <li>s without .active that’re direct descendants of the parent <ol> */ ol:has(ol) > li:not(.active) { /* A less intense color */ color: light-dark(hsl(var(--hs) 80%), hsl(var(--hs) 20%)); } /* Also */ a { color: inherit; } One more thing… those anchor links scroll users to specific headings, right? So, putting scroll-behavior: smooth on the root to enables smooth scrolling between them. And that percentage-read tracker that we created? Yep, that’ll work here as well.
    :root { scroll-behavior: smooth; /* Smooth anchor scrolling */ scroll-padding-top: 20px; /* A scroll offset, basically */ } Transitioning the disclosure
    Next, let’s transition the opening and closing of the ::details-content pseudo-element. By default, the <details> element snaps open and closed when clicked, but we want a smooth transition instead. Geoff recently detailed how to do this in a comprehensive set of notes about the <details> element, but we’ll break it down together.
    First, we’ll transition from height: 0 to height: auto. This is a brand-new feature in CSS! We start by “opting into” the feature at the root level with interpolate-size: allow-keywords`:
    :root { interpolate-size: allow-keywords; } I recommend setting overflow-y: clip on details::details-content to prevent the content from overflowing the disclosure as it transitions in and out:
    details::details-content { overflow-y: clip; } Another option is sliding the content out and then fading it in (and vice-versa), but you’ll need to be quite specific about the transition’s setup.
    First, for the “before” and “after” states, you’ll need to target both details[open] and details:not([open]), because vaguely targeting details and then overwriting the transitioning styles with details[open] doesn’t allow us to reverse the transition.
    After that, slap the same transition on both but with different values for the transition delays so that the fade happens after when opening but before when closing.
    Finally, you’ll also need to specify which properties are transitioned. We could simply put the all keyword in there, but that is neither performant nor allows us to set the transition durations and delays for each property. So we’ll list them individually instead in a comma-separated list. Notice that we’re specifically transitioning the content-visibility and using the allow-discrete keyword because it is a discrete property. this is why we opted into interpolate-size: allow-keywords earlier.
    details:not([open])::details-content { height: 0; opacity: 0; padding: 0 42px; filter: blur(10px); border-top: 0 solid light-dark(hsl(var(--hs) 30%), hsl(var(--hs) 70%)); transition: height 300ms 300ms, padding-top 300ms 300ms, padding-bottom 300ms 300ms, content-visibility 300ms 300ms allow-discrete, filter 300ms 0ms, opacity 300ms 0ms; } details[open]::details-content { height: auto; opacity: 1; padding: 42px; filter: blur(0); border-top: 1px solid light-dark(hsl(var(--hs) 30%), hsl(var(--hs) 70%)); transition: height 300ms 0ms, padding-top 300ms 0ms, padding-bottom 300ms 0ms, content-visibility 300ms 0ms allow-discrete, filter 300ms 300ms, opacity 300ms 300ms; } Giving the summary a label and icons
    Preceding the current lesson’s title, percentage read, and dark mode toggle, the <summary> element needs a label that helps describe what it does. I went with “Navigate course” and included an aria-label saying the same thing so that screen readers didn’t announce all that other stuff.
    <details> <summary aria-label="Navigate course"> <span> <i></i> <span>Navigate course</span> </span> <!-- ... --> </summary> <!-- ... --> </details> In addition, the summary gets display: flex so that we can easily separate the three sections with a gap, which also removes the summary’s default marker, allowing you to use your own. (Again, I’m using Font Awesome in the demo.)
    i::before { width: 1.25em; font-style: normal; display: inline-block; font-family: "Font Awesome 6 Free"; } details i::before { content: "\f0cb"; /* fa-list-ol */ } details[open] i::before { content: "\f00d"; /* fa-xmark */ } /* For older Safari */ summary::-webkit-details-marker { display: none; } And finally, if you’re pro-cursor: pointer for most interactive elements, you’ll want to use it on the summary and manually make sure that the checkbox’s label inherits it, as it doesn’t do that automatically.
    summary { cursor: pointer; } label { cursor: inherit; } Giving the disclosure an auto-closure mechanism
    A tiny bit of JavaScript couldn’t hurt though, could it? I know I said this is a no-JavaScript deal, but this one-liner will automatically close the disclosure when the mouse leaves it:
    document.querySelector("details").addEventListener("mouseleave", e => e.target.removeAttribute("open")); Annoying or useful? I’ll let you decide.
    Setting the preferred color scheme automatically
    Setting the preferred color scheme automatically is certainly useful, but if you like to avoid JavaScript wherever possible, I don’t think users will be too mad for not offering this feature. Either way, the following conditional snippet checks if the user’s preferred color scheme is “dark” by evaluating the relevant CSS media query (prefers-color-scheme: dark) using window.matchMedia and matches. If the condition is met, the checkbox gets checked, and then the CSS handles the rest.
    if (window.matchMedia("prefers-color-scheme: dark").matches) { document.querySelector("input[type=checkbox]").checked = true; } Recap
    This has been fun! It’s such a blessing we can combine all of these cutting-edge CSS features, not just into one project but into a single component. To summarize, that includes:
    a course navigator that shows the current lesson, all other lessons, and smooth scrolls between the different headings, a percentage-scrolled tracker that shows the amount read in plain text and as a conic gradient… pie chart, a light/dark-mode toggle (with some optional JavaScript that detects the preferred color scheme), and it is all packed into a single, floating, animated, native disclosure component. The newer CSS features we covered in the process:
    Scroll-driven animations interpolate-size: allow-keywords for transitioning between 0 and auto smooth scrolling by way of scroll-behavior: smooth dark mode magic using the light-dark() function a progress chart made with a conic-gradient() styling the ::details-content pseudo-element animating the <details> element Thanks to Jhey for the inspiration! If you’re not following Jhey on Bluesky or X, you’re missing out. You can also see his work on CodePen, some of which he has talked about right here on CSS-Tricks.
    Case Study: Combining Cutting-Edge CSS Features Into a “Course Navigation” Component originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.
  4. by: Chris Coyier
    Mon, 24 Mar 2025 17:03:34 +0000

    Back in the day I was a fan of the “Trebuchet MS” font. I didn’t like it large, but set fairly small I loved the look of it. Looked very website-ish — if that makes sense.
    Honestly, at 12px, it still looks really nice.
    The main reason I would use it is that it was considered a “web-safe” font, meaning most computers had “Trebuchet MS” installed and it would look more or less the same across those computers. On my latest-version macOS, I’ve still got it as a pre-installed system font.
    I was thinking about this as Oliver Schöndorfer blogged about it recently. He points out that mobile operating systems changed the math on what is actually “web safe”.
    Apparently none of the classic web-safe fonts are actually “web safe” anymore, which I suppose is ironic and kinda funny. I think designers have gotten more used to and OK with some differences in typography across browsers. Modern Font Stacks is a great resource for that. The whole point of a font stack is being cool with the actually used font being whichever one hits first in that list. The whole idea of system-ui is like a font stack in a keyword by itself, and particularly well suited to very “app like” websites that are helped by looking like the operating system they are being used on. Maybe the new web safe is just typography that works fine wherever. Or maybe that’s what it always meant.
    Along those lines, I think uifonts.app is a clever idea of looking at fonts in a very practical “app like” way. I like looking at beautiful typeface type specimens as much as the next fella but in the end it matters more what the typeface looks like on my boring thing not your fancy thing.
    They should probably add system-ui as an option! Quick hits:
    It’s a modern miracle you can drop an image of typography onto a tool and it’ll tell you what fonts are used. One of the greatest experiments (that turns out to be perfectly viable) is building syntax highlighting into fonts themselves. Font foundries really need to get on this. Will buy. Elliot Jay Stocks recently shared this arranged alphabet and it rules. I’ve always shied away from -webkit-font-smoothing: antialiased; but David Bushell almost has me convinced otherwise as 1) it’s macOS (very literally only) 2) it can make rendered fonts look closer to other operating systems, that is, thinner. My holdup is that I generally like thicker and it will be more consistent for users on that OS. But David is convinced enough to put it in reset stylesheets, so have a think for yourself. And some more visuals!
    Spagetty from Dan Cederholm Citywide by Jason Santa Maria Revenge Font by DUDE Times New Ramen by Seine Kongruangkit
  5. by: Geoff Graham
    Mon, 24 Mar 2025 14:06:19 +0000

    There’s a bit of a blind spot when working with CSS logical properties concerning shorthands. Miriam explains:
    She ends with the money question, whether we can do anything about it. We’re currently in a position of having to choose between supporting flow-relative terms like block-start and inline-start with longhand properties and the ergonomic benefits of writing shorthand properties that are evaluated as physical terms like top, bottom, left, and right. Those of us writing CSS for a while likely have the muscle memory to adapt accordingly, but it’s otherwise a decision that has real consequences, particularly for multi-lingual sites.
    Note that Miriam says this is something the CSS Working Group has been working on since 2017. And there’s a little momentum to pick it up and do something about it. The first thing you can do is support Miriam’s work — everything she does with the CSS Working Group (and it’s a lot) is a labor of love and relies on sponsorships, so chipping in is one way to push things forward.
    The other thing you can do is chime into Miriam’s proposal that she published in 2021. I think it’s a solid idea. We can’t simply switch from physical to flow-relative terms in shorthand properties without triggering compatibility issues, so having some sort of higher-level instruction for CSS at the top of the stylesheet, perhaps as an at-rule that specifies which “mode” we’re in.
    <coordinate-mode> = [ logical | physical ] or [ relative | absolute ] or ... @mode <coordinate-mode>; /* must come after @import and before any style rules */ @mode <coordinate-mode> { <stylesheet> } selector { property: value !<coordinate-mode>; } Perhaps naming aside, it seems pretty reasonable, eh?
    Support Logical Shorthands in CSS originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.
  6. by: Abhishek Prakash
    Mon, 24 Mar 2025 07:26:39 GMT

    How do you update Arch Linux? You run sudo pacman -Syu command.
    How do you install a package on Arch Linux? You run sudo pacman -Syu package_name.
    Which might make you wonder why do you need a system update while installing a new package? What does those S, y and u do? Let me explain these things to you.
    What does pacman -Syu does?
    In simpler words, pacman -Syu updates all the installed packages on your Arch-based Linux distribution if they have a newer version available. Here, -S stands for sync or install, y refreshes the local package database cache with the remote repository and u will make a list of all the install packages that can be updated by referring to the local package database cache and getting actual packages from the remote repository.
    Understanding pacman -Syu command
    I hope you are familiar with the concept of package manager. If not, please refer to this explainer article:
    What is a Package Manager in Linux?Learn about packaging system and package managers in Linux. You’ll learn how do they work and what kind of package managers available.It's FOSSAbhishek PrakashPacman package manager works pretty much the same. There is a remote repository that has the actual packages, a local package database that usually keeps the information about the packages by interacting with the remote repository. pacman is the command line interface that utilizes this structure to manage packages on your Arch Linux.
    -S (capital letter S) is the main option and y and u are 'sub-options' supporting it.
    S stands for sync but you can think of it as 'install'. It syncs your Arch Linux system with the remote repository for the given package. Meaning, both repository and local Arch system will be synced (at that time) for the given package. Which is another way of saying that the package is installed on the system.
    You cannot just run pacman -S and expect it to sync (install) all the packages from the repositories on the local system. That would be disastrous if your system installs all 40,000+ packages of the remote repositories.
    This is why you need to provide a target (package names) with only -S option. Otherwise, you'll see this error.
    sudo pacman -S error: no targets specified (use -h for help) If you specify a package or group name, it will 'install' the package on your system.
    There are additional options with Sync. You'll probably be using a lot of sudo pacman -Syu.
    Those y and u are 'sub options' of -S. You cannot use them on their own like pacman -yu:
    sudo pacman -yu error: invalid option '-y'While the order of S, y and u doesn't matter, there has to be an S with y and u.
    The y sub-option of S refreshes the local package cache DB with remote repository. Then u sub-option is for sysupgrade which refers to the local package cache to make a list of all the installed packages that can be upgraded to a newer version.
    With the work of these two sub options done, S (sync) will fetch the packages (newer versions) from the remote repository and install (update existing) them.
    📋Sometimes, I feel like it would have been better to use terms like install instead of sync and r for refresh instead of y. Easier to understand.Why some tutorials mention "pacman -Syu" even while installing a single package?
    You'll notice that many tutorials on the web often mention the pacman command for package installation in the following format:
    sudo pacman -Syu package_nameAnd you may wonder what's the point of updating all the installed packages.
    Sure, you can use sudo pacman -S package_name for installing packages, and it will run fine if you keep your Arch system updated frequently.
    But if you haven't run the system updates for a while, installation may throw 404 missing file error. You need to update the local package database.
    Now, you may think, why not just do sudo pacman -Sy package_name which would be quicker as it will refresh package database and install only the package you want, not upgrade other packages that have newer versions available?
    There is a pretty good reason for that. It helps avoid the dependency issues that could occur otherwise.
    I liked the analogy in this Reddit discussion and I am going to use the same here as well.
    Imagine an old-fashioned paper catalog folks used to get in the mail a few decades back. If you get a catalog in the mail from a store, it had a listing of everything the store had for sale and the current prices. The Arch package database is like this catalog. The catalog you have with you is the package database cache on your system.
    The packages are like the actual goods you buy through the catalog. You find the item number that you want in the catalog, place the order, and the correct item is delivered.
    Imagine you just run pacman -Sy. This is equivalent to getting the latest catalog.
    Now, let's say you have an iPhone 14 (an outdated package) and you order an iPhone charger from the new catalog. You'll have a problem when the new charger arrives because the iPhone now uses the type C port instead of the old lightning port. A conflict arises.
    If you had run pacman -Syu, you would have ordered both the newer iPhone and the correct charger with it.
    (Don't take it literally and start commenting that it will be a financially stupid decision to order a new phone instead of the older charger. This is just for example 😜)
    Conclusion
    I don't know whether you were ever curious about it or not, but I do hope you have a slightly better understanding of the logic behind the famous -Syu option of pacman command. The man page is always there to read the official explanation of each option and its usage.
    You can always explore more options of the pacman command to see what it can do for regular package management on Arch Linux.
    Using pacman Commands in Arch Linux [Beginner’s Guide]Learn what you can do with pacman commands in Linux, how to use them to find new packages, install and upgrade new packages, and clean your system.It's FOSSDimitrios🗨️ Did this article help you understand the 'sync' concept in Arch Linux, or are you more confused than before? Do let me know in the comment section.
  7. by: Abhishek Prakash
    Mon, 24 Mar 2025 07:26:39 GMT

    How do you update Arch Linux? You run sudo pacman -Syu command.
    How do you install a package on Arch Linux? You run sudo pacman -Syu package_name.
    Which might make you wonder why do you need a system update while installing a new package? What does those S, y and u do? Let me explain these things to you.
    What does pacman -Syu does?
    In simpler words, pacman -Syu updates all the installed packages on your Arch-based Linux distribution if they have a newer version available. Here, -S stands for sync or install, y refreshes the local package database cache with the remote repository and u will make a list of all the install packages that can be updated by referring to the local package database cache and getting actual packages from the remote repository.
    Understanding pacman -Syu command
    I hope you are familiar with the concept of package manager. If not, please refer to this explainer article:
    What is a Package Manager in Linux?Learn about packaging system and package managers in Linux. You’ll learn how do they work and what kind of package managers available.It's FOSSAbhishek PrakashPacman package manager works pretty much the same. There is a remote repository that has the actual packages, a local package database that usually keeps the information about the packages by interacting with the remote repository. pacman is the command line interface that utilizes this structure to manage packages on your Arch Linux.
    -S (capital letter S) is the main option and y and u are 'sub-options' supporting it.
    S stands for sync but you can think of it as 'install'. It syncs your Arch Linux system with the remote repository for the given package. Meaning, both repository and local Arch system will be synced (at that time) for the given package. Which is another way of saying that the package is installed on the system.
    You cannot just run pacman -S and expect it to sync (install) all the packages from the repositories on the local system. That would be disastrous if your system installs all 40,000+ packages of the remote repositories.
    This is why you need to provide a target (package names) with only -S option. Otherwise, you'll see this error.
    sudo pacman -S error: no targets specified (use -h for help) If you specify a package or group name, it will 'install' the package on your system.
    There are additional options with Sync. You'll probably be using a lot of sudo pacman -Syu.
    Those y and u are 'sub options' of -S. You cannot use them on their own like pacman -yu:
    sudo pacman -yu error: invalid option '-y'While the order of S, y and u doesn't matter, there has to be an S with y and u.
    The y sub-option of S refreshes the local package cache DB with remote repository. Then u sub-option is for sysupgrade which refers to the local package cache to make a list of all the installed packages that can be upgraded to a newer version.
    With the work of these two sub options done, S (sync) will fetch the packages (newer versions) from the remote repository and install (update existing) them.
    📋Sometimes, I feel like it would have been better to use terms like install instead of sync and r for refresh instead of y. Easier to understand.Why always run "pacman -Syu" even while installing a single package?
    You'll notice that Arch package installation often mentions the pacman command in the following format:
    sudo pacman -Syu package_nameAnd you may wonder what's the point of updating all the installed packages. Why not just do sudo pacman -Sy package_name which would be quicker as it will only install the package you want, not upgrade other packages that have newer versions available?
    There is a pretty good reason for that. It helps avoid the dependency issues that could occur otherwise.
    I liked the analogy in this Reddit discussion and I am going to use the same here as well.
    Imagine an old-fashioned paper catalog folks used to get in the mail a few decades back. If you get a catalog in the mail from a store, it had a listing of everything the store had for sale and the current prices. The Arch package database is like this catalog. The catalog you have with you is the package database cache on your system.
    The packages are like the actual goods you buy through the catalog. You find the item number that you want in the catalog, place the order, and the correct item is delivered.
    Imagine you just run pacman -Sy. This is equivalent to getting the latest catalog.
    Now, let's say you have an iPhone 14 (an outdated package) and you order an iPhone charger from the new catalog. You'll have a problem when the new charger arrives because the iPhone now uses the type C port instead of the old lightning port. A conflict arises.
    If you had run pacman -Syu, you would have ordered both the newer iPhone and the correct charger with it.
    (Don't take it literally and start commenting that it will be a financially stupid decision to order a new phone instead of the older charger. This is just for example 😜)
    Conclusion
    I don't know whether you were ever curious about it or not, but I do hope you have a slightly better understanding of the logic behind the famous -Syu option of pacman command. The man page is always there to read the official explanation of each option and its usage.
    You can always explore more options of the pacman command to see what it can do for regular package management on Arch Linux.
    Using pacman Commands in Arch Linux [Beginner’s Guide]Learn what you can do with pacman commands in Linux, how to use them to find new packages, install and upgrade new packages, and clean your system.It's FOSSDimitrios🗨️ Did this article help you understand the 'sync' concept in Arch Linux, or are you more confused than before? Do let me know in the comment section.
  8. Durable

    by: aiparabellum.com
    Mon, 24 Mar 2025 02:37:45 +0000

    Durable is a cutting-edge AI website builder and small business software designed to simplify the process of getting your business online. With its suite of tools, including a website builder, CRM, invoicing, and more, Durable aims to make owning and managing a business as easy as possible. Whether you’re a solopreneur or a small business owner, Durable provides the essential tools you need to build, grow, and manage your business efficiently.
    Features
    AI Website Builder: Create a professional business website in seconds without any coding skills. CRM: Keep track of all your customers in one centralized place. Invoicing: Send online invoices and get paid faster. AI Blog Builder: Generate multiple blog posts effortlessly using AI. AI Brand Builder: Instantly build your brand identity. SEO and Marketing Tools: Built-in tools for SEO, automated blogging, ad generation, and review management. Business Name Generator: AI-generated ideas for naming your business. Google Ad Writer: AI-generated copy for promoting your business. Wage Calculator: Estimate earnings, costs, and work hours. How It Works
    Sign Up: Start for free without needing a credit card. Generate Website: Use the AI tools to create your website in seconds. Customize: Tailor your website and other tools to fit your business needs. Publish: Effortlessly publish your website online. Manage: Use the CRM, invoicing, and other tools to manage your business operations. Benefits
    Quick Setup: Get your business online in just 30 seconds. No Coding Required: Build and customize your website without any technical skills. Integrated Tools: All the tools you need in one place, from website building to customer management. Enhanced Productivity: Automate workflows and save hours of manual work. SEO Friendly: Built-in SEO tools to help you find customers quickly. Marketing Automation: Grow your revenue with automated marketing tools. Pricing
    Durable offers a variety of plans to suit different business needs. For a limited time, you can take 20% off any Durable subscription with the code DBL20, valid until July 2nd, 2024.
    Review
    Durable has received positive reviews from users who appreciate its simplicity and effectiveness. Meredith May of Colour Wonder Balloons states, “It’s almost like I’ve added a whole team of web developers and marketers, but I don’t have to pay them.” Pietro Pirani, a photographer, mentions, “With Durable, everything felt really obvious and on other platforms I used, it was more complicated. I also love the CRM tool.” Chef Igor from Calgary shares, “Durable has been instrumental in legitimizing and showcasing my culinary skills, significantly broadening my professional reach and impact.”
    Conclusion
    Durable is a comprehensive solution for small business owners looking to build, grow, and manage their business effortlessly. With powerful AI tools and an easy-to-use interface, Durable makes it possible to get your business online and reach new heights in no time. Try Durable today and experience the ease of managing your business with AI.
    The post Durable appeared first on AI Parabellum • Your Go-To AI Tools Directory for Success.
  9. by: aiparabellum.com
    Mon, 24 Mar 2025 02:36:04 +0000

    In today’s fast-paced business world, we’re seeing a major shift in how companies operate and manage their resources. At the center of this transformation is AI SaaS (Artificial Intelligence Software as a Service). These cloud-based AI solutions are changing the game for businesses of all sizes. No longer do companies need massive budgets or technical teams to access powerful AI tools. Instead, they can subscribe to services that offer ready-to-use AI capabilities for a fraction of the traditional cost. Tools like an ai prompt generator are making it easier than ever to harness AI’s potential. This shift isn’t just convenient–it’s completely reshaping business economics in ways we couldn’t have imagined just a few years ago.
    Breaking Down Cost Barriers
    Remember when implementing new technology meant huge upfront investments? Those days are quickly fading. With AI SaaS, the economic model has fundamentally changed. Companies can now access sophisticated AI tools through subscription models that spread costs over time. Using an openai pricing calculator can help businesses accurately forecast their AI expenditures. This shift from capital expenditure to operational expenditure is a game-changer, especially for smaller businesses. We’re noticing that even startups can now compete with established players by leveraging the same powerful AI tools without breaking the bank.
    The pay-as-you-go model also means businesses aren’t locked into expensive systems that might become outdated. Instead, they can scale services up or down as needed, ensuring they only pay for what they actually use. This flexibility creates a much healthier cash flow situation for businesses navigating uncertain economic times.
    Productivity Revolution
    Let’s talk about what happens when AI takes over routine tasks. We’re seeing dramatic shifts in how work gets done. Tasks that once required hours of human attention–like data entry, basic customer service, or initial sales qualification–can now be handled by AI systems. An ai prompt manager can help organizations maintain and optimize their AI interactions across different departments. This doesn’t just save time; it fundamentally changes the economics of business operations.
    When employees are freed from repetitive tasks, they can focus on high-value work that actually drives business growth. The numbers speak for themselves: many companies report productivity increases of 30-40% after implementing AI SaaS solutions. This isn’t just about doing the same work faster–it’s about completely reimagining what’s possible with the same number of employees.
    Democratizing Advanced Capabilities
    Perhaps the most transformative aspect of AI SaaS is how it’s leveling the playing field. We’re witnessing a democratization of capabilities that were once available only to tech giants with massive R&D budgets. Now, a small marketing firm can access the same quality of predictive analytics as a Fortune 500 company. A local retailer can implement sophisticated inventory management systems that rival major chains.
    This accessibility is creating new economic opportunities across the business landscape. Companies that might have been pushed out of competitive markets due to technological disadvantages can now stay in the game. We’re essentially seeing a redistribution of competitive advantage, where strategic implementation of AI tools can matter more than sheer company size or historical market dominance.
    Data-Driven Decision Making
    The economics of decision-making has also been transformed by AI SaaS. In the past, business leaders often relied on intuition and limited data samples to make major strategic choices. Now, we have access to AI systems that can process vast amounts of information and identify patterns humans might miss.
    This shift dramatically reduces the cost of poor decisions. When companies can test scenarios, predict outcomes, and analyze trends with AI-powered tools, they’re less likely to make expensive mistakes. We’re finding that businesses using AI for decision support typically see reductions in failed initiatives and improvements in successful outcomes. The economic impact of better decisions compound over time, creating significant long-term advantages for early adopters.
    New Business Models
    AI SaaS isn’t just changing how existing businesses operate–it’s creating entirely new economic models and opportunities. We’re seeing the emergence of micro-businesses built entirely around AI capabilities, offering specialized services that wouldn’t have been viable without these technologies.
    For instance, small teams can now offer enterprise-grade analytics services by leveraging AI platforms. Solo entrepreneurs can create sophisticated digital products with AI assistance that would have required entire development teams in the past. These new business models are reshaping industry structures and creating economic value in previously untapped areas.
    Challenges and Considerations
    While the economic benefits are clear, we should acknowledge that this transformation isn’t without challenges. Businesses need to carefully navigate implementation costs, training requirements, and integration with existing systems. There’s also the ongoing challenge of choosing the right AI SaaS partners in an increasingly crowded marketplace.
    Data privacy concerns and regulatory compliance add another layer of economic consideration. Companies must balance the benefits of AI-powered insights with the costs of ensuring proper data governance. Implementing a harmful content detector can help organizations maintain ethical standards and protect their brand reputation. We’re finding that successful organizations view these not just as compliance issues but as opportunities to build trust and differentiation in the market.
    Looking Forward
    As we look to the future, the economic impact of AI SaaS will likely accelerate. We expect to see even more sophisticated tools becoming available at increasingly accessible price points. The gap between early adopters and laggards may widen, creating stronger economic incentives for businesses to embrace these technologies sooner rather than later.
    The most successful organizations will be those that view AI SaaS not just as a cost-saving measure but as a strategic asset that can transform their business models. We’re already seeing evidence that companies taking this approach are outperforming their peers in terms of growth and profitability.
    Conclusion
    The transformation of business economics through AI SaaS represents one of the most significant shifts in how companies operate and compete. From reducing costs and improving productivity to enabling entirely new business models, these technologies are creating opportunities across every industry.
    For business leaders, the message is clear: understanding and strategically implementing AI SaaS isn’t just a technology decision–it’s a fundamental business imperative with far-reaching economic implications. As these tools continue to evolve, they’ll increasingly separate market leaders from the rest of the pack. The question isn’t whether AI SaaS will transform your business economics, but how quickly you’ll adapt to this new reality.
    The post How AI SaaS is Transforming Business Economics appeared first on AI Parabellum • Your Go-To AI Tools Directory for Success.
  10. Publer

    by: aiparabellum.com
    Sun, 23 Mar 2025 03:01:06 +0000

    Publer is your ultimate social media management superhero, designed to simplify and enhance your social media presence. Whether you’re managing multiple brands or looking to streamline your social media strategy, Publer offers a comprehensive suite of tools to help you collaborate, schedule, and analyze your posts across various platforms. From Facebook and Instagram to TikTok and Twitter, Publer ensures that your social media campaigns are efficient, effective, and engaging.
    Features
    Link in Bio: Draw attention with a unique link on Instagram Bio. Calendar View: View, create, and organize all upcoming social media posts. Workspaces: Collaborate with other members to manage multiple brands. Browser Extension: Create & schedule new social media posts from any website. Analytics: Make data-driven decisions using powerful social media analytics. Curate Posts: Create and preview social media posts in real-time. Bulk Scheduling: Schedule up to 500 posts with a CSV file or other bulk options. Recycling: Save time and recycle any top-performing content. AI Assist: Unleash the power of AI on your social media. Media Integrations: Design from scratch and organize all visual content. RSS Feed: Automate new posts from your favorite RSS Feeds. Free Tools: Includes photo & video downloader, bold & italic text generator, and threads to carousels converter (coming soon). How it Works
    Sign Up: Create a Publer account to get started. Connect Accounts: Link your social media accounts including Facebook, Instagram, Twitter, LinkedIn, Pinterest, and more. Create Posts: Use the intuitive interface to draft, preview, and schedule posts. Collaborate: Utilize workspaces to collaborate with team members on content creation and scheduling. Schedule: Plan your posts in advance using the calendar view and bulk scheduling options. Analyze: Leverage the analytics feature to track performance and refine your strategy. Benefits
    Streamlined Workflow: Manage all your social media accounts from a single platform. Collaborative Tools: Workspaces enhance team collaboration and efficiency. Enhanced Creativity: AI Assist and media integrations boost your content creation process. Data-Driven Decisions: Analytics provide insights to optimize your social media strategy. Time-Saving: Features like bulk scheduling and recycling of top-performing content save valuable time. Pricing
    Free Plan: Basic features with limited access. Professional Plan: Enhanced features and tools for growing businesses. Business Plan: Advanced features for large teams and multiple brands. Enterprise Plan: Custom solutions tailored to large-scale operations. Review
    Publer has garnered positive reviews for its user-friendly interface and robust feature set. Users appreciate the platform’s ability to streamline social media management tasks, from scheduling and analytics to collaboration and content creation. The integration of AI tools and media management features further enhances its value, making it a preferred choice for businesses of all sizes looking to optimize their social media strategies.
    Conclusion
    Publer stands out as a comprehensive social media management platform that caters to the diverse needs of businesses and social media managers. With its powerful features, collaborative tools, and data-driven insights, Publer empowers users to take control of their social media presence and achieve their marketing goals. Whether you’re a small business or a large enterprise, Publer provides the tools you need to succeed in the dynamic world of social media.
    The post Publer appeared first on AI Parabellum • Your Go-To AI Tools Directory for Success.
  11. Remini

    by: aiparabellum.com
    Sat, 22 Mar 2025 09:52:47 +0000

    In an age where visual content is king, having high-quality images and videos is paramount. Remini, an AI-powered photo enhancer, offers a cutting-edge solution for transforming low-quality visuals into stunning HD masterpieces. From restoring old photos to enhancing modern digital content, Remini provides a comprehensive suite of tools that cater to various needs.
    Features
    Enhance: Instantly improve the overall quality of your photos and videos, making them sharper and more vibrant. Unblur & Sharpener: Remove motion blur, camera shake, and focus issues to create clear and sharp images. Denoiser: Eliminate grain and noise from photos to achieve crystal-clear visuals. Old Photos Restorer: Revive blurred, faded, and damaged photos, bringing them back to life with incredible detail. Image Enlarger: Upscale photos and videos up to 2x their original size without losing quality. Color Fixer: Enhance the color tones in your photos to produce natural and vivid images. Face Enhancer: Improve facial details in portraits, ensuring a natural and realistic look. Background Enhancer: Increase the quality of every detail in the background of your images. Low Quality Enhancer: Boost the quality of low-resolution images to make them appear professional. Video Enhancer: Enhance and enlarge your videos with AI-powered technology. How It Works
    Using Remini is straightforward:
    Upload Your Image/Video: Start by uploading the photo or video you wish to enhance. Select the Enhancement Tool: Choose from Remini’s suite of enhancement tools based on your specific needs. Apply the Enhancement: Let Remini’s AI technology work its magic to transform your visual content. Download the Enhanced Content: Once the enhancement is complete, download your high-quality image or video. Benefits
    User-Friendly Interface: Remini is designed to be intuitive, making it accessible to users of all skill levels. Professional-Grade Enhancements: Achieve studio-quality enhancements with a few simple clicks. Time-Efficient: Save hours of manual editing with instant AI-powered improvements. Versatility: Suitable for various applications, including social media, heritage preservation, printing services, e-commerce, education, and magazines. High Satisfaction: Millions of users worldwide trust Remini for its consistent, high-quality results. Pricing
    Remini offers both free and premium features:
    Free Version: Access basic enhancement tools with ads. Premium Membership: Unlock all advanced features and enjoy an ad-free experience for a subscription fee. Review
    Users across different platforms have praised Remini for its impressive capabilities:
    Android User: “Never seen such a high-quality app that is free. It’s easy to access and fun. Highly recommended!” iOS User: “This app is amazing. It dramatically improved an old photo of my grandmother. I’m delighted.” Web User: “Remini is the quickest solution for enhancing photos, much faster than manual editing.” Conclusion
    Remini stands out as an essential tool for anyone looking to elevate their visual content. Its powerful AI-driven enhancements make it possible to transform low-quality images and videos into professional-grade masterpieces effortlessly. Whether you’re a social media enthusiast, a historian preserving family photos, or a professional needing high-quality visuals, Remini has you covered.
    The post Remini appeared first on AI Parabellum • Your Go-To AI Tools Directory for Success.
  12. Magnific

    by: aiparabellum.com
    Fri, 21 Mar 2025 13:33:03 +0000

    Magnific AI offers a revolutionary tool for transforming and upscaling images to achieve stunning high-resolution results. This AI-driven software is designed to enhance photos, illustrations, and digital art with an impressive level of detail. Whether you’re a professional artist, graphic designer, or just someone looking to improve personal photos, Magnific AI promises to take your creations to the next level with ease and precision.
    Features
    Magnific AI boasts a range of powerful features that make it a standout tool for image enhancement:
    Advanced AI Technology: Utilizes cutting-edge AI to upscale and enhance images with remarkable detail. Natural Language Prompts: Direct the upscaling process using descriptive text prompts. Creativity Slider: Adjust the level of AI-generated details and creative enhancements. HDR and Resemblance Sliders: Fine-tune the high-dynamic-range effects and resemblance to the original image. Variety of Uses: Perfect for portraits, illustrations, video games, landscapes, films, and more. User-Friendly Interface: Intuitive and accessible for creators of all skill levels. How It Works
    Upload Your Image: Start by uploading the image you want to upscale or enhance. Set Parameters: Use the natural language prompt and sliders (Creativity, HDR, Resemblance) to define how you want the AI to process your image. AI Processing: Magnific AI uses its advanced algorithms to transform your image based on the parameters set. Download Enhanced Image: Once the process is complete, download the high-resolution, enhanced version of your image. Benefits
    High-Resolution Output: Achieve stunningly detailed and high-resolution images. Creative Control: Customize the enhancement process with intuitive controls. Versatility: Suitable for a wide range of applications, from personal photos to professional digital art. Time-Saving: Quickly and efficiently upscale and enhance images without manual editing. Cost-Efficiency: Offers a cost-effective solution compared to traditional methods of image enhancement. Pricing
    Magnific AI offers various pricing plans to suit different needs:
    Pro Plan: $39 per month Premium Plan: $99 per month Business Plan: $299 per month Annual subscriptions are available with a two-month discount. Subscriptions can be canceled at any time through the billing portal.
    Review
    Users of Magnific AI have praised its ability to transform images with minimal effort. The intuitive interface and powerful AI-driven enhancements make it a favorite among photographers, digital artists, and businesses. While some users have noted occasional artifacts, these can generally be managed with the available sliders and prompts.
    Conclusion
    Magnific AI stands out as a powerful tool for anyone looking to enhance and upscale images with ease and precision. Its advanced AI technology, user-friendly interface, and versatile applications make it an invaluable resource for both professionals and enthusiasts. Whether for personal projects or professional work, Magnific AI delivers results that truly feel like magic.
    The post Magnific appeared first on AI Parabellum • Your Go-To AI Tools Directory for Success.
  13. Revisiting CSS border-image

    by: Andy Clarke
    Fri, 21 Mar 2025 13:24:11 +0000

    In my last article on “Revisiting CSS Multi-Column Layout”, I mentioned that almost twenty years have flown by since I wrote my first book, Transcending CSS. In it, I explained how and why to use what were, at the time, an emerging CSS property.
    Ten years later, I wrote the Hardboiled Web Design Fifth Anniversary Edition, covering similar ground and introducing the new CSS border-image property.
    Hint: I published an updated version, Transcending CSS Revisited which is free to read online. Hardboiled Web Design is available from my bookshop.
    I was very excited about the possibilities this new property would offer. After all, we could now add images to the borders of any element, even table cells and rows (unless their borders had been set to collapse).
    Since then, I’ve used border-image regularly. Yet, it remains one of the most underused CSS tools, and I can’t, for the life of me, figure out why. Is it possible that people steer clear of border-image because its syntax is awkward and unintuitive? Perhaps it’s because most explanations don’t solve the type of creative implementation problems that most people need to solve. Most likely, it’s both.
    I’ve recently been working on a new website for Emmy-award-winning game composer Mike Worth. He hired me to create a highly graphical design that showcases his work, and I used border-image throughout.
    Design by Andy Clarke, Stuff & Nonsense. Mike Worth’s website will launch in April 2025, but you can see examples from this article on CodePen. A brief overview of properties and values
    First, here’s a short refresher. Most border-image explanations begin with this highly illuminating code snippet:
    border-image: \[source\] [slice]/\[width]/[outset\] [repeat] This is shorthand for a set of border-image properties, but it’s best to deal with properties individually to grasp the concept more easily.
    A border-image’s source
    I’ll start with the source of the bitmap or vector format image or CSS gradient to be inserted into the border space:
    border-image-source: url('/img/scroll.png'); When I insert SVG images into a border, I have several choices as to how. I could use an external SVG file:
    border-image-source: url('/img/scroll.svg'); Or I might convert my SVG to data URI using a tool like Base64.Guru although, as both SVG and HTML are XML-based, this isn’t recommended:
    border-image-source: url('data:image/svg+xml;base64,…'); Instead, I can add the SVG code directly into the source URL value and save one unnecessary HTTP request:
    border-image-source: url('data:image/svg+xml;utf8,…'); Finally, I could insert an entirely CSS-generated conical, linear, or radial gradient into my border:
    border-image-source: conical-gradient(…); Tip: It’s useful to remember that a browser renders a border-image above an element’s background and box-shadow but below its content. More on that a little later.
    Slicing up a border-image
    Now that I’ve specified the source of a border image, I can apply it to a border by slicing it up and using the parts in different positions around an element. This can be the most baffling aspect for people new to border-image.
    Most border-image explanations show an example where the pieces will simply be equally-sized, like this:
    However, a border-image can be developed from any shape, no matter how complex or irregular.
    Instead of simply inserting an image into a border and watching it repeat around an element, invisible cut-lines slice up a border-image into nine parts. These lines are similar to the slice guides found in graphics applications. The pieces are, in turn, inserted into the nine regions of an element’s border.
    The border-image-slice property defines the size of each slice by specifying the distance from each edge of the image. I could use the same distance from every edge:
    border-image-slice: 65 I can combine top/bottom and left/right values:
    border-image-slice: 115 65; Or, I can specify distance values for all four cut-lines, running clockwise: top, right, bottom, left:
    border-image-slice: 65 65 115 125; The top-left of an image will be used on the top-left corner of an element’s border. The bottom-right will be used on the bottom-right, and so on.
    I don’t need to add units to border-image-slice values when using a bitmap image as the browser correctly assumes bitmaps use pixels. The SVG viewBox makes using them a little different, so I also prefer to specify their height and width:
    <svg height="600px" width="600px">…</svg> Don’t forget to set the widths of these borders, as without them, there will be nowhere for a border’s image to display:
    border-image-width: 65px 65px 115px 125px; Filling in the center
    So far, I’ve used all four corners and sides of my image, but what about the center? By default, the browser will ignore the center of an image after it’s been sliced. But I can put it to use by adding the fill keyword to my border-image-slice value:
    border-image-slice: 65px 65px 115px 125px fill; Setting up repeats
    With the corners of my border images in place, I can turn my attention to the edges between them. As you might imagine, the slice at the top of an image will be placed on the top edge. The same is true of the right, bottom, and left edges. In a flexible design, we never know how wide or tall these edges will be, so I can fine-tune how images will repeat or stretch when they fill an edge.
    Stretch: When a sliced image is flat or smooth, it can stretch to fill any height or width. Even a tiny 65px slice can stretch to hundreds or thousands of pixels without degrading.
    border-image-repeat: stretch; Repeat: If an image has texture, stretching it isn’t an option, so it can repeat to fill any height or width.
    border-image-repeat: repeat; Round: If an image has a pattern or shape that can’t be stretched and I need to match the edges of the repeat, I can specify that the repeat be round. A browser will resize the image so that only whole pieces display inside an edge.
    border-image-repeat: round; Space: Similar to round, when using the space property, only whole pieces will display inside an edge. But instead of resizing the image, a browser will add spaces into the repeat.
    border-image-repeat: space; When I need to specify a separate stretch, repeat, round, or space value for each edge, I can use multiple keywords:
    border-image-repeat: stretch round; Outsetting a border-image
    There can be times when I need an image to extend beyond an element’s border-box. Using the border-image-outset property, I can do just that. The simplest syntax extends the border image evenly on all sides by 10px:
    border-image-outset: 10px; Of course, there being four borders on every element, I could also specify each outset individually:
    border-image-outset: 20px 10px; /* or */ border-image-outset: 20px 10px 0; border-image in action
    Mike Worth is a video game composer who’s won an Emmy for his work. He loves ’90s animation — especially Disney’s Duck Tales — and he asked me to create custom artwork and develop a bold, retro-style design.
    My challenge when developing for Mike was implementing my highly graphical design without compromising performance, especially on mobile devices. While it’s normal in CSS to accomplish the same goal in several ways, here, border-image often proved to be the most efficient.
    Decorative buttons
    The easiest and most obvious place to start was creating buttons reminiscent of stone tablets with chipped and uneven edges.
    I created an SVG of the tablet shape and added it to my buttons using border-image:
    button { border-image-repeat: stretch; border-image-slice: 10 10 10 10 fill; border-image-source: url('data:image/svg+xml;utf8,…'); border-image-width: 20px; } I set the border-image-repeat on all edges to stretch and the center slice to fill so these stone tablet-style buttons expand along with their content to any height or width.
    CodePen Embed Fallback Article scroll
    I want every aspect of Mike’s website design to express his brand. That means continuing the ’90s cartoon theme in his long-form content by turning it into a paper scroll.
    The markup is straightforward with just a single article element:
    <article> <!-- ... --> </article> But, I struggled to decide how to implement the paper effect. My first thought was to divide my scroll into three separate SVG files (top, middle, and bottom) and use pseudo-elements to add the rolled up top and bottom parts of the scroll. I started by applying a vertically repeating graphic to the middle of my article:
    article { padding: 10rem 8rem; box-sizing: border-box; /* Scroll middle */ background-image: url('data:image/svg+xml;utf8,…'); background-position: center; background-repeat: repeat-y; background-size: contain; } Then, I added two pseudo-elements, each containing its own SVG content:
    article:before { display: block; position: relative; top: -30px; /* Scroll top */ content: url('data:image/svg+xml;utf8,…'); } article:after { display: block; position: relative; top: 50px; /* Scroll bottom */ content: url('data:image/svg+xml;utf8,…'); } While this implementation worked as expected, using two pseudo-elements and three separate SVG files felt clumsy. However, using border-image, one SVG, and no pseudo-elements feels more elegant and significantly reduces the amount of code needed to implement the effect.
    I started by creating an SVG of the complete tablet shape:
    And I worked out the position of the four cut-lines:
    Then, I inserted this single SVG into my article’s border by first selecting the source, slicing the image, and setting the top and bottom edges to stretch and the left and right edges to round:
    article { border-image-slice: 150 95 150 95 fill; border-image-width: 150px 95px 150px 95px; border-image-repeat: stretch round; border-image-source: url('data:image/svg+xml;utf8,…'); } The result is a flexible paper scroll effect which adapts to both the viewport width and any amount or type of content.
    CodePen Embed Fallback Home page overlay
    My final challenge was implementing the action-packed graphic I’d designed for Mike Worth’s home page. This contains a foreground SVG featuring Mike’s orangutan mascot and a zooming background graphic:
    <section> <!-- content --> <div>...</div> <!-- ape --> <div> <svg>…</svg> </div> </section> I defined the section as a positioning context for its children:
    section { position: relative; } Then, I absolutely positioned a pseudo-element and added the zooming graphic to its background:
    section:before { content: ""; position: absolute; z-index: -1; background-image: url('data:image/svg+xml;utf8,…'); background-position: center center; background-repeat: no-repeat; background-size: 100%; } I wanted this graphic to spin and add subtle movement to the panel, so I applied a simple CSS animation to the pseudo-element:
    @keyframes spin-bg { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } section:before { animation: spin-bg 240s linear infinite; } Next, I added a CSS mask to fade the edges of the zooming graphic into the background. The CSS mask-image property specifies a mask layer image, which can be a PNG image, an SVG image or mask, or a CSS gradient:
    section:before { mask-image: radial-gradient(circle, rgb(0 0 0) 0%, rgb(0 0 0 / 0) 60%); mask-repeat: no-repeat; } At this point, you might wonder where a border image could be used in this design. To add more interactivity to the graphic, I wanted to reduce its opacity and change its color — by adding a colored gradient overlay — when someone interacts with it. One of the simplest, but rarely-used, methods for applying an overlay to an element is using border-image. First, I added a default opacity and added a brief transition:
    section:before { opacity: 1; transition: opacity .25s ease-in-out; } Then, on hover, I reduced the opacity to .5 and added a border-image:
    section:hover::before { opacity: .5; border-image: fill 0 linear-gradient(rgba(0,0,255,.25),rgba(255,0,0,1)); } You may ponder why I’ve not used the other border-image values I explained earlier, so I’ll dissect that declaration. First is the border-image-slice value, where zero pixels ensures that the eight corners and edges stay empty. The fill keyword ensures the middle section is filled with the linear gradient. Second, the border-image-source is a CSS linear gradient that blends blue into red. A browser renders this border-image above the background but behind the content.
    CodePen Embed Fallback Conclusion: You should take a fresh look at border-image
    The border-image property is a powerful, yet often overlooked, CSS tool that offers incredible flexibility. By slicing, repeating, and outsetting images, you can create intricate borders, decorative elements, and even dynamic overlays with minimal code.
    In my work for Mike Worth’s website, border-image proved invaluable, improving performance while maintaining a highly graphical aesthetic. Whether used for buttons, interactive overlays, or larger graphic elements, border-image can create visually striking designs without relying on extra markup or multiple assets.
    If you’ve yet to experiment with border-image, now’s the time to revisit its potential and add it to your design toolkit.
    Hint: Mike Worth’s website will launch in April 2025, but you can see examples from this article on CodePen.
    About Andy Clarke
    Often referred to as one of the pioneers of web design, Andy Clarke has been instrumental in pushing the boundaries of web design and is known for his creative and visually stunning designs. His work has inspired countless designers to explore the full potential of product and website design.
    Andy’s written several industry-leading books, including Transcending CSS, Hardboiled Web Design, and Art Direction for the Web. He’s also worked with businesses of all sizes and industries to achieve their goals through design.
    Visit Andy’s studio, Stuff & Nonsense, and check out his Contract Killer, the popular web design contract template trusted by thousands of web designers and developers.

    Revisiting CSS border-image originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.
  14. by: Geoff Graham
    Thu, 20 Mar 2025 13:51:29 +0000

    I’ve seen a handful of recent posts talking about the utility of the :is() relational pseudo-selector. No need to delve into the details other than to say it can help make compound selectors a lot more readable.
    :is(section, article, aside, nav) :is(h1, h2, h3, h4, h5, h6) { color: #BADA55; } /* ... which would be the equivalent of: */ section h1, section h2, section h3, section h4, section h5, section h6, article h1, article h2, article h3, article h4, article h5, article h6, aside h1, aside h2, aside h3, aside h4, aside h5, aside h6, nav h1, nav h2, nav h3, nav h4, nav h5, nav h6 { color: #BADA55; } There’s just one catch: the specificity. The selector’s specificity matches the most specific selector in the function’s arguments. That’s not a big deal when working with a relatively flat style structure containing mostly element and class selectors, but if you toss an ID in there, then that’s the specificity you’re stuck with.
    /* Specificity: 0 0 1 */ :is(h1, h2, h3, h4, h5, h6) { color: #BADA55; } /* Specificity: 1 0 0 */ :is(h1, h2, h3, h4, h5, h6, #id) { color: #BADA55; } That can be a neat thing! For example, you might want to intentionally toss a made-up ID in there to force a style the same way you might do with the !important keyword.
    What if you don’t want that? Some articles suggest nesting selectors instead which is cool but not quite with the same nice writing ergonomics.
    There’s where I want to point to the :where() selector instead! It’s the exact same thing as :is() but without the specificity baggage. It always carries a specificity score of zero. You might even think of it as a sort of specificity reset.
    /* Specificity: 0 0 0 */ :where(h1, h2, h3, h4, h5, h6) { color: #BADA55; } /* Specificity: 0 0 0 */ :where(h1, h2, h3, h4, h5, h6, #id) { color: #BADA55; } So, is there a certain selector hijacking your :is() specificity? You might want :where() instead.
    Quick Reminder That :is() and :where() Are Basically the Same With One Key Difference originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.
  15. by: Abhishek Prakash
    Thu, 20 Mar 2025 05:18:33 GMT

    We reached the 30,000 followers mark on Mastodon. This is an unexpected feat.
    We have 140,000 people on our Twitter profile but that's because Twitter/X is a bigger platform. I am pleasantly surprised to see so many people on an alternative, decentralized platform like Mastodon.
    If you use Mastodon, do join us there.
    It&#39;s FOSS (@itsfoss@mastodon.social)6.2K Posts, 27 Following, 30.2K Followers · World’s leading Linux and Open Source web portal. https://itsfoss.com/Mastodon💬 Let's see what else you get in this edition
    AntiX and IceWM reviving an old computer. Roblox introducing a new open source AI model. A new GIMP release arriving after a decade of development. And other Linux news, tips, and, of course, memes! This edition of FOSS Weekly is supported by ANY.RUN. 🤖 ANY.RUN’s Instant Android Threat Analysis Is Live – Now Available to Everyone
    ANY.RUN’s Interactive Sandbox now supports Android OS, making mobile malware detection faster, smarter, and more effective in a secure, real-time environment.
    Now your team can analyze Android malware behavior just like on a real device: interact with possible threats and speed up response times.
    Be among the first to try this game-changing upgrade and help your team:
    Expand threat visibility with real-time APK analysis Reduce incident response times Simplify threat hunting Lower cybersecurity costs …all from one convenient, cloud-based environment ☁️
    Available for ALL plans, including Free. Start your first analysis now!
    Interactive Online Malware Analysis Sandbox - ANY.RUNCloud-based malware analysis service. Take your information security to the next level. Analyze suspicious and malicious activities using our innovative tools.ANY.RUN📰 Linux and Open Source News
    Zed editor now has native Git support. cuOpt is NVIDIA's latest open source offering. SystemRescue 12.00 has launched with the latest LTS kernel. PINE64's updated PineTab-V now features a Debian-based distro. Dash to Panel GNOME extension is looking for a new maintainer. Roblox has unveiled Cube 3D, their open source AI model for 3D creation. Steam's ongoing Spring Sale has some nice discounts on games that run on Linux. GNOME 48 is here to bring a modern desktop experience to Linux.
    GNOME 48 Released With Focus on Your Digital WellbeingIt took its time, but GNOME 48 is finally here with some rather interesting changes.It's FOSS NewsSourav RudraAfter making us wait for 10 years, the GIMP 3.0 release has finally shown up with loads of improvements:
    After a Decade of Waiting, GIMP 3.0.0 is Finally Here!At last, GIMP 3.0 has arrived.It's FOSS NewsSourav Rudra🧠 What We’re Thinking About
    One of our community contributors switched from Xfce on EndeavourOS to IceWM on AntiX. They shared how it went.
    Switching From Xfce to IceWM With AntiX, My Old Computer is Back in Action AgainHow I switched from Xfce on EndeavourOS to IceWM on antiX and customized it to fit my vibe.It's FOSS NewsCommunity🧮 Linux Tips, Tutorials and More
    Quick tip on using AppImage applications as default. You know you can watch Star Wars in the Linux terminal? GNOME's Activity Search is more powerful than you think. We now have IPv4 and IPv6, ever wondered what happened to IPv5? 👷 Homelab and Maker's Corner
    Manage LLMs locally and easily by using Ollama commands.
    Must Know Ollama Commands for Managing LLMs locallyHere are the ollama commands you need to know for managing your large language models effectively.It's FOSSAbhishek Kumar✨ Apps Highlight
    Keep track of the data usage on your Android smartphone with Data Monitor.
    Data Monitor: The Sleek Open-Source Android App to Track Data UsageHow much data do you use on a daily/monthly basis? Data Monitor helps you track that.It's FOSS NewsAnkush Das📽️ Videos I am Creating for You
    I share how I dual booted CachyOS with Windows in this video.
    Subscribe to It's FOSS YouTube Channel🧩 Quiz Time
    This fun crossword is for the fans of Debian... and/or Toy Story. And another one on open source licenses.
    Open-Source Licenses: QuizYou must learn about the open-source licenses. And, this quiz helps you do that.It's FOSSAnkush Das💡 Quick Handy Tip
    In GNOME, you can add custom directories to GNOME Search. First open Settings and go to Search → Search Locations. Here, click on Add Locations and choose a location.
    Now, add the locations you want to see as results in the overview. After that, whenever you search, these locations will appear in the results page if there's a match. In this quick demo, I just showed you how to do it, on your computer, avoid adding locations like /etc, /usr, etc.
    🤣 Meme of the Week
    The list is virtually non-existent at this point. 🙂
    🗓️ Tech Trivia
    On March 17, 1988, Apple sued Microsoft, claiming that Windows 2.0 copied the Macintosh GUI. Initially, a judge ruled that Microsoft had limited rights based on an earlier licensing agreement. The case went through appeals and eventually reached the U.S. Supreme Court, which declined to review it in 1995.
    This decision effectively ended the legal battle, allowing Microsoft to continue using the Windows GUI.
    🧑‍🤝‍🧑 FOSSverse Corner
    An interesting read on the move by Ubuntu towards Rust.
    Modernizing Ubuntu with Rust-based ToolingInteresting article. There is a YouTube video talking about it too. It talks about rewriting GNU Coreutils in Rust.It's FOSS Communitypdecker❤️ With love
    Share it with your Linux-using friends and encourage them to subscribe (hint: it's here).
    Share the articles in Linux Subreddits and community forums.
    Follow us on Google News and stay updated in your News feed.
    Opt for It's FOSS Plus membership and support us 🙏
    Enjoy FOSS 😄
  16. by: Tatiana P
    Wed, 19 Mar 2025 12:34:33 +0000

    Riina Luoso
    Head of Core Solutions
    Fluido
    When faced with challenges, the key is to be bold—embrace experimentation and don’t fear iteration until you get it right.
    I’m Riina Luoso, a seasoned professional with 20 years in the tech industry, including seven years at Fluido, an Infosys company. I lead one of Fluido’s delivery units, working with highly skilled experts across Europe to help our customers leverage the Salesforce platform. My role is to ensure we have the right talent at the right time to meet our customers’ needs.
    My passion lies in empowering my team to excel. This means fostering an environment of support, continuous learning, and professional growth. I also engage with the business side—how to reach our targets, how we navigate the market, and the value we deliver to customers. My focus is on keeping our team at the cutting edge of technology while ensuring everyone enjoys their work, performs their best, and thrives.
    A culture of cooperation  
    Fluido has a fantastic culture, and one of our greatest strengths is knowledge-sharing. Here, expertise isn’t hoarded—everyone is open to exchanging insights. This spirit of collaboration ensures no one has to master everything alone. It’s one of the things I appreciate most about our company.
    Transferable skills  
    My background in team sports has shaped my professional journey. Playing sports in my youth and early adulthood taught me about teamwork, resilience, and leadership. Winning and failing together instilled valuable lessons that I’ve carried into my career.
    Sports also showed me how diverse individuals can unite toward a common goal, each bringing unique strengths to the table. My experience as a team captain and coach honed my leadership skills, preparing me for the challenges of guiding a professional team. Most importantly, sports taught me how to navigate setbacks and turn them into opportunities for growth.
    Tips to stay up-to-date in the IT field
    The tech industry evolves rapidly, and I’ve long accepted that mastering everything is impossible. Instead, I focus on what’s relevant now and what trends may impact the future.
    As a consultant, I constantly explore new topics, whether through industry reports, online resources, or discussions with colleagues. Conversations with peers are among the best ways to gain insights and stay informed. When I find something particularly intriguing, I dive deeper into research across multiple sources.
    How do I overcome challenges and move forward?
    The central aspect is not to fear the new. Curiosity is crucial. When tackling new challenges, I focus on understanding how innovations can benefit individuals or organizations. I seek insights from those with hands-on experience, learning from their perspectives before deciding how to approach things myself. The willingness to experiment, iterate, and refine ideas is key to progress.
    Where does this resilience come from?
    Resilience has always been part of who I am. My parents instilled in me a simple principle: if you commit to something, give it your best effort. This mindset has guided me naturally throughout my career.
    Keeping a work-life balance
    Balancing work and family is an ongoing challenge, but I prioritize boundaries. Unless it’s an emergency, I keep my weekends work-free, dedicating time to my children and shared activities.
    One of my favorite ways to disconnect is woodworking. From crafting small utensils to building furniture, it demands my full attention and provides a refreshing break from screens.
    My final message to the audience is to take your work seriously—but not too seriously. Give your best effort, but remember to laugh and enjoy the journey.
    The post Forum 2024 Role model blog: Riina Luoso, Fluido first appeared on Women in Tech Finland.
  17. by: Abhishek Prakash
    Wed, 19 Mar 2025 12:17:19 GMT

    Imagine you found a cool text editor like Pulsar and downloaded it in the AppImage format. You enjoy using it and now want to make it the default application for markdown files.
    You right-click on the file and click 'open with' option, but here, you don't see the Pulsar listed here.
    That's a problem, right? But it can be easily fixed by creating a desktop entry for that AppImage application.
    Let me show you how to do that.
    Step 1: Create a desktop entry for AppImage
    The very first step is to create a desktop file for the AppImage application. Here, we will use the Gear Lever app to create the desktop entry.
    Gear Lever is available as a Flatpak package from FlatHub. I know. Another package format, but that's how it is.
    Anyway, if you have Flatpak support enabled, install Gear Lever with this command:
    flatpak install flathub it.mijorus.gearleverNow, right-click on the AppImage file you downloaded and select Open With Gear Lever.
    Open AppImage in Gear LeverClick on the Unlock button in Gear Lever.
    Click on UnlockNow click on the "Move to app menu" button.
    Click on the "Move to the app menu" buttonVerify everything is ok by searching for the app in the system menu.
    Verify the app integrationGreat! So we have the application integrated in the desktop. Let's move to the second step.
    Step 2: Setting default app through file manager
    Let's say you want to open all your .txt text files in the Pulsar editor.
    The easiest way to achieve is through the File Manager.
    Open the file manager and right-click on the file of your choice. Now select the Open With option.
    Select the "Open With" optionIn the next window, you can start typing the name of the application to begin a search. It will also show you the AppImage program you integrated with the desktop previously.
    Search for an AppOnce you spot the app, click on it to select and then enable the "Always use for this file type" toggle button. Then click Open as shown in the screenshot below.
    Set a default appThat's it. From now on, your file will be opened in the AppImage of your choice. To verify this, you can right-click on the file. The first entry on the context menu will be the name of your AppImage application. In this case, Pulsar.
    First item in the context menuAlternative method: Change apps from settings
    Let's say you have an AppImage for applications like Web Browser, Music Player, etc. These can be changed from the system settings.
    Given you have created the AppImage desktop entry following the first step, open the system settings in Ubuntu.
    Go to Apps → Default Apps.
    Here, set the apps for categories you want.
    Set Default BrowserIf you click on the drop-down menu corresponding to a category in settings, you can select an app. The AppImage app will also be listed here. In the screenshot above, you can see Vivaldi AppImage is set as the default browser.
    For Linux Mint users, you can set it using the Preferred Application settings.
    Preferred application in Linux MintConclusion
    A lot of AppImage 'issue' or should I say shortcomings, can be solved by desktop integration. It surprises me that AppImage doesn't provide an official way of doing these things.
    Well, we have the wonderful open source developers that help us by creating helpful utilities like Gear Lever here.
    I hope this quick little tip helps you enjoy your AppImages 😄
  18. by: Guest Contributor
    Wed, 19 Mar 2025 06:52:59 GMT

    Introduction
    Backing up the database in MS SQL Server is vital to safeguard and recover the data in case of scenarios, like hardware failure, server failure, database corruption, etc. MS SQL Server provides different types of backups, such as differential, transactional, and full backup. A full backup allows you to restore the database in exactly the same form as it was at the time of creating the backup. The differential backup stores only the edits since the last full backup was created, whereas the transaction log backup is an incremental backup that stores all the transaction logs.
    When you restore SQL database backup, SQL Server offers two options to control the state of the database after restore. These are:
    RESTORE WITH RECOVERY
    When you use the RESTORE WITH RECOVERY option, it indicates no more restores are required and the state of database changes to online after the restore operation.
    RESTORE WITH NORECOVERY
    You can select the WITH NORECOVERY option when you want to continue restoring additional backup files, like transactional or differential. It changes the database to restoring state until it’s recovered.
    Now, let’s learn how to use the WITH RECOVERY and NORECOVERY options when restoring the database.
    How to Restore MS SQL Server Database with the RECOVERY Option?
    You can use the WITH RECOVERY option to restore a database from full backup. It is the default option in the Restore Database window and is used when restoring the last backup or only the backup in a restore sequence. You can restore database WITH RECOVERY option by using SQL Server Management Studio (SSMS) or T-SQL commands.
    1. Restore Database with RECOVERY Option using SSMS
    If you want to restore database without writing code and scripts, then you can use the graphical user interface in SSMS. Here are the steps to restore database WITH RECOVERY using SSMS:
    Open SSMS and connect to your SQL Server instance. Go to Object Explorer, expand databases, and right-click on the database. Click Tasks > Restore.
    On the Restore database page, under General, select the database you want to restore and the available backup. Next, on the same page, click Options. In the Options window, select the recovery state as RESTORE WITH RECOVERY. Click OK.
    2. Restore Database with RECOVERY Option using T-SQL Command
    If you have a large number of operations that need to be managed or you want to automate the tasks, then you can use T-SQL commands. You can use the below T-SQL command to restore the database with the RECOVERY option.
    RESTORE DATABASE [DBName] FROM DISK = 'C:\Backup\DB.bak' WITH RECOVERY; How to Restore MS SQL Server Database with NORECOVERY Option?
    You can use the NORECOVERY option to restore multiple backup files. For example, if your system fails and you need to restore the SQL Server database to the point just before the failure occurred, then you need a multi-step restore. In this, each backup should be in a sequence, like Full Backup > Differential > Transaction log. Here, you need to select the database in NORECOVERY mode except for the last one. This option changes the state of the database to RESTORING and makes the database inaccessible to the users unless additional backups are restored. You can restore the database with the NORECOVERY option by using SSMS or T-SQL commands.
    1. Using T-SQL Commands
    Here are the steps to restore MS SQL database with the NORECOVERY option by using T-SQL commands:
    Step 1: First, you need to restore the Full Backup by using the below command:
    RESTORE DATABASE [YourDatabaseName] FROM DISK = N'C:\Path\To\Your\FullBackup.bak' WITH NORECOVERY, STATS = 10; Step 2: Then, you need to restore the Differential Backup. Use the below command:
    RESTORE DATABASE [YourDatabaseName] FROM DISK = N'C:\Path\To\Your\DifferentialBackup.bak' WITH NORECOVERY, STATS = 10; Step 3: Now, you have to restore the Transaction log backup (last backup WITH RECOVERY). Here’s the command:
    RESTORE LOG [YourDatabaseName] FROM DISK = N'C:\Path\To\Your\LastTransactionLogBackup.bak' WITH RECOVERY, STATS = 10; 2. Using SQL Server Management Studio (SSMS)
    You can follow the below steps to restore the database with NORECOVERY option using the SSMS:
    In SSMS, go to the Object Explorer, expand databases, and right-click the database node. Click Tasks, select Restore, and click Database. In the Restore Database page, select the source (i.e. full backup), and the destination. Click OK. Next, add the information about the selected backup file in the option labelled - Backup sets to restore. Next, on the same Restore Database page, click Options. On the Options page, click RESTORE WITH NORECOVERY in the Recovery state field. Click OK.
    What if the SQL Database Backup File is Corrupted?
    Sometimes, the restore process can fail due to corruption in the database backup file. If your backup file is corrupted or you've not created a backup file, then you can take the help of a professional MS SQL repair tool, like Stellar Repair for MS SQL Technician. It is an advanced SQL repair tool to repair corrupt databases and backup files with complete integrity. The tool can repair backup files of any type - transactional log, full backup, and differential - without any file-size limitations. It can even restore deleted items from the backup database file. The tool is compatible with MS SQL Server version 2022, 2019, and earlier.
    Conclusion
    Above, we have discussed the stepwise process to restore the SQL database with RECOVERY and NORECOVERY options in MS SQL Server. If you face any error or issue while restoring the backup, then you can use a professional SQL repair tool, like Stellar Repair for MS SQL Technician. It can easily restore all the data from corrupt backup (.bak) files and save it in a new database file with complete precision. The tool can help resolve all the errors related to corruption in SQL database and backup (.bak) files.
  19. by: Guest Contributor
    Wed, 19 Mar 2025 06:52:59 GMT

    Introduction
    Backing up the database in MS SQL Server is vital to safeguard and recover the data in case of scenarios, like hardware failure, server failure, database corruption, etc. MS SQL Server provides different types of backups, such as differential, transactional, and full backup. A full backup allows you to restore the database in exactly the same form as it was at the time of creating the backup. The differential backup stores only the edits since the last full backup was created, whereas the transaction log backup is an incremental backup that stores all the transaction logs.
    When you restore SQL database backup, SQL Server offers two options to control the state of the database after restore. These are:
    RESTORE WITH RECOVERY
    When you use the RESTORE WITH RECOVERY option, it indicates no more restores are required and the state of database changes to online after the restore operation.
    RESTORE WITH NORECOVERY
    You can select the WITH NORECOVERY option when you want to continue restoring additional backup files, like transactional or differential. It changes the database to restoring state until it’s recovered.
    Now, let’s learn how to use the WITH RECOVERY and NORECOVERY options when restoring the database.
    How to Restore MS SQL Server Database with the RECOVERY Option?
    You can use the WITH RECOVERY option to restore a database from full backup. It is the default option in the Restore Database window and is used when restoring the last backup or only the backup in a restore sequence. You can restore database WITH RECOVERY option by using SQL Server Management Studio (SSMS) or T-SQL commands.
    1. Restore Database with RECOVERY Option using SSMS
    If you want to restore database without writing code and scripts, then you can use the graphical user interface in SSMS. Here are the steps to restore database WITH RECOVERY using SSMS:
    Open SSMS and connect to your SQL Server instance. Go to Object Explorer, expand databases, and right-click on the database. Click Tasks > Restore.
    On the Restore database page, under General, select the database you want to restore and the available backup. Next, on the same page, click Options. In the Options window, select the recovery state as RESTORE WITH RECOVERY. Click OK.
    2. Restore Database with RECOVERY Option using T-SQL Command
    If you have a large number of operations that need to be managed or you want to automate the tasks, then you can use T-SQL commands. You can use the below T-SQL command to restore the database with the RECOVERY option.
    RESTORE DATABASE [DBName] FROM DISK = 'C:\Backup\DB.bak' WITH RECOVERY; How to Restore MS SQL Server Database with NORECOVERY Option?
    You can use the NORECOVERY option to restore multiple backup files. For example, if your system fails and you need to restore the SQL Server database to the point just before the failure occurred, then you need a multi-step restore. In this, each backup should be in a sequence, like Full Backup > Differential > Transaction log. Here, you need to select the database in NORECOVERY mode except for the last one. This option changes the state of the database to RESTORING and makes the database inaccessible to the users unless additional backups are restored. You can restore the database with the NORECOVERY option by using SSMS or T-SQL commands.
    1. Using T-SQL Commands
    Here are the steps to restore MS SQL database with the NORECOVERY option by using T-SQL commands:
    Step 1: First, you need to restore the Full Backup by using the below command:
    RESTORE DATABASE [YourDatabaseName] FROM DISK = N'C:\Path\To\Your\FullBackup.bak' WITH NORECOVERY, STATS = 10; Step 2: Then, you need to restore the Differential Backup. Use the below command:
    RESTORE DATABASE [YourDatabaseName] FROM DISK = N'C:\Path\To\Your\DifferentialBackup.bak' WITH NORECOVERY, STATS = 10; Step 3: Now, you have to restore the Transaction log backup (last backup WITH RECOVERY). Here’s the command:
    RESTORE LOG [YourDatabaseName] FROM DISK = N'C:\Path\To\Your\LastTransactionLogBackup.bak' WITH RECOVERY, STATS = 10; 2. Using SQL Server Management Studio (SSMS)
    You can follow the below steps to restore the database with NORECOVERY option using the SSMS:
    In SSMS, go to the Object Explorer, expand databases, and right-click the database node. Click Tasks, select Restore, and click Database. In the Restore Database page, select the source (i.e. full backup), and the destination. Click OK. Next, add the information about the selected backup file in the option labelled - Backup sets to restore. Next, on the same Restore Database page, click Options. On the Options page, click RESTORE WITH NORECOVERY in the Recovery state field. Click OK.
    What if the SQL Database Backup File is Corrupted?
    Sometimes, the restore process can fail due to corruption in the database backup file. If your backup file is corrupted or you've not created a backup file, then you can take the help of a professional MS SQL repair tool, like Stellar Repair for MS SQL Technician. It is an advanced SQL repair tool to repair corrupt databases and backup files with complete integrity. The tool can repair backup files of any type - transactional log, full backup, and differential - without any file-size limitations. It can even restore deleted items from the backup database file. The tool is compatible with MS SQL Server version 2022, 2019, and earlier.
    Conclusion
    Above, we have discussed the stepwise process to restore the SQL database with RECOVERY and NORECOVERY options in MS SQL Server. If you face any error or issue while restoring the backup, then you can use a professional SQL repair tool, like Stellar Repair for MS SQL Technician. It can easily restore all the data from corrupt backup (.bak) files and save it in a new database file with complete precision. The tool can help resolve all the errors related to corruption in SQL database and backup (.bak) files.
  20. by: Abhishek Kumar
    Tue, 18 Mar 2025 10:58:47 +0530

    You know that moment when you dive into a project, thinking, "This should be easy," and then hours later, you're buried under obscure errors, outdated forum posts, and conflicting advice?
    Yeah, that was me while trying to package my Python app into a .deb file.
    It all started with my attempt to revive an old project, which some of our long-time readers might remember - Compress PDF.
    PDF Compressor Tool v1.0 by Its FOSSSince I’ve been learning Python these days, I thought, why not customize the UI, tweak the logic, and give it a fresh start?
    The python app was working great when running inside a virtual environment but I was more interested in shipping this app as a .deb binary, making installation as simple as dpkg -i app.deb.
    Every tutorial I read online, covered bits and pieces, but none walked me through the entire process. So here I am, documenting my experience while packaging my script into a .deb file.
    Choosing the right packaging tool
    For turning a Python script into an executable, I am using PyInstaller. Initially, I tried using py2deb, a tool specifically meant for creating .deb packages.
    Bad idea. Turns out, py2deb hasn’t been maintained in years and doesn’t support newer Python versions.
    PyInstaller takes a Python script and bundles it along with its dependencies into a single standalone executable. This means users don’t need to install Python separately, it just works out of the box.
    Step 1: Install PyInstaller
    First, make sure you have PyInstaller installed. If not, install it using pip:
    pip install pyinstaller Check if it's installed correctly:
    pyinstaller --version Step 2: Create the .deb package structure
    To keep things clean and structured, .deb packages follows a specific folder structure.
    compressor/ ├── pdf-compressor/ │ ├── DEBIAN/ │ │ ├── control │ │ ├── postinst │ ├── usr/ │ │ ├── bin/ │ │ ├── share/ │ │ │ ├── applications/ │ │ │ ├── icons/ │ │ │ ├── pdf-compressor/Let’s create it:
    mkdir -p pdf-compressor/DEBIAN mkdir -p pdf-compressor/usr/bin mkdir -p pdf-compressor/usr/share/applications mkdir -p pdf-compressor/usr/share/icons/ mkdir -p pdf-compressor/usr/share/pdf-compressor/What each directory is for?
    usr/bin/: Stores the executable file. usr/share/applications/: Contains the .desktop file (so the app appears in the system menu). usr/share/icons/: Stores the app icon. DEBIAN/: Contains metadata like package info and dependencies. Optional: Packaging dependencies
    Before packaging the app, I wanted to ensure it loads assets and dependencies correctly whether it's run as a script or a standalone binary.
    Initially, I ran into two major problems:
    The in-app logo wasn’t displaying properly because asset paths were incorrect when running as a packaged executable. Dependency errors occurred when running the app as an executable. To keep everything self-contained and avoid conflicts with system packages, I created a virtual environment inside: pdf-compressor/usr/share/pdf-compressor
    python3 -m venv venv source venv/bin/activateThen, I installed all the dependencies inside it:
    pip install -r requirements.txt deactivate This ensures that dependencies are bundled properly and won’t interfere with system packages.
    Now to ensure that the app correctly loads assets and dependencies, I modified the script as follows:
    import sys import os # Ensure the virtual environment is used venv_path = "/usr/share/pdf-compressor/venv" if os.path.exists(venv_path): sys.path.insert(0, os.path.join(venv_path, "lib", "python3.10", "site-packages")) # Detect if running as a standalone binary if getattr(sys, 'frozen', False): app_dir = sys._MEIPASS # PyInstaller's temp folder else: app_dir = os.path.dirname(os.path.abspath(__file__)) # Set correct paths for assets icon_path = os.path.join(app_dir, "assets", "icon.png") logo_path = os.path.join(app_dir, "assets", "itsfoss-logo.webp") pdf_icon_path = os.path.join(app_dir, "assets", "pdf.png") print("PDF Compressor is running...") What’s happening here?
    sys._MEIPASS → When the app is packaged with PyInstaller, assets are extracted to a temporary folder. This ensures they are accessible. Virtual environment path (/usr/share/pdf-compressor/venv) → If it exists, it is added to sys.path, so installed dependencies can be found. Assets paths → Dynamically assigned so they work in both script and standalone modes. After making these changes, my issue was mostly resolved.
    📋I know there are other ways to handle this, but since I'm still learning, this approach worked well for me. If I find a better solution in the future, I’ll definitely improve it!Step 3: Compiling python script into executable binary
    Now comes the exciting part, turning the Python script into a standalone executable. Navigate to the root directory where the main Python script is located. Then run:
    pyinstaller --name=pdf-compressor --onefile --windowed --add-data "assets:assets" pdf-compressor.py --onefile: Packages everything into a single executable file --windowed: Hides the terminal (useful for GUI apps) --name=compress-pdf: Sets the output filename --add-data "assets:assets" → Ensures images/icons are included. After this, PyInstaller will create a dist/ , inside, you'll find compress-pdf . This is the standalone app!
    Try running it:
    ./dist/pdf-compressor If everything works as expected, you’re ready to package it into a .deb file.
    Step 4: Move the executable to the correct location
    Now, move the standalone executable into the bin directory:
    mv dist/compress-pdf pdf-compressor/usr/bin/pdf-compressor Step 5: Add an application icon
    I don't know about you but to me, an app without an icon or just generic gear icons feels incomplete. Icon gives the vibe to your app.
    Let’s place the assets directory which contains the icon and logo files inside the right directory:
    cp assets/ pdf-compressor/usr/share/pdf-compressorStep 6: Create a desktop file
    To make the app appear in the system menu, we need a .desktop file. Open a new file:
    nano pdf-compressor/usr/share/applications/pdf-compressor.desktopPaste this content:
    [Desktop Entry] Name=PDF Compressor Comment=Compress PDF files easily Exec=/usr/bin/pdf-compressor Icon=/usr/share/icons/pdf-compressor.png Terminal=false Type=Application Categories=UtilityExec → Path to the executable. Icon → App icon location. Terminal=false → Ensures it runs as a GUI application. Save and exit (CTRL+X, then Y, then Enter).
    Step 7: Create the control file
    At the heart of every .deb package is a metadata file called control.
    This file is what tells the Debian package manager (dpkg) what the package is, who maintains it, what dependencies it has, and a brief description of what it does.
    That’s why defining them here ensures a smooth experience for users.
    Inside the DEBIAN/ directory, create a control file:
    nano pdf-compressor/DEBIAN/controlthen I added the following content in it:
    Package: pdf-compressor Version: 1.0 Section: utility Priority: optional Architecture: amd64 Depends: python3, ghostscript Recommends: python3-pip, python3-venv Maintainer: Your Name <your@email.com> Description: A simple PDF compression tool. Compress PDF files easily using Ghostscript.Step 8: Create the postinst script
    The post-installation (postinst) script as the name suggests is executed after the package is installed. It ensures all dependencies are correctly set up.
    nano pdf-compressor/DEBIAN/postinstAdd this content:
    #!/bin/bash set -e # Exit if any command fails echo "Setting up PDF Compressor..." chmod +x /usr/bin/pdf-compressor # Install dependencies inside a virtual environment python3 -m venv /usr/share/pdf-compressor/venv source /usr/share/pdf-compressor/venv/bin/activate pip install --no-cache-dir pyqt6 humanize echo "Installation complete!" update-desktop-database What’s happening here?
    set -e → Ensures the script stops on failure. Creates a virtual environment → This allows dependencies to be installed in an isolated way. chmod +x /usr/bin/pdf-compressor → Ensures the binary is executable. update-desktop-database → Updates the system’s application database. Setting up the correct permission for postinst is important:
    chmod 755 pdf-compressor/DEBIAN/postinstStep 9: Build & Install the deb package
    After all the hard work, it's finally time to bring everything together. To build the package, we’ll use dpkg-deb --build, a built-in Debian packaging tool.
    This command takes our structured pdf-compressor directory and turns it into a .deb package that can be installed on any Debian-based system.
    dpkg-deb --build pdf-compressorIf everything goes well, you should see output like:
    dpkg-deb: building package 'pdf-compressor' in 'pdf-compressor.deb'.Now, let’s install it and see our application in action!
    sudo dpkg -i pdf-compressor.deb💡If installation fails due to missing dependencies, fix them using: sudo apt install -fThis installs pdf-compressor onto your system just like any other Debian package. To verify, you can either launch it from the Applications menu or directly via terminal:
    pdf-compressorPDF Compressor v2.0 running inside Lubuntu | P.S. I know the color scheme could have been better 😅Final thoughts
    Packaging a Python application isn’t as straightforward as I initially thought. During my research, I couldn't find any solid guide that walks you through the entire process from start to finish.
    So, I had to experiment, fail, and learn, and that’s exactly what I’ve shared in this guide. Looking back, I realize that a lot of what I struggled with could have been simplified had I known better. But that’s what learning is all about, right?
    I believe that this write-up will serve as a good starting point for new Python developers like me who are still struggling to package their projects.
    That said, I know this isn’t the only way to package Python applications, there are probably better and more efficient approaches out there. So, I’d love to hear from you!
    Also, if you found this guide helpful, be sure to check out our PDF Compressor project on GitHub. Your feedback, contributions, and suggestions are always welcome!
    Happy coding! 😊
  21. Styling Counters in CSS

    by: Juan Diego Rodríguez
    Mon, 17 Mar 2025 16:25:04 +0000

    Yes, you are reading that correctly: This is indeed a guide to styling counters with CSS. Some of you are cheering, “Finally!”, but I understand that the vast majority of you are thinking, “Um, it’s just styling lists.” If you are part of the second group, I get it. Before learning and writing more and more about counters, I thought the same thing. Now I am part of the first group, and by the end of this guide, I hope you join me there.
    There are many ways to create and style counters, which is why I wanted to write this guide and also how I plan to organize it: going from the most basic styling to the top-notch level of customization, sprinkling in between some sections about spacing and accessibility. It isn’t necessary to read the guide in order — each section should stand by itself, so feel free to jump to any part and start reading.
    Table of Contents
    HTML Based Customization Styling Simple Counters in CSS Custom Counters Custom Counters Styles Images in Counters Spacing Things out Accessibility Almanac references Further reading Customizing Counters in HTML
    Lists elements were among the first 18 tags that made up HTML. Their representation wasn’t defined yet but deemed fitting a bulleted list for unordered lists, and a sequence of numbered paragraphs for an ordered list.
    Cool but not enough; soon people needed more from HTML alone and new list attributes were added throughout the years to fill in the gaps.
    start
    The start attribute takes an integer and sets from where the list should start:
    <ol start="2"> <li>Bread</li> <li>Milk</li> <li>Butter</li> <li>Apples</li> </ol> Bread Milk Butter Apples Although, it isn’t limited to positive values; zero and negative integers are allowed as well:
    <ol start="0"> <li>Bread</li> <li>Milk</li> <li>Butter</li> <li>Apples</li> </ol> <ol start="-2"> <li>Bread</li> <li>Milk</li> <li>Butter</li> <li>Apples</li> </ol> Bread Milk Butter Apples Bread Milk Butter Apples type
    We can use the type attribute to change the counter’s representation. It’s similar to CSS’s list-style-type, but it has its own limited uses and shouldn’t be used interchangeably*. Its possible values are:
    1 for decimal numbers (default) a for lowercase alphabetic A for uppercase alphabetic i for lowercase Roman numbers I for uppercase Roman numbers <ol type="a"> <li>Bread</li> <li>Milk</li> <li>Butter</li> <li>Apples</li> </ol> <ol type="i"> <li>Bread</li> <li>Milk</li> <li>Butter</li> <li>Apples</li> </ol> Bread Milk Butter Apples Bread Milk Butter Apples It’s weird enough to use type on ol elements, but it still has some use cases*. However, usage with the ul element is downright deprecated.
    value
    The value attribute sets the value for a specific li element. This also affects the values of the li elements after it.
    <ol> <li>Bread</li> <li value="4">Milk</li> <li>Butter</li> <li>Apples</li> </ol> Bread Milk Butter Apples reversed
    The reversed attribute will start counting elements in reverse order, so from highest to lowest.
    <ol reversed> <li>Bread</li> <li>Milk</li> <li>Butter</li> <li>Apples</li> </ol> Bread Milk Butter Apples All can be combined
    If you ever feel the need, all list attributes can be combined in one (ordered) list.
    <ol reversed start="2" type="i"> <li>Bread</li> <li value="4">Milk</li> <li>Butter</li> <li>Apples</li> </ol> Bread Milk Butter Apples * Do we need them if we now have CSS?
    Funny enough, the first CSS specification already included list-style-type and other properties to style lists, and it was released before HTML 3.2 — the first HTML spec that included some of the previous list attributes. This means that at least on paper, we had CSS list styling before HTML list attributes, so the answer isn’t as simple as “they were there before CSS.”
    Without CSS, a static page (such as this guide) won’t be pretty, but at the very least, it should be readable. For example, the type attribute ensures that styled ordered lists won’t lose their meaning if CSS is missing, which is especially useful in legal or technical documents. Some attributes wouldn’t have a CSS equivalent until years later, including reversed, start and value.
    Styling Simple Counters in CSS
    For most use cases, styling lists in CSS doesn’t take more than a couple of rules, but even in that brevity, we can find different ways to style the same list.
    ::marker or ::before?
    The ::marker pseudo-element represents the counter part of a list item. As a pseudo-element, we can set its content property to any string to change its counter representation:
    li::marker { content: "💜 "; } Bread Milk Butter Apples The content in pseudo-elements also accepts images, which allows us to create custom markers:
    li::marker { content: url("./logo.svg") " "; } bread milk butter apples By default, only li elements have a ::marker but we can give it to any element by setting its display property to list-item:
    h4 { display: list-item; } h4::marker { content: "◦ "; } This will give each h4 a ::marker which we can change to any string:
    List Title
    However, ::marker is an odd case: it was described in the CSS spec more than 20 years ago, but only gained somewhat reliable support in 2020 and still isn’t fully supported in Safari. What’s worst, only font-related properties (such as font-size or color) are allowed, so we can’t change its margin or background-color.
    This has led many to use ::before instead of ::marker, so you’ll see a lot of CSS in which the author got rid of the ::marker using list-style-type: none and used ::before instead:
    li { /* removes ::marker */ list-style-type: none; } li::before { /* mimics ::marker */ content: "▸ "; } list-style-type
    The list-style-type property can be used to replace the ::marker‘s string. Unlike ::marker, list-style-type has been around forever and is most people’s go-to option for styling lists. It can take a lot of different counter styles that are built-in in browsers, but you will probably use one of the following:
    For unordered lists:
    disc circle square ul { list-style-type: square; } ul { list-style-type: circle; } bread milk butter apples For ordered lists:
    decimal decimal-leading-zero lower-roman upper-roman lower-alpha upper-alpha ol { list-style-type: upper-roman; } ol { list-style-type: lower-alpha; } bread milk butter apples You can find a full list of valid counter styles here.
    It can also take none to remove the marker altogether, and since not long ago, it can also take a <string> for ul elements.
    ul { list-style-type: none; } ul { list-style-type: "➡️ "; } Creating Custom Counters
    For a long time, there wasn’t a CSS-equivalent to the HTML reverse, start or value attributes. So if we wanted to reverse or change the start of multiple lists, instead of a CSS class to rule them all, we had to change their HTML one by one. You can imagine how repetitive that would get.
    Besides, list attributes simply had their limitations: we can’t change how they increment with each item and there isn’t an easy way to attach a prefix or suffix to the counter. And maybe the biggest reason of all is that there wasn’t a way to number things that weren’t lists!
    Custom counters let us number any collection of elements with a whole new level of customization. The workflow is to:
    Initiate the counter with the counter-reset property. Increment the counter with the counter-increment property. Individually set the counters with the counter-set property. Output the counters with either the counter() and counters() functions. As I mentioned, we can make a list out of any collection of elements, and while this has its accessibility concerns, just for demonstration’s sake, let’s try to turn a collection of headings like this…
    <div class="index"> <h2>The Old Buccaneer</h2> <h2>The Sea Cook</h2> <h2>My Shore Adventure</h2> <h2>The Log Cabin</h2> <h2>My Sea Adventure</h2> <h2>Captain Silver</h2> </div> …into something that looks list-like. But just because we can make an element look like a list doesn’t always mean we should do it. Be sure to consider how the list will be announced by assistive technologies, like screen readers, and see the Accessibility section for more information.
    Initiate counters: counter-reset
    The counter-reset property takes two things: the name of the counter as a custom ident and the initial count as an integer. If the initial count isn’t given, then it will start at 0 by default:
    .index { counter-reset: index; /* The same as */ counter-reset: index 0; } You can initiate several counters at once with a space-separated list and set a specific value for each one:
    .index { counter-reset: index another-counter 2; } This will start our index counter at 0 (the default) and another-counter at 2.
    Set counters: counter-set
    The counter-set works similar to counter-reset: it takes the counter’s name followed by an integer, but this time it will set the count for that element onwards. If the integer is omitted, it will set the counter to 0 by default.
    h2:nth-child(2) { counter-set: index; /* same as */ counter-set: index 0; } And we can set several counters at once, as well:
    h2:nth-child(3) { counter-set: index 5 another-counter 10; } This will set the third h2 element’s index count to 5 and another-counter to 10.
    If there isn’t an active counter with that name, counter-set will initiate it at 0.
    Increment counters: counter-increment
    Right now, we have our counter, but it will stagnate at 0 since we haven’t set which elements should increment it. We can use the counter-increment property for that, which takes the name of the counter and how much it should be incremented by. If we only write the counter’s name, it will increment it by 1.
    In this case, we want each h2 title to increment the counter by one, and that should be as easy as setting counter-increment to the counter’s name:
    h2 { counter-increment: index; /* same as */ counter-increment: index 1; } Just like with counter-reset, we can increment several counters at once in a space-separated list:
    h2 { counter-increment: index another-counter 2; } This will increment index by one and another-counter by two on each h2 element.
    If there isn’t an active counter with that name, counter-increment will initiate it at 0.
    Output simple lists: counter()
    So far, we won’t see any change in the counter representation. The counters are counting but not showing, so to output the counter’s result we use the counter() and counters() functions. Yes, those are two functions with similar names but important differences.
    The counter() function takes the name of a counter and outputs its content as a string. If many active counters have the same name, it will select the one that is defined closest to the element, so we can only output one counter at a time.
    As mentioned earlier, we can set an element’s display to list-item to work with its ::marker pseudo-element:
    h2 { display: list-item; } Then, we can use counter() in its content property to output the current count. This allows us to prefix and suffix the counter by writing a string before or after the counter() function:
    h2::marker { content: "Part " counter(index) ": "; } Alternatively, we can use the everyday ::before pseudo-element to the same effect:
    h2::before { content: "Part " counter(index) ": "; } Output nested lists: counters()
    counter() works great for most situations, but what if we wanted to do a nested list like this:
    1. Paradise Beaches 1.1. Hawaiian Islands 1.2. Caribbean Getaway 1.2.1. Aruba 1.2.2. Barbados 2. Outdoor Escapades 2.1 National Park Hike 2.2. Mountain Skiing Trip We would need to initiate individual counters and write different counter() functions for each level of nesting, and that’s only possible if we know how deep the nesting goes, which we simply don’t at times.
    In this case, we use the counters() function, which also takes the name of a counter as an argument but instead of just outputting its content, it will join all active counters with that name into a single string and output it. To do so, it takes a string as a second argument, usually something like a dot (".") or dash ("-") that will be used between counters to join them.
    We can use counter-reset and counter-increment to initiate a counter for each ol element, while each li will increment its closest counter by 1:
    ol { counter-reset: item; } li { counter-increment: item; } But this time, instead of using counter() (which would only display one counter per item), we will use counters() to join all active counters by a string (e.g. ".“) and output them at once:
    li::marker { content: counters(item, ".") ". "; } Styling Counters
    Both the counter() and counters() functions accept one additional, yet optional, last argument representing the counter style, the same ones we use in the list-style-type property. So in our last two examples, we could change the counter styles to Roman numbers and alphabetic letters, respectively:
    h2::marker { content: "Part " counter(index, upper-roman) ": "; } li::marker { content: counters(item, ".", lower-alpha) ". "; } Reverse Counters
    It’s possible to count backward using custom counters, but we need to know beforehand the number of elements we’ll count. So for example, if we want to make a Top Five list in reversed order:
    <h1>Best rated animation movies</h1> <ol> <li>Toy Story 2</li> <li>Toy Story 1</li> <li>Finding Nemo</li> <li>How to Train your Dragon</li> <li>Inside Out</li> </ol> We have to initiate our counter at the total number of elements plus one (so it doesn’t end at 0):
    ol { counter-reset: movies 6; } And then set the increment to a negative integer:
    li { counter-increment: movies -1; } To output the count we use counter() as we did before:
    li::marker { content: counter(movies) ". "; } There is also a way to write reversed counters supported in Firefox, but it hasn’t shipped to any other browser. Using the reversed() functional notation, we can wrap the counter name while initiating it to say it should be reversed.
    ol { counter-reset: reversed(movies); } li { counter-increment: movies; } li::marker { content: counter(movies) " ."; } Styling Custom Counters
    The last section was all about custom counters: we changed from where they started and how they increased, but at the end of the day, their output was styled in one of the browser’s built-in counter styles, usually decimal. Now using @counter-style, we’ll build our own counter styles to style any list.
    The @counter-style at-rule, as its name implies, lets you create custom counter styles. After writing the at-rule it takes a custom ident as a name:
    @counter-style my-counter-style { /* etc. */ } That name can be used inside the properties and functions that take a counter style, such as list-style-type or the last argument in counter() and counters():
    ul { list-style-type: my-counter-style; } li::marker { content: counter(my-counter, my-counter-style) ". "; } What do we write inside @counter-style? Descriptors! How many descriptors? Honestly, a lot. Just look at this quick review of all of them:
    system: specifies which algorithm will be used to construct the counter’s string representation. (Obligatory) negative: specifies the counter representation if the counter value is negative. (Optional) prefix: specifies a character that will be attached before the marker representation and any negative sign. (Optional) suffix: specifies a character that will be attached after the marker representation and any negative sign. (Optional) range: specifies the range in which the custom counter is used. Counter values outside the range will drop to their fallback counter style. (Optional) pad: specifies a minimum width all representations have to reach. Representations shorter than the minimum are padded with a character. (Optional) fallback: specifies a fallback counter used whenever a counter style can’t represent a counter value. (Optional) symbols: specifies the symbols used by the construction system algorithm. It’s obligatory unless the system is set to additive or extends. additive-symbols: specifies the symbols used by the construction algorithm when the system descriptor is set to additive. speak-as: specifies how screen readers should read the counter style. (Optional) However, I’ll focus on the required descriptors first: system, symbols and additive-symbols.
    The system descriptor
    The symbols or additive-symbols descriptors define the characters used for the counter style, while system says how to use them.
    The valid system values are:
    cyclic alphabetic symbolic additive fixed extends cyclic will go through the characters set on symbols and repeat them. We can use just one character in the symbols to mimic a bullet list:
    @counter-style cyclic-example { system: cyclic; symbols: "⏵"; suffix: " "; } bread butter milk apples Or alternate between two or more characters:
    @counter-style cyclic-example { system: cyclic; symbols: "🔸" "🔹"; suffix: " "; } fixed will write the characters in symbols descriptor just one time. In the last example, only the first two items will have a custom counter if set to fixed, while the others will drop to their fallback, which is decimal by default.
    @counter-style multiple-example { system: fixed; symbols: "🔸" "🔹"; suffix: " "; } We can set when the custom counters start by appending an <integer> to the fixed value. For example, the following custom counter will start at the fourth item:
    @counter-style fixed-example { system: fixed 4; symbols: "💠"; suffix: " "; } numeric will numerate list items using a custom positional system (base-2, base-8, base-16, etc.). Positional systems start at 0, so the first character at symbols will be used as 0, the next as 1, and so on. Knowing this, we can make an ordered list using non-decimal numerical systems like hexadecimal:
    @counter-style numeric-example { system: numeric; symbols: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"; suffix: ". "; } bread butter milk apples alphabetic will enumerate the list items using a custom alphabetical system. It’s similar to the numeric system but with the key difference that it doesn’t have a character for 0, so the next digits are just repeated. For example, if our symbols are "A" "B" "C" they will wrap to "AA", "AB", "AC", then BA, BB, BC and so on.
    Since there is no equivalent for 0 and negative values, they will drop down to their fallback.
    @counter-style alphabetic-example { system: alphabetic; symbols: "A" "B" "C"; suffix: ". "; } bread butter milk apples cinnamon symbolic will go through the characters in symbols repeating them one more time each iteration. So for example, if our symbols are "A", "B", "C", it will go “A”, “B”, and “C”, double them in the next iteration as “AA”, “BB”, and “CC”, then triple them as “AAA”, “BBB”, “CCC” and so on.
    Since there is no equivalent for 0 and negative values, they will drop down to their fallback.
    @counter-style symbolic-example { system: symbolic; symbols: "A" "B" "C"; suffix: ". "; } bread butter milk apples cinnamon additive will give characters a numerical value and add them together to get the counter representation. You can think of it as the way we usually count bills: if we have only $5, $2, and $1 bills, we will add them together to get the desired quantity, trying to keep the number of bills used at a minimum. So to represent 10, we will use two $5 bills instead of ten $1 bills.
    Since there is no equivalent for negative values, they will drop down to their fallback.
    @counter-style additive -example { system: additive; additive-symbols: 5 "5️⃣", 2 "2️⃣", 1 "1️⃣"; suffix: " "; } Notice how we use additive-symbols when the system is additive, while we use just symbols for the previous systems.
    extends will create a custom style from another one but with modifications. To do so, it takes a <counter-style-name> after the extends value. For example, we could change the decimal counter style default’s suffix to a closing parenthesis (")")`:
    @counter-style extends-example { system: extends decimal; suffix: ") "; } bread butter milk cinnamon Per spec, “If a @counter-style uses the extends system, it must not contain a symbols or additive-symbols descriptor, or else the @counter-style rule is invalid.”
    The other descriptors
    The negative descriptor allows us to create a custom representation for a list’s negative values. It can take one or two characters: The first one is prepended to the counter, and by default it’s the hyphen-minus ("-"). The second one is appended to the symbol. For example, we could enclose negative representations into parenthesis (2), (1), 0, 1, 2:
    @counter-style negative-example { system: extends decimal; negative: "(" ")"; } bread butter milk apples The prefix and suffix descriptors allow us to prepend and append, respectively, a character to the counter representation. We can use it to add a character at the beginning of each counter using prefix:
    @counter-style prefix-suffix-example { system: extends decimal; prefix: "("; suffix: ") "; } bread butter milk apples The range descriptor defines an inclusive range in which the counter style is used. We can define a bounded range by writing one <integer> next to another. For example, a range of 2 4 will affect elements 2, 3, and 4:
    @counter-style range-example { system: cyclic; symbols: "‣"; suffix: " "; range: 2 4; } bread butter milk apples cinnamon On the other hand, using the infinite value we can unbound the range to one side. For example, we could write infinite 3 so all items up to 3 have a counter style:
    @counter-style range-example { system: alphabetic; symbols: "A" "B" "C"; suffix: ". "; range: infinite 3; } bread butter milk apples cinnamon The pad descriptor takes an <integer> that represents the minimum width for the counter and a character to pad it. For example, a zero-padded counter style would look like the following:
    @counter-style pad-example { system: extends decimal; pad: 3 "0"; } bread butter milk apples The fallback descriptor allows you to define which counter style should be used as a fallback whenever we can’t represent a specific count. For example, the following counter style is fixed and will fallback to lower-roman after the sixth item:
    @counter-style fallback-example { system: fixed; symbols: "⚀" "⚁" "⚂" "⚃"; fallback: lower-roman; } bread butter milk apples cinnamon Lastly, the speak-as descriptor hints to speech readers on how the counter style should be read. It can be:
    auto Uses the system default. bullets reads an unordered list. By default, cyclic systems are read as bullets numbers reads the counter’s numeric value in the content language. By default, additive, fixed, numeric, and, symbolic are read as numbers. words reads the counter representation as words. spell-out reads the counter representation letter by letter. By default, alphabetic is read as spell-out. <counter-style-name> It will use that counter’s speak-as value. @counter-style speak-as-example { system: extends decimal; prefix: "Item "; suffix: " is "; speak-as: words; } symbols()
    The symbols() function defines an only-use counter style without the need to do a whole @counter-style, but at the cost of missing some features. It can be used inside the list-style-type property and the counter() and counters() functions.
    ol { list-style-type: symbols(cyclic "🥬"); } However, its browser support is appalling since it’s only supported in Firefox.
    Images in Counters
    In theory, there are four ways to add images to lists:
    list-style-image property content property symbols descriptor in @counter-style symbols() function. In practice, the only supported ways are using list-style-image and content, since support for images in @counter-style and support in general for symbols() isn’t the best (it’s pretty bad).
    list-style-image
    The list-style-image can take an image or a gradient. In this case, we want to focus on images but gradients can also be used to create custom square bullets:
    li { list-style-image: conic-gradient(red, yellow, lime, aqua, blue, magenta, red); } bread butter milk apples Sadly, changing the shape would require styling more the ::marker and this isn’t currently possible.
    To use an image, we pass its url(), make sure is small enough to work as a counter:
    li { list-style-image: url("./logo.svg"); } bread milk butter apples content
    The content property works similar to list-style-image: we pass the image’s url() and provide a little padding on the left as an empty string:
    li::marker { content: url("./logo.svg") " "; } Spacing Things Out
    You may notice in the last part how the image — depending on its size — isn’t completely centered on the text, and also that we provide an empty string on content properties for spacing instead of giving things either a padding or margin. Well, there’s an explanation for all of this, as since spacing is one of the biggest pain points when it comes to styling lists.
    Margins and paddings are wacky
    Spacing the ::marker from the list item should be as easy as increasing the marker’s or list margin, but in reality, it takes a lot more work.
    First, the padding and margin properties aren’t allowed in ::marker. While lists have two types of elements: the list wrapper (usually ol or ul) and the list item (li), each with a default padding and margin. Which should we use?
    You can test each property in this demo by Šime Vidas in his article dedicated to the gap after the list marker:
    CodePen Embed Fallback You’ll notice how the only property that affects the spacing within ::marker and the text is the li item’s padding property, while the rest of the spacing properties will move the entire list item. Another thing to note is even when the padding is set to 0px, there is a space after the ::marker. This is set by browsers and will vary depending on which browser you’re using.
    list-style-position
    One last thing you may notice in the demo is a checkbox for the list-style-position property, and how once you set it to inside, the ::marker will move to the inside of the box, at the cost of removing any spacing given by the list item’s padding.
    By default, markers are rendered outside the ul element’s box. A lot of times, this isn’t the best behavior: markers sneak out of elements, text-align won’t align the marker, and paradoxically, centered lists with flex or grid won’t look completely centered since the markers are outside the box.
    To change this we can use the list-style-position property, it can be either outside (default) and inside to define where to position the list marker: either outside or the outside of the ul box.
    ul { border: solid 2px red; } .inside { list-style-position: inside; } .outside { list-style-position: outside; } bread butter milk apple content with empty strings
    In the same article, Šime says:
    And I completely agree that’s true, but just using ::marker there isn’t a correct way to add spacing between the ::marker and the list text, especially since most people prefer to set list-style-position to inside. So, as much as it pains me to say it, the simplest way to increase the gap after the marker is to suffix the content property with an empty string:
    li::marker { content: "• "; } bread milk butter apples BUT! This is only if we want to be purists and stick with the ::marker pseudo-element because, in reality, there is a much better way to position that marker: not using it at all.
    Just use ::before
    There is a reason people love using the ::before more than ::marker. First, we can’t use something like CSS Grid or Flexbox since changing the display of li to something other than list-item will remove the ::marker, and we can set the ::marker‘s height or width properties to better align it.
    Let’s be real, ::marker works fine when we just want simple styling. But we are not here for simple styling! Once we want something more involved, ::marker will fall short and we’ll have to use the ::before pseudo-element.
    Using ::before means we can use Flexbox, which allows for two things we couldn’t do before:
    Vertically center the marker with the text Easily increase the gap after the marker Both can be achieved with Flexbox:
    li { display: flex; align-items: center; /* Vertically center the marker */ gap: 20px; /* Increases the gap */ list-style-type: none; } The original ::marker is removed by changing the display.
    Accesibility
    In a previous section we turned things that weren’t lists into seemingly looking lists, so the question arises: should we actually do that? Doesn’t it hurt accessibility to make something look like a list when it isn’t one? As always, it depends. For a visual user, all the examples in this entry look all right, but for assistive technology users, some examples lack the necessary markup for accessible navigation.
    Take for example our initial demo. Here, listing titles serves as decoration since the markup structure is given by the titles themselves. It’s the same deal for the counting siblings demo from earlier, as assistive technology users can read the document through the title structure.
    However, this is the exception rather than the norm. That means a couple of the examples we looked at would fail if we need the list to be announced as a list in assistive technology, like screen readers. For example this list we looked at earlier:
    <div class="index"> <h2>The Old Buccaneer</h2> <h2>The Sea Cook</h2> <h2>My Shore Adventure</h2> <h2>The Log Cabin</h2> <h2>My Sea Adventure</h2> <h2>Captain Silver</h2> </div> …should be written as a list instead:
    <ul class="index"> <li>The Old Buccaneer</li> <li>The Sea Cook</li> <li>My Shore Adventure</li> <li>The Log Cabin</li> <li>My Sea Adventure</li> <li>Captain Silver</li> </ul> Listing elements is rarely used just as decoration, so as a rule of thumb, use lists in the markup even if you are planning to change them with CSS.
    Almanac References
    List Properties
    Almanac on Apr 23, 2021 list-style
    ul { list-style: square outside none; } counters lists Sara Cope Counters
    Almanac on Feb 4, 2025 counter-reset
    article { counter-reset: section; } counters lists Sara Cope Almanac on Jan 14, 2025 counter-increment
    .step { counter-increment: my-awesome-counter; } counters lists Sara Cope Almanac on Apr 23, 2021 counter-set
    h2:first-of-type::before { counter-set: chapter; } counters lists Geoff Graham Almanac on Feb 4, 2025 counter()
    h2::before { content: counter(my-counter, upper-roman) ". "; } counters lists Juan Diego Rodríguez Almanac on Feb 4, 2025 counters()
    li::marker { content: counters(item, ".") ") "; } counters lists Juan Diego Rodríguez Custom Counter Styles
    Almanac on Jan 28, 2025 @counter-style
    @counter-style apple-counter { ... } counters lists Juan Diego Rodríguez Almanac on Jan 30, 2025 symbols()
    ul { list-style: symbols(cyclic "🥬"); } counters lists Juan Diego Rodríguez Pseudo-Elements
    Almanac on Jan 19, 2025 ::marker
    li::marker { color: red; } counters lists Geoff Graham Almanac on Sep 13, 2024 ::before / ::after
    .element::before { content: "Yo!"; } counters lists Sara Cope More Tutorials & Tricks!
    Article on May 5, 2020 List Style Recipes
    counters lists Chris Coyier Article on Apr 29, 2021 List Markers and String Styles
    counters lists Eric Meyer Article on May 19, 2018 Style List Markers in CSS
    counters lists Chris Coyier Article on Jun 11, 2020 How to Reverse CSS Custom Counters
    counters lists Etinosa Obaseki Article on Jan 23, 2025 Some Things You Might Not Know About Custom Counter Styles
    counters lists Geoff Graham Article on Jan 26, 2022 Using CSS Counters for Custom List Number Styling
    counters lists Chris Coyier Article on May 17, 2024 Everything You Need to Know About the Gap After the List Marker
    counters lists Šime Vidas Styling Counters in CSS originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.
  22. by: Chris Coyier
    Mon, 17 Mar 2025 15:57:00 +0000

    How CSS relates to web performance is a funny dance. Some aspects are entirely negligible the vast majority of time. Some aspects are incredibly impactful and crucial to consider.
    For example, whenever I see research into the performance of some form of CSS syntax, the results always seem to be meh, it’s fine. It can matter, but typically only with fairly extreme DOM weight situations, and spending time optimizing selectors is almost certainly wasted time. I do like that the browser powers that be think and care about this though, like Bramus here measuring the performance of @property for CSS Custom Property performance. In the end, it doesn’t matter much, which is an answer I hope they knew before it shipped everywhere (they almost certainly did). Issues with CSS syntax tend to be about confusion or error-prone situations, not speed.
    But even though the syntax of CSS isn’t particularly worrisome for performance, the weight of it generally does matter. It’s important to remember that CSS that is a regular <link> in the <head> is render blocking, so until it’s downloaded and parsed, the website will not be displayed. Ship, say, 1.5MB of CSS, and the site’s performance will absolutely suffer for absolutely everyone. JavaScript is a worse offender on the web when it comes to size and resources, generally, but at least it’s loading is generally deferred.
    The idea of “Critical CSS” became hot for a minute, meaning ship as little render blocking CSS as you can, and defer the rest, but that idea has it’s own big tradeoffs. Related to that, it absolutely should be easier to make CSS async, so let’s all vote for that. And while I’m linking to Harry, his The Three Cs: 🤝 Concatenate, 🗜️ Compress, 🗳️ Cache is a good one for your brain.
    The times when CSS performance tends to rear it’s head are in extreme DOM weight situations. Like a web page that renders all of Moby Dick, or every single Unicode character, or 10,000 product images, or a million screenshots, or whatever. That way a box-shadow just has a crazy amount of work to do. But even then, while CSS can be the cause of pain, it can be the solution as well. The content-visibility property in CSS can inform the browser to chill out on rendering more than it needs to up front. It’s not the more intuitive feature to use, but it’s nice we have these tools when we need them.
  23. by: Abhishek Kumar
    Mon, 17 Mar 2025 15:44:13 GMT

    Ollama is one of the easiest ways for running large language models (LLMs) locally on your own machine.
    It's like Docker. You download publicly available models from Hugging Face using its command line interface. Connect Ollama with a graphical interface and you have a chatGPT alternative local AI tool.
    In this guide, I'll walk you through some essential Ollama commands, explaining what they do and share some tricks at the end to enhance your experience.
    💡If you're new to Ollama or just getting started, we've already covered a detailed Ollama installation guide for Linux to help you set it up effortlessly.Checking available commands
    Before we dive into specific commands, let's start with the basics. To see all available Ollama commands, run:
    ollama --helpThis will list all the possible commands along with a brief description of what they do. If you want details about a specific command, you can use:
    ollama <command> --helpFor example, ollama run --help will show all available options for running models.
    Here's a glimpse of essential Ollama commands, which we’ve covered in more detail further in the article.
    Command Description ollama create Creates a custom model from a Modelfile, allowing you to fine-tune or modify existing models. ollama run <model> Runs a specified model to process input text, generate responses, or perform various AI tasks. ollama pull <model> Downloads a model from Ollama’s library to use it locally. ollama list Displays all installed models on your system. ollama rm <model> Removes a specific model from your system to free up space. ollama serve Runs an Ollama model as a local API endpoint, useful for integrating with other applications. ollama ps Shows currently running Ollama processes, useful for debugging and monitoring active sessions. ollama stop <model> Stops a running Ollama process using its process ID or name. ollama show <model> Displays metadata and details about a specific model, including its parameters. ollama run <model> "with input" Executes a model with specific text input, such as generating content or extracting information. ollama run <model> < "with file input" Processes a file (text, code, or image) using an AI model to extract insights or perform analysis. 1. Downloading an LLM
    If you want to manually download a model from the Ollama library without running it immediately, use:
    ollama pull <model_name> For instance, to download Llama 3.2 (300M parameters):
    ollama pull phi:2.7b This will store the model locally, making it available for offline use.
    📋There are no ways of fetching available model names from Hugging Face. You have to visit Ollama website and get the available model names to use with the pull command.2. Running an LLM
    To begin chatting with a model, use:
    ollama run <model_name>For example, to run a small model like Phi2:
    ollama run phi:2.7bIf you don’t have the model downloaded, Ollama will fetch it automatically. Once it's running, you can start chatting with it directly in the terminal.
    Some useful tricks while interacting with a running model:
    Type /set parameter num_ctx 8192 to adjust the context window. Use /show info to display model details. Exit by typing /bye. 3. Listing installed LLMs
    If you’ve downloaded multiple models, you might want to see which ones are available locally. You can do this with:
    ollama listThis will output something like:
    This command is great for checking which models are installed before running them.
    4. Checking running LLMs
    If you're running multiple models and want to see which ones are active, use:
    ollama psYou'll see an output like:
    To stop a running model, you can simply exit its session or restart the Ollama server.
    5. Starting the ollama server
    The ollama serve command starts a local server to manage and run LLMs.
    This is necessary if you want to interact with models through an API instead of just using the command line.
    ollama serve By default, the server runs on http://localhost:11434/, and if you visit this address in your browser, you'll see "Ollama is running."
    You can configure the server with environment variables, such as:
    OLLAMA_DEBUG=1 → Enables debug mode for troubleshooting. OLLAMA_HOST=0.0.0.0:11434 → Binds the server to a different address/port. 6. Updating existing LLMs
    There is no ollama command for updating existing LLMs. You can run the pull command periodically to update an installed model:
    ollama pull <model_name>If you want to update all the models, you can combine the commands in this way:
    ollama list | tail -n +2 | awk '{print $1}' | xargs -I {} ollama pull {}That's the magic of AWK scripting tool and the power of xargs command.
    Here's how the command works (if you don't want to ask your local AI).
    Ollama lists all the models and you take the ouput starting at line 2 as line 1 doesn't have model names. And then AWK command gives the first column that has the model name. Now this is passed to xargs command that puts the model name in {} placeholder and thus ollama pull {} runs as ollama pull model_name for each installed model.
    7. Custom model configuration
    One of the coolest features of Ollama is the ability to create custom model configurations.
    For example, let’s say you want to tweak smollm2 to have a longer context window.
    First, create a file named Modelfile in your working directory with the following content:
    FROM llama3.2:3b PARAMETER temperature 0.5 PARAMETER top_p 0.9 SYSTEM You are a senior web developer specializing in JavaScript, front-end frameworks (React, Vue), and back-end technologies (Node.js, Express). Provide well-structured, optimized code with clear explanations and best practices. Now, use Ollama to create a new model from the Modelfile:
    ollama create js-web-dev -f Modelfile Once the model is created, you can run it interactively:
    ollama run js-web-dev "Write a well-optimized JavaScript function to fetch data from an API and handle errors properly." If you want to tweak the model further:
    Adjust temperature for more randomness (0.7) or strict accuracy (0.3). Modify top_p to control diversity (0.8 for stricter responses). Add more specific system instructions, like "Focus on React performance optimization." Some other tricks to enhance your experience
    Ollama isn't just a tool for running language models locally, it can be a powerful AI assistant inside a terminal for a variety of tasks.
    Like, I personally use Ollama to extract info from a document, analyze images and even help with coding without leaving the terminal.
    💡Running Ollama for image processing, document analysis, or code generation without a GPU can be excruciatingly slow.Summarizing documents
    Ollama can quickly extract key points from long documents, research papers, and reports, saving you from hours of manual reading.
    That said, I personally don’t use it much for PDFs. The results can be janky, especially if the document has complex formatting or scanned text.
    If you’re dealing with structured text files, though, it works fairly well.
    ollama run phi "Summarize this document in 100 words." < french_revolution.txt Image analysis
    Though Ollama primarily works with text, some vision models (like llava or even deepseek-r1) are beginning to support multimodal processing, meaning they can analyze and describe images.
    This is particularly useful in fields like computer vision, accessibility, and content moderation.
    ollama run llava:7b "Describe the content of this image." < cat.jpg Code generation and assistance
    Debugging a complex codebase? Need to understand a piece of unfamiliar code?
    Instead of spending hours deciphering it, let Ollama have a look at it. 😉
    ollama run phi "Explain this algorithm step-by-step." < algorithm.py Additional resources
    If you want to dive deeper into Ollama or are looking to integrate it into your own projects, I highly recommend checking out freeCodeCamp’s YouTube video on the topic.
    It provides a clear, hands-on introduction to working with Ollama and its API.
    Conclusion
    Ollama makes it possible to harness AI on your own hardware. While it may seem overwhelming at first, once you get the hang of the basic commands and parameters, it becomes an incredibly useful addition to any developer's toolkit.
    That said, I might not have covered every single command or trick in this guide, I’m still learning myself!
    If you have any tips, lesser-known commands, or cool use cases up your sleeve, feel free to share them in the comments.
    I feel that this should be enough to get you started with Ollama, it’s not rocket science. My advice? Just fiddle around with it.
    Try different commands, tweak the parameters, and experiment with its capabilities. That’s how I learned, and honestly, that’s the best way to get comfortable with any new tool.
    Happy experimenting! 🤖
  24. Web Components Demystified

    by: Geoff Graham
    Fri, 14 Mar 2025 12:51:59 +0000

    Scott Jehl released a course called Web Components Demystified. I love that name because it says what the course is about right on the tin: you’re going to learn about web components and clear up any confusion you may already have about them.
    And there’s plenty of confusion to go around! “Components” is already a loaded term that’s come to mean everything from a piece of UI, like a search component, to an element you can drop in and reuse anywhere, such as a React component. The web is chock-full of components, tell you what.
    But what we’re talking about here is a set of standards where HTML, CSS, and JavaScript rally together so that we can create custom elements that behave exactly how we want them to. It’s how we can make an element called <tasty-pizza> and the browser knows what to do with it.
    This is my full set of notes from Scott’s course. I wouldn’t say they’re complete or even a direct one-to-one replacement for watching the course. You’ll still want to do that on your own, and I encourage you to because Scott is an excellent teacher who makes all of this stuff extremely accessible, even to noobs like me.
    Chapter 1: What Web Components Are… and Aren’t
    Web components are not built-in elements, even though that’s what they might look like at first glance. Rather, they are a set of technologies that allow us to instruct what the element is and how it behaves. Think of it the same way that “responsive web design” is not a thing but rather a set of strategies for adapting design to different web contexts. So, just as responsive web design is a set of ingredients — including media fluid grids, flexible images, and media queries — web components are a concoction involving:
    Custom elements These are HTML elements that are not built into the browser. We make them up. They include a letter and a dash.
    <my-fancy-heading> Hey, I'm Fancy </my-fancy-heading> We’ll go over these in greater detail in the next module.
    HTML templates Templates are bits of reusable markup that generate more markup. We can hide something until we make use of it.
    <template> <li class="user"> <h2 class="name"></h2> <p class="bio"></p> </li> </template> Much more on this in the third module.
    Shadow DOM The DOM is queryable.
    document.querySelector("h1"); // <h1>Hello, World</h1> The Shadow DOM is a fragment of the DOM where markup, scripts, and styles are encapsulated from other DOM elements. We’ll cover this in the fourth module, including how to <slot> content.
    There used to be a fourth “ingredient” called HTML Imports, but those have been nixed.
    In short, web components might be called “components” but they aren’t really components more than technologies. In React, components sort of work like partials. It defines a snippet of HTML that you drop into your code and it outputs in the DOM. Web Components are built off of HTML Elements. They are not replaced when rendered the way they are in JavaScript component frameworks. Web components are quite literally HTML elements and have to obey HTML rules. For example:
    <!-- Nope --> <ul> <my-list-item></my-list-item> <!-- etc. --> </ul> <!-- Yep --> <ul> <li> <my-list-item></my-list-item> </li> </ul> We’re generating meaningful HTML up-front rather than rendering it in the browser through the client after the fact. Provide the markup and enhance it! Web components have been around a while now, even if it seems we’re only starting to talk about them now.
    Chapter 2: Custom Elements
    First off, custom elements are not built-in HTML elements. We instruct what they are and how they behave. They are named with a dash and at must contain least one letter. All of the following are valid names for custom elements:
    <super-component> <a-> <a-4-> <card-10.0.1> <card-♠️> Just remember that there are some reserved names for MathML and SVG elements, like <font-face>. Also, they cannot be void elements, e.g. <my-element />, meaning they have to have a correspoonding closing tag.
    Since custom elements are not built-in elements, they are undefined by default — and being undefined can be a useful thing! That means we can use them as containers with default properties. For example, they are display: inline by default and inherit the current font-family, which can be useful to pass down to the contents. We can also use them as styling hooks since they can be selected in CSS. Or maybe they can be used for accessibility hints. The bottom line is that they do not require JavaScript in order to make them immediately useful.
    Working with JavaScript. If there is one <my-button> on the page, we can query it and set a click handler on it with an event listener. But if we were to insert more instances on the page later, we would need to query it when it’s appended and re-run the function since it is not part of the original document rendering.
    Defining a custom element
    This defines and registers the custom element. It teaches the browser that this is an instance of the Custom Elements API and extends the same class that makes other HTML elements valid HTML elements:
    <my-element>My Element</my-element> <script> customElements.define("my-element", class extends HTMLElement {}); </script> Check out the methods we get immediate access to:
    Breaking down the syntax
    customElements .define( "my-element", class extends HTMLElement {} ); // Functionally the same as: class MyElement extends HTMLElement {} customElements.define("my-element", MyElement); export default myElement // ...which makes it importable by other elements: import MyElement from './MyElement.js'; const myElement = new MyElement(); document.body.appendChild(myElement); // <body> // <my-element></my-element> // </body> // Or simply pull it into a page // Don't need to `export default` but it doesn't hurt to leave it // <my-element>My Element</my-element> // <script type="module" src="my-element.js"></script> It’s possible to define a custom element by extending a specific HTML element. The specification documents this, but Scott is focusing on the primary way.
    class WordCount extends HTMLParagraphElement customElements.define("word-count", WordCount, { extends: "p" }); // <p is="word-count">This is a custom paragraph!</p> Scott says do not use this because WebKit is not going to implement it. We would have to polyfill it forever, or as long as WebKit holds out. Consider it a dead end.
    The lifecycle
    A component has various moments in its “life” span:
    Constructed (constructor) Connected (connectedCallback) Adopted (adoptedCallback) Attribute Changed (attributeChangedCallback) Disconnected (disconnectedCallback) We can hook into these to define the element’s behavior.
    class myElement extends HTMLElement { constructor() {} connectedCallback() {} adoptedCallback() {} attributeChangedCallback() {} disconnectedCallback() {} } customElements.define("my-element", MyElement); constructor()
    class myElement extends HTMLElement { constructor() { // provides us with the `this` keyword super() // add a property this.someProperty = "Some value goes here"; // add event listener this.addEventListener("click", () => {}); } } customElements.define("my-element", MyElement); “When the constructor is called, do this…” We don’t have to have a constructor when working with custom elements, but if we do, then we need to call super() because we’re extending another class and we’ll get all of those properties.
    Constructor is useful, but not for a lot of things. It’s useful for setting up initial state, registering default properties, adding event listeners, and even creating Shadow DOM (which Scott will get into in a later module). For example, we are unable to sniff out whether or not the custom element is in another element because we don’t know anything about its parent container yet (that’s where other lifecycle methods come into play) — we’ve merely defined it.
    connectedCallback()
    class myElement extends HTMLElement { // the constructor is unnecessary in this example but doesn't hurt. constructor() { super() } // let me know when my element has been found on the page. connectedCallback() { console.log(`${this.nodeName} was added to the page.`); } } customElements.define("my-element", MyElement); Note that there is some strangeness when it comes to timing things. Sometimes isConnected returns true during the constructor. connectedCallback() is our best way to know when the component is found on the page. This is the moment it is connected to the DOM. Use it to attach event listeners.
    If the <script> tag comes before the DOM is parsed, then it might not recognize childNodes. This is not an uncommon situation. But if we add type="module" to the <script>, then the script is deferred and we get the child nodes. Using setTimeout can also work, but it looks a little gross.
    disconnectedCallback
    class myElement extends HTMLElement { // let me know when my element has been found on the page. disconnectedCallback() { console.log(`${this.nodeName} was removed from the page.`); } } customElements.define("my-element", MyElement); This is useful when the component needs to be cleaned up, perhaps like stopping an animation or preventing memory links.
    adoptedCallback()
    This is when the component is adopted by another document or page. Say you have some iframes on a page and move a custom element from the page into an iframe, then it would be adopted in that scenario. It would be created, then added, then removed, then adopted, then added again. That’s a full lifecycle! This callback is adopted automatically simply by picking it up and dragging it between documents in the DOM.
    Custom elements and attributes
    Unlike React, HTML attributes are strings (not props!). Global attributes work as you’d expect, though some global attributes are reflected as properties. You can make any attribute do that if you want, just be sure to use care and caution when naming because, well, we don’t want any conflicts.
    Avoid standard attributes on a custom element as well, as that can be confusing particularly when handing a component to another developer. Example: using type as an attribute which is also used by <input> elements. We could say data-type instead. (Remember that Chris has a comprehensive guide on using data attributes.)
    Examples
    Here’s a quick example showing how to get a greeting attribute and set it on the custom element:
    class MyElement extends HTMLElement { get greeting() { return this.getAttribute('greeting'); // return this.hasAttribute('greeting'); } set greeting(val) { if(val) { this.setAttribute('greeting', val); // this setAttribute('greeting', ''); } else { this.removeAttribute('greeting'); } } } customElements.define("my-element", MyElement); Another example, this time showing a callback for when the attribute has changed, which prints it in the element’s contents:
    <my-element greeting="hello">hello</my-element> <!-- Change text greeting when attribite greeting changes --> <script> class MyElement extends HTMLElement { static observedAttributes = ["greeting"]; attributeChangedCallback(name, oldValue, newValue) { if (name === 'greeting' && oldValue && oldValue !== newValue) { console.log(name + " changed"); this.textContent = newValue; } } } customElements.define("my-element", MyElement); </script> A few more custom element methods:
    customElements.get('my-element'); // returns MyElement Class customElements.getName(MyElement); // returns 'my-element' customElements.whenDefined("my-element"); // waits for custom element to be defined const el = document.createElement("spider-man"); class SpiderMan extends HTMLElement { constructor() { super(); console.log("constructor!!"); } } customElements.define("spider-man", SpiderMan); customElements.upgrade(el); // returns "constructor!!" Custom methods and events:
    <my-element><button>My Element</button></my-element> <script> customElements.define("my-element", class extends HTMLElement { connectedCallback() { const btn = this.firstElementChild; btn.addEventListener("click", this.handleClick) } handleClick() { console.log(this); } }); </script> Bring your own base class, in the same way web components frameworks like Lit do:
    class BaseElement extends HTMLElement { $ = this.querySelector; } // extend the base, use its helper class myElement extends BaseElement { firstLi = this.$("li"); } Practice prompt
    Create a custom HTML element called <say-hi> that displays the text “Hi, World!” when added to the page:
    CodePen Embed Fallback Enhance the element to accept a name attribute, displaying "Hi, [Name]!" instead:
    CodePen Embed Fallback Chapter 3: HTML Templates
    The <template> element is not for users but developers. It is not exposed visibly by browsers.
    <template>The browser ignores everything in here.</template> Templates are designed to hold HTML fragments:
    <template> <div class="user-profile"> <h2 class="name">Scott</h2> <p class="bio">Author</p> </div> </template> A template is selectable in CSS; it just doesn’t render. It’s a document fragment. The inner document is a #document-fragment. Not sure why you’d do this, but it illustrates the point that templates are selectable:
    template { display: block; }` /* Nope */ template + div { height: 100px; width: 100px; } /* Works */ The content property
    No, not in CSS, but JavaScript. We can query the inner contents of a template and print them somewhere else.
    <template> <p>Hi</p> </template> <script> const myTmpl = documenty.querySelector("template").content; console.log(myTmpl); </script> Using a Document Fragment without a <template>
    const myFrag = document.createDocumentFragment(); myFrag.innerHTML = "<p>Test</p>"; // Nope const myP = document.createElement("p"); // Yep myP.textContent = "Hi!"; myFrag.append(myP); // use the fragment document.body.append(myFrag); Clone a node
    <template> <p>Hi</p> </template> <script> const myTmpl = documenty.querySelector("template").content; console.log(myTmpl); // Oops, only works one time! We need to clone it. </script> Oops, the component only works one time! We need to clone it if we want multiple instances:
    <template> <p>Hi</p> </template> <script> const myTmpl = document.querySelector("template").content; document.body.append(myTmpl.cloneNode(true)); // true is necessary document.body.append(myTmpl.cloneNode(true)); document.body.append(myTmpl.cloneNode(true)); document.body.append(myTmpl.cloneNode(true)); </script> A more practical example
    Let’s stub out a template for a list item and then insert them into an unordered list:
    <template id="tmpl-user"><li><strong></strong>: <span></span></li></template> <ul id="users"></ul> <script> const usersElement = document.querySelector("#users"); const userTmpl = document.querySelector("#tmpl-user").content; const users = [{name: "Bob", title: "Artist"}, {name: "Jane", title: "Doctor"}]; users.forEach(user => { let thisLi = userTmpl.cloneNode(true); thisLi.querySelector("strong").textContent = user.name; thisLi.querySelector("span").textContent = user.title; usersElement.append(thisLi); }); </script> The other way to use templates that we’ll get to in the next module: Shadow DOM
    <template shadowroot=open> <p>Hi, I'm in the Shadow DOM</p> </template> Chapter 4: Shadow DOM
    Here we go, this is a heady chapter! The Shadow DOM reminds me of playing bass in a band: it’s easy to understand but incredibly difficult to master. It’s easy to understand that there are these nodes in the DOM that are encapsulated from everything else. They’re there, we just can’t really touch them with regular CSS and JavaScript without some finagling. It’s the finagling that’s difficult to master. There are times when the Shadow DOM is going to be your best friend because it prevents outside styles and scripts from leaking in and mucking things up. Then again, you’re most certainly going go want to style or apply scripts to those nodes and you have to figure that part out.
    That’s where web components really shine. We get the benefits of an element that’s encapsulated from outside noise but we’re left with the responsibility of defining everything for it ourselves.
    Select elements are a great example of the Shadow DOM. Shadow roots! Slots! They’re all part of the puzzle. Using the Shadow DOM
    We covered the <template> element in the last chapter and determined that it renders in the Shadow DOM without getting displayed on the page.
    <template shadowrootmode="closed"> <p>This will render in the Shadow DOM.</p> </template> In this case, the <template> is rendered as a #shadow-root without the <template> element’s tags. It’s a fragment of code. So, while the paragraph inside the template is rendered, the <template> itself is not. It effectively marks the Shadow DOM’s boundaries. If we were to omit the shadowrootmode attribute, then we simply get an unrendered template. Either way, though, the paragraph is there in the DOM and it is encapsulated from other styles and scripts on the page.
    These are all of the elements that can have a shadow. Breaching the shadow
    There are times you’re going to want to “pierce” the Shadow DOM to allow for some styling and scripts. The content is relatively protected but we can open the shadowrootmode and allow some access.
    <div> <template shadowrootmode="open"> <p>This will render in the Shadow DOM.</p> </template> </div> Now we can query the div that contains the <template> and select the #shadow-root:
    document.querySelector("div").shadowRoot // #shadow-root (open) // <p>This will render in the Shadow DOM.</p> We need that <div> in there so we have something to query in the DOM to get to the paragraph. Remember, the <template> is not actually rendered at all.
    Additional shadow attributes
    <!-- should this root stay with a parent clone? --> <template shadowrootcloneable> <!-- allow shadow to be serialized into a string object — can forget about this --> <template shadowrootserializable> <!-- click in element focuses first focusable element --> <template shadowrootdelegatesfocus> Shadow DOM siblings
    When you add a shadow root, it becomes the only rendered root in that shadow host. Any elements after a shadow root node in the DOM simply don’t render. If a DOM element contains more than one shadow root node, the ones after the first just become template tags. It’s sort of like the Shadow DOM is a monster that eats the siblings.
    Slots bring those siblings back!
    <div> <template shadowroot="closed"> <slot></slot> <p>I'm a sibling of a shadow root, and I am visible.</p> </template> </div> All of the siblings go through the slots and are distributed that way. It’s sort of like slots allow us to open the monster’s mouth and see what’s inside.
    Declaring the Shadow DOM
    Using templates is the declarative way to define the Shadow DOM. We can also define the Shadow DOM imperatively using JavaScript. So, this is doing the exact same thing as the last code snippet, only it’s done programmatically in JavaScript:
    <my-element> <template shadowroot="open"> <p>This will render in the Shadow DOM.</p> </template> </my-element> <script> customElements.define('my-element', class extends HTMLElement { constructor() { super(); // attaches a shadow root node this.attachShadow({mode: "open"}); // inserts a slot into the template this.shadowRoot.innerHTML = '<slot></slot>'; } }); </script> Another example:
    <my-status>available</my-status> <script> customElements.define('my-status', class extends HTMLElement { constructor() { super(); this.attachShadow({mode: "open"}); this.shadowRoot.innerHTML = '<p>This item is currently: <slot></slot></p>'; } }); </script> So, is it better to be declarative or imperative? Like the weather where I live, it just depends.
    Both approaches have their benefits. We can set the shadow mode via Javascript as well:
    // open this.attachShadow({mode: open}); // closed this.attachShadow({mode: closed}); // cloneable this.attachShadow({cloneable: true}); // delegateFocus this.attachShadow({delegatesFocus: true}); // serialized this.attachShadow({serializable: true}); // Manually assign an element to a slot this.attachShadow({slotAssignment: "manual"}); About that last one, it says we have to manually insert the <slot> elements in JavaScript:
    <my-element> <p>This WILL render in shadow DOM but not automatically.</p> </my-element> <script> customElements.define('my-element', class extends HTMLElement { constructor() { super(); this.attachShadow({ mode: "open", slotAssignment: "manual" }); this.shadowRoot.innerHTML = '<slot></slot>'; } connectedCallback(){ const slotElem = this.querySelector('p'); this.shadowRoot.querySelector('slot').assign(slotElem); } }); </script> Examples
    Scott spent a great deal of time sharing examples that demonstrate different sorts of things you might want to do with the Shadow DOM when working with web components. I’ll rapid-fire those in here.
    Get an array of element nodes in a slot
    this.shadowRoot.querySelector('slot') .assignedElements(); // get an array of all nodes in a slot, text too this.shadowRoot.querySelector('slot') .assignedNodes(); When did a slot’s nodes change?
    let slot = document.querySelector('div') .shadowRoot.querySelector("slot"); slot.addEventListener("slotchange", (e) => { console.log(`Slot "${slot.name}" changed`); // > Slot "saying" changed }) Combining imperative Shadow DOM with templates
    Back to this example:
    <my-status>available</my-status> <script> customElements.define('my-status', class extends HTMLElement { constructor() { super(); this.attachShadow({mode: "open"}); this.shadowRoot.innerHTML = '<p>This item is currently: <slot></slot></p>'; } }); </script> Let’s get that string out of our JavaScript with reusable imperative shadow HTML:
    <my-status>available</my-status> <template id="my-status"> <p>This item is currently: <slot></slot> </p> </template> <script> customElements.define('my-status', class extends HTMLElement { constructor(){ super(); this.attachShadow({mode: 'open'}); const template = document.getElementById('my-status'); this.shadowRoot.append(template.content.cloneNode(true)); } }); </script> Slightly better as it grabs the component’s name programmatically to prevent name collisions:
    <my-status>available</my-status> <template id="my-status"> <p>This item is currently: <slot></slot> </p> </template> <script> customElements.define('my-status', class extends HTMLElement { constructor(){ super(); this.attachShadow({mode: 'open'}); const template = document.getElementById( this.nodeName.toLowerCase() ); this.shadowRoot.append(template.content.cloneNode(true)); } }); </script> Forms with Shadow DOM
    Long story, cut short: maybe don’t create custom form controls as web components. We get a lot of free features and functionalities — including accessibility — with native form controls that we have to recreate from scratch if we decide to roll our own.
    In the case of forms, one of the oddities of encapsulation is that form submissions are not automatically connected. Let’s look at a broken form that contains a web component for a custom input:
    <form> <my-input> <template shadowrootmode="open"> <label> <slot></slot> <input type="text" name="your-name"> </label> </template> Type your name! </my-input> <label><input type="checkbox" name="remember">Remember Me</label> <button>Submit</button> </form> <script> document.forms[0].addEventListener('input', function(){ let data = new FormData(this); console.log(new URLSearchParams(data).toString()); }); </script> This input’s value won’t be in the submission! Also, form validation and states are not communicated in the Shadow DOM. Similar connectivity issues with accessibility, where the shadow boundary can interfere with ARIA. For example, IDs are local to the Shadow DOM. Consider how much you really need the Shadow DOM when working with forms.
    Element internals
    The moral of the last section is to tread carefully when creating your own web components for form controls. Scott suggests avoiding that altogether, but he continued to demonstrate how we could theoretically fix functional and accessibility issues using element internals.
    Let’s start with an input value that will be included in the form submission.
    <form> <my-input name="name"></my-input> <button>Submit</button> </form> Now let’s slot this imperatively:
    <script> customElements.define('my-input', class extends HTMLElement { constructor() { super(); this.attachShadow({mode: 'open'}); this.shadowRoot.innerHTML = '<label><slot></slot><input type="text"></label>' } }); </script> The value is not communicated yet. We’ll add a static formAssociated variable with internals attached:
    <script> customElements.define('my-input', class extends HTMLElement { static formAssociated = true; constructor() { super(); this.attachShadow({mode: 'open'}); this.shadowRoot.innerHTML = '<label><slot></slot><input type="text"></label>' this.internals = this.attachedInternals(); } }); </script> Then we’ll set the form value as part of the internals when the input’s value changes:
    <script> customElements.define('my-input', class extends HTMLElement { static formAssociated = true; constructor() { super(); this.attachShadow({mode: 'open'}); this.shadowRoot.innerHTML = '<label><slot></slot><input type="text"></label>' this.internals = this.attachedInternals(); this.addEventListener('input', () => { this-internals.setFormValue(this.shadowRoot.querySelector('input').value); }); } }); </script> Here’s how we set states with element internals:
    // add a checked state this.internals.states.add("checked"); // remove a checked state this.internals.states.delete("checked"); Let’s toggle a “add” or “delete” a boolean state:
    <form> <my-check name="remember">Remember Me?</my-check> </form> <script> customElements.define('my-check', class extends HTMLElement { static formAssociated = true; constructor(){ super(); this.attachShadow({mode: 'open'}); this.shadowRoot.innerHTML = '<slot></slot>'; this.internals = this.attachInternals(); let addDelete = false; this.addEventListener("click", ()=> { addDelete = !addDelete; this.internals.states[addDelete ? "add" : "delete"]("checked"); } ); } }); </script> Let’s refactor this for ARIA improvements:
    <form> <style> my-check { display: inline-block; inline-size: 1em; block-size: 1em; background: #eee; } my-check:state(checked)::before { content: "[x]"; } </style> <my-check name="remember" id="remember"></my-check><label for="remember">Remember Me?</label> </form> <script> customElements.define('my-check', class extends HTMLElement { static formAssociated = true; constructor(){ super(); this.attachShadow({mode: 'open'}); this.internals = this.attachInternals(); this.internals.role = 'checkbox'; this.setAttribute('tabindex', '0'); let addDelete = false; this.addEventListener("click", ()=> { addDelete = !addDelete; this.internals.states[addDelete ? "add" : "delete"]("checked"); this[addDelete ? "setAttribute" : "removeAttribute"]("aria-checked", true); }); } }); </script> Phew, that’s a lot of work! And sure, this gets us a lot closer to a more functional and accessible custom form input, but there’s still a long way’s to go to achieve what we already get for free from using native form controls. Always question whether you can rely on a light DOM form instead.
    Chapter 5: Styling Web Components
    Styling web components comes in levels of complexity. For example, we don’t need any JavaScript at all to slap a few styles on a custom element.
    <my-element theme="suave" class="priority"> <h1>I'm in the Light DOM!</h1> </my-element> <style> /* Element, class, attribute, and complex selectors all work. */ my-element { display: block; /* custom elements are inline by default */ } .my-element[theme=suave] { color: #fff; } .my-element.priority { background: purple; } .my-element h1 { font-size: 3rem; } </style> This is not encapsulated! This is scoped off of a single element just light any other CSS in the Light DOM. Changing the Shadow DOM mode from closed to open doesn’t change CSS. It allows JavaScript to pierce the Shadow DOM but CSS isn’t affected. Let’s poke at it
    <style> p { color: red; } </style> <p>Hi</p> <div> <template shadowrootmode="open"> <p>Hi</p> </template> </div> <p>Hi</p> This is three stacked paragraphs, the second of which is in the shadow root. The first and third paragraphs are red; the second is not styled because it is in a <template>, even if the shadow root’s mode is set to open. Let’s poke at it from the other direction:
    <style> p { color: red; } </style> <p>Hi</p> <div> <template shadowrootmode="open"> <style> p { color: blue;} </style> <p>Hi</p> </template> </div> <p>Hi</p> The first and third paragraphs are still receiving the red color from the Light DOM’s CSS. The <style> declarations in the <template> are encapsulated and do not leak out to the other paragraphs, even though it is declared later in the cascade. Same idea, but setting the color on the <body>:
    <style> body { color: red; } </style> <p>Hi</p> <div> <template shadowrootmode="open"> <p>Hi</p> </template> </div> <p>Hi</p> Everything is red! This isn’t a bug. Inheritable styles do pass through the Shadow DOM barrier. Inherited styles are those that are set by the computed values of their parent styles. Many properties are inheritable, including color. The <body> is the parent and everything in it is a child that inherits these styles, including custom elements. Let’s fight with inheritance
    We can target the paragraph in the <template> style block to override the styles set on the <body>. Those won’t leak back to the other paragraphs.
    <style> body { color: red; font-family: fantasy; font-size: 2em; } </style> <p>Hi</p> <div> <template shadowrootmode="open"> <style> /* reset the light dom styles */ p { color: initial; font-family: initial; font-size: initial; } </style> <p>Hi</p> </template> </div> <p>Hi</p> This is protected, but the problem here is that it’s still possible for a new role or property to be introduced that passes along inherited styles that we haven’t thought to reset. Perhaps we could use all: initital as a defensive strategy against future inheritable styles. But what if we add more elements to the custom element? It’s a constant fight. Host styles!
    We can scope things to the shadow root’s :host selector to keep things protected.
    <style> body { color: red; font-family: fantasy; font-size: 2em; } </style> <p>Hi</p> <div> <template shadowrootmode="open"> <style> /* reset the light dom styles */ :host { all: initial; } </style> <p>Hi</p> <a href="#">Click me</a> </template> </div> <p>Hi</p> New problem! What if the Light DOM styles are scoped to the universal selector instead?
    <style> * { color: red; font-family: fantasy; font-size: 2em; } </style> <p>Hi</p> <div> <template shadowrootmode="open"> <style> /* reset the light dom styles */ :host { all: initial; } </style> <p>Hi</p> <a href="#">Click me</a> </template> </div> <p>Hi</p> This breaks the custom element’s styles. But that’s because Shadow DOM styles are applied before Light DOM styles. The styles scoped to the universal selector are simply applied after the :host styles, which overrides what we have in the shadow root. So, we’re still locked in a brutal fight over inheritance and need stronger specificity.
    According to Scott, !important is one of the only ways we have to apply brute force to protect our custom elements from outside styles leaking in. The keyword gets a bad rap — and rightfully so in the vast majority of cases — but this is a case where it works well and using it is an encouraged practice. It’s not like it has an impact on the styles outside the custom element, anyway.
    <style> * { color: red; font-family: fantasy; font-size: 2em; } </style> <p>Hi</p> <div> <template shadowrootmode="open"> <style> /* reset the light dom styles */ :host { all: initial; !important } </style> <p>Hi</p> <a href="#">Click me</a> </template> </div> <p>Hi</p> Special selectors
    There are some useful selectors we have to look at components from the outside, looking in.
    :host()
    We just looked at this! But note how it is a function in addition to being a pseudo-selector. It’s sort of a parent selector in the sense that we can pass in the <div> that contains the <template> and that becomes the scoping context for the entire selector, meaning the !important keyword is no longer needed.
    <style> * { color: red; font-family: fantasy; font-size: 2em; } </style> <p>Hi</p> <div> <template shadowrootmode="open"> <style> /* reset the light dom styles */ :host(div) { all: initial; } </style> <p>Hi</p> <a href="#">Click me</a> </template> </div> <p>Hi</p> :host-context()
    <header> <my-element> <template shadowrootmode="open"> <style> :host-context(header) { ... } /* matches the host! */ </style> </template> </my-element> </header> This targets the shadow host but only if the provided selector is a parent node anywhere up the tree. This is super helpful for styling custom elements where the layout context might change, say, from being contained in an <article> versus being contained in a <header>.
    :defined
    Defining an element occurs when it is created, and this pseudo-selector is how we can select the element in that initially-defined state. I imagine this is mostly useful for when a custom element is defined imperatively in JavaScript so that we can target the very moment that the element is constructed, and then set styles right then and there.
    <style> simple-custom:defined { display: block; background: green; color: #fff; } </style> <simple-custom></simple-custom> <script> customElements.define('simple-custom', class extends HTMLElement { constructor(){ super(); this.attachShadow({mode: 'open'}); this.shadowRoot.innerHTML = "<p>Defined!</p>"; } }); </script> Minor note about protecting against a flash of unstyled content (FOUC)… or unstyled element in this case. Some elements are effectively useless until JavsScript has interacted with it to generate content. For example, an empty custom element that only becomes meaningful once JavaScript runs and generates content. Here’s how we can prevent the inevitable flash that happens after the content is generated:
    <style> js-dependent-element:not(:defined) { visibility: hidden; } </style> <js-dependent-element></js-dependent-element> Warning zone! It’s best for elements that are empty and not yet defined. If you’re working with a meaningful element up-front, then it’s best to style as much as you can up-front.
    Styling slots
    This does not style the paragraph green as you might expect:
    <div> <template shadowrootmode="open"> <style> p { color: green; } </style> <slot></slot> </template> <p>Slotted Element</p> </div> The Shadow DOM cannot style this content directly. The styles would apply to a paragraph in the <template> that gets rendered in the Light DOM, but it cannot style it when it is slotted into the <template>.
    Slots are part of the Light DOM. So, this works:
    <style> p { color: green; } </style> <div> <template shadowrootmode="open"> <slot></slot> </template> <p>Slotted Element</p> </div> This means that slots are easier to target when it comes to piercing the shadow root with styles, making them a great method of progressive style enhancement.
    We have another special selected, the ::slotted() pseudo-element that’s also a function. We pass it an element or class and that allows us to select elements from within the shadow root.
    <div> <template shadowrootmode="open"> <style> ::slotted(p) { color: red; } </style> <slot></slot> </template> <p>Slotted Element</p> </div> Unfortunately, ::slotted() is a weak selected when compared to global selectors. So, if we were to make this a little more complicated by introducing an outside inheritable style, then we’d be hosed again.
    <style> /* global paragraph style... */ p { color: green; } </style> <div> <template shadowrootmode="open"> <style> /* ...overrides the slotted style */ ::slotted(p) { color: red; } </style> <slot></slot> </template> <p>Slotted Element</p> </div> This is another place where !important could make sense. It even wins if the global style is also set to !important. We could get more defensive and pass the universal selector to ::slotted and set everything back to its initial value so that all slotted content is encapsulated from outside styles leaking in.
    <style> /* global paragraph style... */ p { color: green; } </style> <div> <template shadowrootmode="open"> <style> /* ...can't override this important statement */ ::slotted(*) { all: initial !important; } </style> <slot></slot> </template> <p>Slotted Element</p> </div> Styling :parts
    A part is a way of offering up Shadow DOM elements to the parent document for styling. Let’s add a part to a custom element:
    <div> <template shadowrootmode="open"> <p part="hi">Hi there, I'm a part!</p> </template> </div> Without the part attribute, there is no way to write styles that reach the paragraph. But with it, the part is exposed as something that can be styled.
    <style> ::part(hi) { color: green; } ::part(hi) b { color: green; } /* nope! */ </style> <div> <template shadowrootmode="open"> <p part="hi">Hi there, I'm a <b>part</b>!</p> </template> </div> We can use this to expose specific “parts” of the custom element that are open to outside styling, which is almost like establishing a styling API with specifications for what can and can’t be styled. Just note that ::part cannot be used as part of a complex selector, like a descendant selector:
    A bit in the weeds here, but we can export parts in the sense that we can nest elements within elements within elements, and so on. This way, we include parts within elements.
    <my-component> <!-- exposes three parts to the nested component --> <nested-component exportparts="part1, part2, part5"></nested-component> </my-component> Styling states and validity
    We discussed this when going over element internals in the chapter about the Shadow DOM. But it’s worth revisiting that now that we’re specifically talking about styling. We have a :state pseudo-function that accepts our defined states.
    <script> this.internals.states.add("checked"); </script> <style> my-checkbox:state(checked) { /* ... */ } </style> We also have access to the :invalid pseudo-class.
    Cross-barrier custom properties
    <style> :root { --text-primary: navy; --bg-primary: #abe1e1; --padding: 1.5em 1em; } p { color: var(--text-primary); background: var(--bg-primary); padding: var(--padding); } </style> Custom properties cross the Shadow DOM barrier!
    <my-elem></my-elem> <script> customElements.define('my-elem', class extends HTMLElement { constructor(){ super(); this.attachShadow({mode: 'open'}); this.shadowRoot.innerHTML = ` <style> p { color: var(--text-primary); background: var(--bg-primary); padding: var(--padding); } </style> <p>Hi there!</p>`; } }) </script> Adding stylesheets to custom elements
    There’s the classic ol’ external <link> way of going about it:
    <simple-custom> <template shadowrootmode="open"> <link rel="stylesheet" href="../../assets/external.css"> <p>This one's in the shadow Dom.</p> <slot></slot> </template> <p>Slotted <b>Element</b></p> </simple-custom> It might seem like an anti-DRY approach to call the same external stylesheet at the top of all web components. To be clear, yes, it is repetitive — but only as far as writing it. Once the sheet has been downloaded once, it is available across the board without any additional requests, so we’re still technically dry in the sense of performance.
    CSS imports also work:
    <style> @import url("../../assets/external.css"); </style> <simple-custom> <template shadowrootmode="open"> <style> @import url("../../assets/external.css"); </style> <p>This one's in the shadow Dom.</p> <slot></slot> </template> <p>Slotted <b>Element</b></p> </simple-custom> One more way using a JavaScript-based approach. It’s probably better to make CSS work without a JavaScript dependency, but it’s still a valid option.
    <my-elem></my-elem> <script type="module"> import sheet from '../../assets/external.css' with { type: 'css' }; customElements.define('my-elem', class extends HTMLElement { constructor(){ super(); this.attachShadow({mode: 'open'}); this.shadowRoot.innerHTML = '<p>Hi there</p>'; this.shadowRoot.adoptedStyleSheets = [sheet]; } }) </script> We have a JavaScript module and import CSS into a string that is then adopted by the shadow root using shadowRoort.adoptedStyleSheets . And since adopted stylesheets are dynamic, we can construct one, share it across multiple instances, and update styles via the CSSOM that ripple across the board to all components that adopt it.
    Container queries!
    Container queries are nice to pair with components, as custom elements and web components are containers and we can query them and adjust things as the container changes.
    <div> <template shadowrootmode="open"> <style> :host { container-type: inline-size; background-color: tan; display: block; padding: 2em; } ul { display: block; list-style: none; margin: 0; } li { padding: .5em; margin: .5em 0; background-color: #fff; } @container (min-width: 50em) { ul { display: flex; justify-content: space-between; gap: 1em; } li { flex: 1 1 auto; } } </style> <ul> <li>First Item</li> <li>Second Item</li> </ul> </template> </div> In this example, we’re setting styles on the :host() to define a new container, as well as some general styles that are protected and scoped to the shadow root. From there, we introduce a container query that updates the unordered list’s layout when the custom element is at least 50em wide.
    Next up…
    How web component features are used together!
    Chapter 6: HTML-First Patterns
    In this chapter, Scott focuses on how other people are using web components in the wild and highlights a few of the more interesting and smart patterns he’s seen.
    Let’s start with a typical counter
    It’s often the very first example used in React tutorials.
    <counter-element></counter-element> <script type="module"> customElements.define('counter-element', class extends HTMLElement { #count = 0; connectedCallback() { this.innerHTML = `<button id="dec">-</button><p id="count">${this.#count}</p><button id="inc">+</button>`; this.addEventListener('click', e => this.update(e) ); } update(e) { if( e.target.nodeName !== 'BUTTON' ) { return } this.#count = e.target.id === 'inc' ? this.#count + 1 : this.#count - 1; this.querySelector('#count').textContent = this.#count; } }); </script> Reef
    Reef is a tiny library by Chris Ferdinandi that weighs just 2.6KB minified and zipped yet still provides DOM diffing for reactive state-based UIs like React, which weighs significantly more. An example of how it works in a standalone way:
    <div id="greeting"></div> <script type="module"> import {signal, component} from '.../reef.es..min.js'; // Create a signal let data = signal({ greeting: 'Hello', name: 'World' }); component('#greeting', () => `<p>${data.greeting}, ${data.name}!</p>`); </script> This sets up a “signal” that is basically a live-update object, then calls the component() method to select where we want to make the update, and it injects a template literal in there that passes in the variables with the markup we want.
    So, for example, we can update those values on setTimeout:
    <div id="greeting"></div> <script type="module"> import {signal, component} from '.../reef.es..min.js'; // Create a signal let data = signal({ greeting: 'Hello', name: 'World' }); component('#greeting', () => `<p>${data.greeting}, ${data.name}!</p>`); setTimeout(() => { data.greeting = '¡Hola' data,name = 'Scott' }, 3000) </script> We can combine this sort of library with a web component. Here, Scott imports Reef and constructs the data outside the component so that it’s like the application state:
    <my-greeting></my-greeting> <script type="module"> import {signal, component} from 'https://cdn.jsdelivr.net/npm/reefjs@13/dist/reef.es.min.js'; window.data = signal({ greeting: 'Hi', name: 'Scott' }); customElements.define('my-greeting', class extends HTMLElement { connectedCallback(){ component(this, () => `<p>${data.greeting}, ${data.name}!</p>` ); } }); </script> It’s the virtual DOM in a web component! Another approach that is more reactive in the sense that it watches for changes in attributes and then updates the application state in response which, in turn, updates the greeting.
    <my-greeting greeting="Hi" name="Scott"></my-greeting> <script type="module"> import {signal, component} from 'https://cdn.jsdelivr.net/npm/reefjs@13/dist/reef.es.min.js'; customElements.define('my-greeting', class extends HTMLElement { static observedAttributes = ["name", "greeting"]; constructor(){ super(); this.data = signal({ greeting: '', name: '' }); } attributeChangedCallback(name, oldValue, newValue) { this.data[name] = newValue; } connectedCallback(){ component(this, () => `<p>${this.data.greeting}, ${this.data.name}!</p>` ); } }); </script> If the attribute changes, it only changes that instance. The data is registered at the time the component is constructed and we’re only changing string attributes rather than objects with properties.
    HTML Web Components
    This describes web components that are not empty by default like this:
    <my-greeting></my-greeting> This is a “React” mindset where all the functionality, content, and behavior comes from JavaScript. But Scott reminds us that web components are pretty useful right out of the box without JavaScript. So, “HTML web components” refers to web components that are packed with meaningful content right out of the gate and Scott points to Jeremy Keith’s 2023 article coining the term.
    Jeremy cites something Robin Rendle mused about the distinction:
    The “React” way:
    <UserAvatar src="https://example.com/path/to/img.jpg" alt="..." /> The props look like HTML but they’re not. Instead, the props provide information used to completely swap out the <UserAvatar /> tag with the JavaScript-based markup.
    Web components can do that, too:
    <user-avatar src="https://example.com/path/to/img.jpg" alt="..." ></user-avatar> Same deal, real HTML. Progressive enhancement is at the heart of an HTML web component mindset. Here’s how that web component might work:
    class UserAvatar extends HTMLElement { connectedCallback() { const src = this.getAttribute("src"); const name = this.getAttribute("name"); this.innerHTML = ` <div> <img src="${src}" alt="Profile photo of ${name}" width="32" height="32" /> <!-- Markup for the tooltip --> </div> `; } } customElements.define('user-avatar', UserAvatar); But a better starting point would be to include the <img> directly in the component so that the markup is immediately available:
    <user-avatar> <img src="https://example.com/path/to/img.jpg" alt="..." /> </user-avatar> This way, the image is downloaded and ready before JavaScript even loads on the page. Strive for augmentation over replacement!
    resizeasaurus
    This helps developers test responsive component layouts, particularly ones that use container queries.
    <resize-asaurus> Drop any HTML in here to test. </resize-asaurus> <!-- for example: --> <resize-asaurus> <div class="my-responsive-grid"> <div>Cell 1</div> <div>Cell 2</div> <div>Cell 3</div> <!-- ... --> </div> </resize-asaurus> lite-youtube-embed
    This is like embedding a YouTube video, but without bringing along all the baggage that YouTube packs into a typical embed snippet.
    <lite-youtube videoid="ogYfd705cRs" style="background-image: url(...);"> <a href="https://youtube.com/watch?v=ogYfd705cRs" class="lyt-playbtn" title="Play Video"> <span class="lyt-visually-hidden">Play Video: Keynote (Google I/O '18)</span> </a> </lite-youtube> <link rel="stylesheet" href="./src.lite-yt-embed.css" /> <script src="./src.lite-yt-embed.js" defer></script> It starts with a link which is a nice fallback if the video fails to load for whatever reason. When the script runs, the HTML is augmented to include the video <iframe>.
    Chapter 7: Web Components Frameworks Tour
    Lit
    Lit extends the base class and then extends what that class provides, but you’re still working directly on top of web components. There are syntax shortcuts for common patterns and a more structured approach.
    The package includes all this in about 5-7KB:
    Fast templating Reactive properties Reactive update lifecycle Scoped styles <simple-greeting name="Geoff"></simple-greeting> <script> import {html, css, LitElement} from 'lit'; export class SimpleGreeting extends LitElement { state styles = css`p { color: blue }`; static properties = { name: {type = String}, }; constructor() { super(); this.name = 'Somebody'; } render() { return html`<p>Hello, ${this.name}!</p>`; } } customElements.define('simple-greeting', SimpleGreeting); </script> ProsConsEcosystemNo official SSR story (but that is changing)CommunityFamiliar ergonomicsLightweightIndustry-proven webc
    This is part of the 11ty project. It allows you to define custom elements as files, writing everything as a single file component.
    <!-- starting element / index.html --> <my-element></my-element> <!-- ../components/my-element.webc --> <p>This is inside the element</p> <style> /* etc. */ </style> <script> // etc. </script> ProsConsCommunityGeared toward SSGSSG progressive enhancementStill in early stagesSingle file component syntaxZach Leatherman! Enhance
    This is Scott’s favorite! It renders web components on the server. Web components can render based on application state per request. It’s a way to use custom elements on the server side. 
    ProsConsErgonomicsStill in early stagesProgressive enhancementSingle file component syntaxFull-stack stateful, dynamic SSR components Chapter 8: Web Components Libraries Tour
    This is a super short module simply highlighting a few of the more notable libraries for web components that are offered by third parties. Scott is quick to note that all of them are closer in spirit to a React-based approach where custom elements are more like replaced elements with very little meaningful markup to display up-front. That’s not to throw shade at the libraries, but rather to call out that there’s a cost when we require JavaScript to render meaningful content.
    Spectrum
    <sp-button variant="accent" href="components/button"> Use Spectrum Web Component buttons </sp-button> This is Adobe’s design system. One of the more ambitious projects, as it supports other frameworks like React Open source Built on Lit Most components are not exactly HTML-first. The pattern is closer to replaced elements. There’s plenty of complexity, but that makes sense for a system that drives an application like Photoshop and is meant to drop into any project. But still, there is a cost when it comes to delivering meaningful content to users up-front. An all-or-nothing approach like this might be too stark for a small website project.
    FAST
    <fast-checkbox>Checkbox</fast-checkbox> This is Microsoft’s system. It’s philosophically like Spectrum where there’s very little meaningful HTML up-front. Fluent is a library that extends the system for UI components. Microsoft Edge rebuilt the browser’s Chrome using these components. Shoelace
    <sl-button>Click Me</sl-button> Purely meant for third-party developers to use in their projects The name is a play on Bootstrap. 🙂 The markup is mostly a custom element with some text in it rather than a pure HTML-first approach. Acquired by Font Awesome and they are creating Web Awesome Components as a new era of Shoelace that is subscription-based Chapter 9: What’s Next With Web Components
    Scott covers what the future holds for web components as far as he is aware.
    Declarative custom elements
    Define an element in HTML alone that can be used time and again with a simpler syntax. There’s a GitHub issue that explains the idea, and Zach Leatherman has a great write-up as well.
    GitHub Issue Cross-root ARIA
    Make it easier to pair custom elements with other elements in the Light DOM as well as other custom elements through ARIA.
    GitHub Explainer GitHub Proposal Container Queries
    How can we use container queries without needing an extra wrapper around the custom element?
    HTML Modules
    This was one of the web components’ core features but was removed at some point. They can define HTML in an external place that could be used over and over.
    GitHub Explainer External styling
    This is also known as “open styling.”
    GitHub Explainer DOM Parts
    This would be a templating feature that allows for JSX-string-literal-like syntax where variables inject data.
    <section> <h1 id="name">{name}</h1> Email: <a id="link" href="mailto:{email}">{email}</a> </section> And the application has produced a template with the following content:
    <template> <section> <h1 id="name">{{}}</h1> Email: <a id="link" href="{{}}">{{}}</a> </section> </template> GitHub Proposal Scoped element registries
    Using variations of the same web component without name collisions.
    GitHub Issue
    Web Components Demystified originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.
  25. by: Abhishek Prakash
    Thu, 13 Mar 2025 04:27:14 GMT

    Keeping your laptop always plugged-in speeds up the deterioration of its battery life. But if you are using a docking station, you don't have the option to unplug the power cord.
    Thankfully, you can employ a few tricks to limit battery charging levels.
    How to Limit Charging Level in Linux (and Prolong Battery Life)Prolong your laptop’s battery life in long run by limiting the charging to 80%.It's FOSSAbhishek Prakash💬 Let's see what else you get in this edition
    A new COSMIC-equipped Linux distro. Android's native Linux terminal rolling out. File searching And other Linux news, tips, and, of course, memes! This edition of FOSS Weekly is supported by Zep's Graphiti. ✨ Zep’s Graphiti – Open-Source Temporal Knowledge Graph for AI Agents
    Traditional systems retrieve static documents, not evolving knowledge. Zep’s Graphiti is an open-source temporal knowledge graph that helps AI agents track conversations and structured data over time—enabling better memory, deeper context, and more accurate responses.
    Built to evolve, Graphiti goes beyond static embeddings, powering AI that learns. Open-source, scalable, and ready to deploy.
    Explore Zep’s Graphiti on GitHub and contribute!
    GitHub - getzep/graphiti: Build and query dynamic, temporally-aware Knowledge GraphsBuild and query dynamic, temporally-aware Knowledge Graphs - getzep/graphitiGitHubgetzep📰 Linux and Open Source News
    The first Framework Mono release since the Wine takeover has arrived. CrossOver 25 release is a packed one with new Windows games support. Google has quietly rolled out its native Linux terminal for some Android devices. Mesa 25.1 will not use the old Nouveau OpenGL driver, instead opting for a modern solution. Garuda COSMIC is a new offering that has been introduced to gauge community interest. The Nova NVIDIA GPU driver is shaping up nicely, with a Linux kernel debut imminent.
    Nvidia Driver Written in Rust Could Arrive With Linux Kernel 6.15The Nova GPU driver is still evolving, but a kernel debut is near.It's FOSS NewsSourav Rudra🧠 What We’re Thinking About
    Those naysayers who say open source software doesn't produce results need to read this.
    Open Source Fueled The Oscar-Winning ‘Flow’A great achievement pulled off using open source software!It's FOSS NewsCommunity🧮 Linux Tips, Tutorials and More
    Searching for files in Linux is synonymous to commands like find, xargs and grep. But not all of us Linux users are command line champs, right? Thankfully, even the file explorers like Nautilus have good search features.
    If you want something more than that, there are a few GUI tools like AngrySearch for this purpose.
    Experts can beef up Linux system's security with Pledge. Here's a guide for advanced users on how to handle PKGBUILD on Arch Linux. And some sudo tips ;)
    7 Ways to Tweak Sudo Command in LinuxUnleash the power of sudo with these tips 💪It's FOSSAbhishek Prakash👷 Homelab and Maker's Corner
    Take the first step towards a homelab with Raspberry Pi and CasaOS.
    Enjoying Self-Hosting Software Locally With CasaOS and Raspberry PiI used CasaOS for self-hosting popular open source services on a Raspberry Pi. Here’s my experience.It's FOSSAbhishek Kumar✨ Apps Highlight
    Tired of Notion? Why not give this open source alternative a chance?
    AFFiNE: A Truly Wonderful Open Source Notion Alternative With a Focus on PrivacyA solid open source rival to Notion and Miro. Let us take a look!It's FOSS NewsSourav Rudra📽️ Videos I am Creating for You
    In the latest video, I show how easy it is to create a multiboot Linux USB.
    Subscribe to It's FOSS YouTube Channel🧩 Quiz Time
    How much do you know of the Linux boot process? We have a crossword to jog your memory.
    Crossword Quiz on Linux Boot ProcessTest your knowledge of the Linux boot process in this fun and interactive crossword.It's FOSSAbhishek Prakash💡 Quick Handy Tip
    On Brave, you can search the history/bookmarks/tabs etc. from the address bar. Simply type @ in the address bar and start searching.
    🤣 Meme of the Week
    Are you even a real Linux user if you aren't excited when you see a Penguin? 🐧🤔
    🗓️ Tech Trivia
    TRADIC, developed by Bell Labs in 1954, was one of the first transistorized computers. It used nearly 800 transistors, significantly reducing power consumption.
    TRADIC operated on less than 100 watts, a fraction of what vacuum tube computers needed at that time. Initially, a prototype, it evolved into an airborne version for the U.S. Air Force. This innovation paved the way for future low-power computing systems.
    🧑‍🤝‍🧑 FOSSverse Corner
    Pro FOSSer Ernie dove into customizing his terminal with Starship.
    My most recent adventure: Customizing my terminal prompt using Starship!I read an item in today’s (March 6, 2025) ZDNet newsletter titled “Why the Starship prompt is better than your default on Linux and MacOS”. I was intrigued, so I followed the author’s instructions, and installed starship on my Garuda GNU/Linux system. Interestingly, my prompt did not change following installation and activation of starship, so I asked if Garuda uses starship to customize the terminal prompt in Firefox (I think Firefox uses the Google search engine), and the AI responded yes, ex…It's FOSS Communityernie❤️ With love
    Share it with your Linux-using friends and encourage them to subscribe (hint: it's here).
    Share the articles in Linux Subreddits and community forums.
    Follow us on Google News and stay updated in your News feed.
    Opt for It's FOSS Plus membership and support us 🙏
    Enjoy FOSS 😄

Important Information

Terms of Use Privacy Policy Guidelines We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.