Cannot resolve directory '~bootstrap'
I did npm install in terminal. I downloaded bootstrap. Currently, the codes I wrote over styles.css do not work.
@import "~bootstrap/dist/css/bootstrap.min.css";
@import "~font-awesome/css/font-awesome.min.css";
The errors I got after these codes:
npm audit fix --force
I tried this method but it didn't work
do you know?
how many words do you know
See also questions close to this topic
-
Creating Sticky Navbar with Drop Down Menu HTML
I am creating a HTML web page which contains a sticky navbar with drop down menu. However, when I created one, the dropdown menu does not works in the sticky navbar and so goes vise versa. below is the screenshot of both the result of the two codes.
*image with dropdown menu but without sticky navbar
*image with sticky navbar but without dropdown menu
below is the code for "image with dropdown menu but without sticky navbar"
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font- awesome/4.7.0/css/font-awesome.min.css"> <style> body {margin:0;font-family:Arial} .topnav { overflow: hidden; background-color: #333; } .topnav a { list-style-type: none; float: left; display: block; color: #f2f2f2; text-align: center; padding: 14px 16px; text-decoration: none; font-size: 17px; position: sticky; } .active { background-color: #04AA6D; color: white; } .topnav .icon { display: none; } .dropdown { float: left; overflow: hidden; } .dropdown .dropbtn { font-size: 17px; border: none; outline: none; color: white; padding: 14px 16px; background-color: inherit; font-family: inherit; margin: 0; } .dropdown-content { display: none; position: absolute; background-color: #f9f9f9; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } .dropdown-content a { float: none; color: black; padding: 12px 16px; text-decoration: none; display: block; text-align: left; } .topnav a:hover, .dropdown:hover .dropbtn { background-color: #555; color: white; } .dropdown-content a:hover { background-color: #ddd; color: black; } .dropdown:hover .dropdown-content { display: block; } @media screen and (max-width: 600px) { .topnav a:not(:first-child), .dropdown .dropbtn { display: none; } .topnav a.icon { float: right; display: block; } } @media screen and (max-width: 600px) { .topnav.responsive {position: relative;} .topnav.responsive .icon { position: absolute; right: 0; top: 0; } .topnav.responsive a { float: none; display: block; text-align: left; } .topnav.responsive .dropdown {float: none;} .topnav.responsive .dropdown-content {position: relative;} .topnav.responsive .dropdown .dropbtn { display: block; width: 100%; text-align: left; } } </style> </head> <body> <div class="header"> <h2>Scroll Down</h2> <p>Scroll down to see the sticky effect.</p> </div> <div class="topnav" id="myTopnav"> <a href="#home" class="active">Home</a> <a href="#news">News</a> <a href="#contact">Contact</a> <div class="dropdown"> <button class="dropbtn">Dropdown <i class="fa fa-caret-down"></i> </button> <div class="dropdown-content"> <a href="#">Link 1</a> <a href="#">Link 2</a> <a href="#">Link 3</a> </div> </div> <a href="#about">About</a> <a href="javascript:void(0);" style="font-size:15px;" class="icon" onclick="myFunction()">☰</a> </div> <div style="padding-left:16px"> <h2>Responsive Topnav with Dropdown</h2> <p>Resize the browser window to see how it works.</p> <p>Hover over the dropdown button to open the dropdown menu.</p> </div> <h3>Sticky Navigation Bar Example</h3> <p>The navbar will <strong>stick</strong> to the top when you reach its scroll position.</p> <p><strong>Note:</strong> Internet Explorer do not support sticky positioning and Safari requires a -webkit- prefix.</p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <script> function myFunction() { var x = document.getElementById("myTopnav"); if (x.className === "topnav") { x.className += " responsive"; } else { x.className = "topnav"; } } </script> </body> </html>
below is the code for "image with sticky navbar but without dropdown menu"
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font- awesome/4.7.0/css/font-awesome.min.css"> <style> body { font-size: 20px; } body {margin:0;} ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #333; position: -webkit-sticky; /* Safari */ position: sticky; top: 0; } li { float: left; } li a { display: block; color: white; text-align: center; padding: 16px 20px; text-decoration: none; } li a:hover { background-color: #111; } /*======================================================================*/ body { background-color:white; } ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #38444d; } li { float: left; } li a, .dropbtn { display: inline-block; color: white; text-align: center; padding: 14px 16px; text-decoration: none; } li a:hover, .dropdown:hover .dropbtn { background-color: red; } li.dropdown { display: inline-block; } .dropdown-content { display: none; position: absolute; background-color: #f9f9f9; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } .dropdown-content a { color: black; padding: 12px 16px; text-decoration: none; display: block; text-align: left; } .dropdown-content a:hover {background-color: #f1f1f1;} .dropdown:hover .dropdown-content { display: block; } footer { text-align: center; padding: 3px; background-color: DarkSalmon; color: white; } </style> </head> <body> <div class="header"> <h2>Scroll Down</h2> <p>Scroll down to see the sticky effect.</p> </div> <ul> <li><a href="#home">Home</a></li> <li><a href="#news">News</a></li> <li class="dropdown"> <a href="javascript:void(1)" class="dropbtn">Dropdown</a> <div class="dropdown-content"> <a href="#">Link 1</a> <a href="#">Link 2</a> <a href="#">Link 3</a> </div> </li> </ul> <h3>Sticky Navigation Bar Example</h3> <p>The navbar will <strong>stick</strong> to the top when you reach its scroll position.</p> <p><strong>Note:</strong> Internet Explorer do not support sticky positioning and Safari requires a -webkit- prefix.</p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <footer> <p>Author: Hege Refsnes<br> <a href="mailto:hege@example.com">hege@example.com</a></p> </footer> </body> </html>
Please i need some help with this as i am new to html and css.
-
Javascript: Change element class if button has a certain value
<div class="main-div main-div2"> <!-- IF up to date, main-div3 --> <button id="update-btn" class="btn update-btn"> Up to date </button> </div>
I want to make it so if update-btn has a value of "Up to date", change the div class from "main-div main-div2" to "main-div main-div3". Otherwise, if it's any other value, change it to "main-div main-div2"
What kind of loop would be good for this Javascript function too if I want it to be checking constantly?
Thank you.
-
Boostrap vertical sizing with different style width and height
I am trying to set verticaly icon on profile photo card inside div to be in the middle in white box(div), but dont know why it doesnt works. When I use
style="width: 300px; height: 300px;
for div square I can center it on horizontaly, but not verticaly :/ Can someone explain me what I am doing wrong?Anyway is there any way how to resize bootstrap icons except display-1???
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css"> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> <div class="container-sm offset-md"> <h1 class="p-4 m-4">Nastavení profilu</h1> <div class="row"> <div class="col"> <div class="card p-4 m-4"> Osobní údaje <input type="text" name="name" class="form-control" placeholder="Jméno"> <input type="text" name="surname" class="form-control" placeholder="Příjmení"> <input type="email" name="email" class="form-control" placeholder="E-Mail"> <input type="date" name="name" class="form-control"> </div> </div> <div class="col-4"> <div class="card p-4 m-4 bg-light"> Profilová fotografie <div class=" square text-center border display-1 m-3 bg-white mx-auto"> <i class="bi bi-person-fill align-middle justify-content-center text-secondary"></i> </div> <input type="file" id="customFile" name="file" hidden=""> <div class="text-center"> <button class="btn btn-success" for="customFile">Nahrát</button> <button type="button" class="btn btn-danger">Smazat</button> <p class="text-muted mt-3 mb-0">Poznámka: Minimální velikost 300px x 300px</p> </div> </div> </div> </div> <div class="row"> <div class="col"> <div class="card p-4 m-4"> Změna hesla </div> </div> <div class="col"> <div class="card p-4 m-4"> Zobrazit/skrýt podrobnosti </div> </div> </div> </div>
-
Why are Gradle projects so huge?
As a long time Maven user I thought I'd try creating an IntelliJ plugin using their preferred build tool Gradle, and the moment I had their template (as recommended by IntelliJ here) cloned to my local machine I tried to build and run the plugin but it took forever.... just like all my past encounters with Gradle.
Then I noticed the size of the project had exploded to almost 4GB!... 🤔
How is this possible?
-
How can I use my utility classes in different git-projects at once?
I'm a beginning programmer and I apologize if my questions is trivial but I haven't found a sufficient answer to my problem.
I have a git repository called "toolbox" with some utility classes that I frequently use in other projects. Until now, I have manually copied those class files from this project in other projects whenever I needed them.
This if of course not a good way of doing it. I frequently add new features and fixes in whatever project I'm currently working on to these files. It makes version management a nightmare.
What I'd like to to is to import the toolbox-classes directly into the IntelliJ-Project(s) (which is also on the same git as the toolbox repo) and whenever I make a change to those files in the toolbox-repo I want the other projects to be able to automatically pull those changes as well.
If possible I'd also like to be able to share my toolbox-repo easily with others who might need those classes. But that is not a requirement. I'd just be nice to be able to do so.
I tried to use git submodule. It included the entire toolbox-repo in the target-repo but unfortunately I wasn't able to use the utility classes. I asked someone more experienced and they told me that I need to define "SourceSet" in the gradle.build but I wasn't able to configure that due to my lack of knowledge.
How can I include/import/use my utility classes from my toolbox-repo within other projects?
Thanks for any advice.
-
Imports Unrecognized By IntelliJ when Getting A Project From GitHub
I've faced this problem quite a lot lately but I didn't care in the past and decided to rewrite the whole project I'm getting from GitHub but now when the project is enormous I can't do this anymore.
Here is a picture of the problem:
As you see the classes are already in their places but the import still failing I don't know why. I checked my SDK and it's already added so anyone have an idea why this happening?
-
Bootstrap popover content callback called twice on every second click
I'm trying to create a feature that will display the popover with manual click event. My goal is to populate the popover and display newest data through ajax call after every click.
The problem I'm facing is described on the title.
For example:
1st click -> call once 2nd click -> call twice 3rd click -> call once 4th click -> call twice ...
The code look like this:
$popoverButton.popover({ container: 'body', template: `<div></div>`, title: 'title', content: function () { console.log('*'); // this called twice on every second click let id = $(this).attr('data-id'); return initPopover(id); }, html: true, trigger: 'manual', }); function initPopover(id) { let $popover = $('<div class="popover-body"></div>'); $popover.attr({'id': 'popover-body-' + id}); let $spinner = $(`<div class="spinner"><span class="spinner-border"></span></div>`); $popover.append($spinner); let $sellers = $('<div class="sellers"></div>'); $popover.append($sellers); return $popover; }
To open the popover, I declared the click event with these functions:
$popoverButton.on('click', function () { closePopover(); openPopover($(this)); }); closePopover() { $popoverButton.popover('hide'); } openPopover($targetButton) { // hide all opened popovers $('.popover').popover('hide'); $targetButton.popover('show'); getSellersAndAppendData(); }
I'm not sure why this happened. Please help.
-
How do I set default alignment for horizontal controls in Bootstrap-UI 3 for CakePHP 4?
This is a particularly obscure question about the Boostrap-UI plugin for CakePHP but I'm hoping someone might be able to help.
I’m using Bootstrap-UI (https://github.com/FriendsOfCake/bootstrap-ui) version 3.0, so using Bootstrap 4.6.
I’m trying to create a form that has controls that are aligned horizontally with their labels using the example from the readme here -
This works fine except I can’t see how to define the default column distribution ie so that the classes for the label and the control container are something like
col-4
andcol-8
without any breakpoint defined.If I try something like -
'align' => [ 'left' => 4, 'middle' => 8, ]
The classes created are
col-md-4
andcol-md-8
ie it seems to default to md as the breakpoint for the columns.I know this is a bit obscure but does anyone have any idea how to do what I want?
-
Heroku buttons styling issue
I made an app locally and pushed it on Heroku. The app is working perfectly on Heroku, however on the Homepage I have 2 buttons ( login and register ). When I run my app locally my buttons have some whitespace in between and they are rounded ( I am using tailwind for this). But on Heroku both buttons are not rounded and there is no whitespace in between them. When I inspect the button on Heroku, I see: class:".... rounded-full", which is what I expected and should have made the button rounded. Anyone has any idea what could cause this and how I can solve this ?
This is how my index.js looks like:
export default function Login() { return( <div> <Loginbuttons/> </div> ) }
and Loginbuttons.js defined as:
import Link from 'next/link' export default function Loginbutton(props){ return ( <div> <div className = 'block'> <button style={{width:"10%", paddingTop:"15px", paddingBottom:"15px"}} className='mt-10 mb-10 bg-blue-500 hover:bg-blue-700 text-wgvhite font-bold py-2 px-4 rounded-full'> <Link href='login' style={{textDecoration: 'none'}}>Login</Link> </button> <button style={{width:"10%", paddingTop:"15px", paddingBottom:"15px"}} className='mt-10 mb-10 ml-10 bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full'> <Link href='register' style={{textDecoration: 'none'}}>Register</Link> </button> </div> </div>)}
-
Javafx - change Theme (CSS) on active window
I want a Button that allows me to switch between Dark/Light-mode. But I have the problem If I switch, the active windows will not change their Style.
First of the Code snippets to easy recreate the problem. For Maven projects starter class:
package testapp; //This Class is Required in mavenproject to Start the Application public class GUIStarter { public static void main(final String[] args) { try{ TestApp.main(args); }catch (Exception e){ System.out.println("GUIStarter Errror:\n"+e); } } }
The primary Window class:
package testapp; //IMPORT //JAVAFX import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.stage.Stage; //title import javafx.scene.Scene; //IMPORT END public class TestApp extends Application { //stylepaths public static String mainLightModePath = ".\\style_lightmode.css"; public static String mainDarkModePath = ".\\style-Darkmode.css"; public static boolean isItDarkmode = true; public static void toggleMode(){ if(isItDarkmode){ isItDarkmode = false; }else if(!isItDarkmode){ isItDarkmode = true; } } //This is required to get the primary Stage in other Stages (Controllers) private static Stage pStage; public static Stage getPrimaryStage() { return pStage; } private void setPrimaryStage(Stage pStage) { TestApp.pStage = pStage; } public void setPrimaryWindow(Stage primaryStage){ try{ FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Mainframe.fxml")); Parent root = (Parent) fxmlLoader.load(); Scene scene = new Scene(root); primaryStage.setTitle("TestApp"); //scene.setMoveControl(titleBar); primaryStage.setScene(scene); primaryStage.show(); } catch (Exception e){ e.printStackTrace(); } } //Start of Application @Override public void start(Stage primaryStage) { setPrimaryStage(primaryStage); pStage = primaryStage; setPrimaryWindow(primaryStage); } public static void main(String[] args) { launch(args); } }
The maincontroller Class:
package testapp; //IMPORT //JAVAFX import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.stage.Stage; import javafx.scene.Node; import javafx.event.ActionEvent; import javafx.scene.layout.BorderPane; //Countdown import javafx.animation.Timeline; public class Mainframe { public static Timeline time; @FXML public void options(ActionEvent event){ try{ TestApp.toggleMode(); Stage stage = (Stage) ((Node)event.getSource()).getScene().getWindow(); Stage changer = TestApp.getPrimaryStage(); stage.close(); changer.hide(); //My idea was to initialize again and load the styles in that way again but does not change anything FXMLLoader loader = new FXMLLoader(getClass().getResource("Mainframe.fxml")); loader.load(); Mainframe ctrl = loader.getController(); ctrl.initialize(); changer.show(); }catch (Exception e) { System.out.println("Error bei der App Klicken von ModeButton. \n error is: "+e); e.printStackTrace(); } } @FXML public BorderPane primaryparent; //get and set for elements @FXML void initialize() { //Check Theme if(TestApp.isItDarkmode){ primaryparent.getStylesheets().clear(); primaryparent.getStylesheets().add(getClass().getResource(TestApp.mainDarkModePath).toString()); }else if(!TestApp.isItDarkmode){ primaryparent.getStylesheets().clear(); primaryparent.getStylesheets().add(getClass().getResource(TestApp.mainLightModePath).toString()); } } }
Mainframe.fxml
:<?xml version="1.0" encoding="UTF-8"?> <?import javafx.geometry.Insets?> <?import javafx.scene.control.Button?> <?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.BorderPane?> <?import javafx.scene.text.Font?> <BorderPane fx:id="primaryparent" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="0.0" minWidth="0.0" prefHeight="224.0" prefWidth="515.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="testapp.Mainframe"> <center> <AnchorPane prefHeight="200.0" prefWidth="200.0" styleClass="rootBackground" BorderPane.alignment="CENTER"> <children> <Button fx:id="setDarkModeButton" layoutX="175.0" layoutY="99.0" mnemonicParsing="false" onAction="#options" styleClass="settingsButton" text="toggle Dark/LightMode"> <font> <Font name="Arial" size="13.0" /> </font> <padding> <Insets bottom="5.0" left="17.0" right="17.0" top="5.0" /> </padding> </Button> </children> </AnchorPane> </center> </BorderPane>
Before I just
overwrote
the "style.css" file and used.stop()
&.show()
. This worked fine. But it can get complicated the morecss-files
you have and after it is packed into a.jar
file it doesn't work anymore.I hope anyone can help me. Because now I have really no Idea...
-
How to add a new icon from Font Awesome to an older version?
I have Font Awesome 4 on website.
I tried to add TikTok logo as following but it doesn't show up on website as tiktok logo support started in Font Awesome version 5.13.1:
<i class="fa fa-tiktok"></i>
Question:
How can I add one logo from newer Font Awesome versions while keeping old version 4? Thus avoiding to modify syntax from
fa
tofas
across all the website? -
Can I use non-bootstrap icons in bootstrap-vue components
I know bootstrap has a ton of icons, but they are missing stuff that I need,
so I was thinking about using an external icon base eg. fontawesome.So with bootstrap I can apply its icons to components eg. like this:
<b-avatar class="mr-3" icon="chat-right-text"></b-avatar>
I was hoping that I could do the same with other icons expecting something like this to work:
<b-avatar class="mr-3" icon="fa-solid fa-circle-info"></b-avatar>
But I ended up with an empty icon.
Everything is installed correctly, since this works fine:
<font-awesome-icon icon="fa-solid fa-circle-info" />
Is there a way to use external icons in bootstrap components?