Basically have the right section of the navbar reserved for text/an alert that will be placed there depending on if certain things happen. But, the alert, even when invisible, changes the height of the navbar. How do I fix this?
It might be hard to tell with the images but there's definitely a difference with the popup and when it's closed.
This is using the latest bootstrap v5.2.3
.navbar-brand img {
height: 50px;
width: 50px;
}
.alert svg {
height: 20px;
width: 20px;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.3/dist/css/bootstrap.min.css" />
<nav class="navbar navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="#">
<img src="https://via.placeholder.com/100" alt="Bootstrap" width="30" height="24">
</a>
<span class="navbar-text text-dark" id="wallet_address">
<div class="alert alert-warning d-flex align-items-center alert-dismissible fade show" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" class="bi bi-exclamation-triangle-fill flex-shrink-0 me-2" viewBox="0 0 16 16" role="img" aria-label="Warning:">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/>
</svg>
<div>
<strong>ERROR!</strong> No Wallet detected.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</div>
</span>
</div>
</nav>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/bootstrap#5.2.3/dist/js/bootstrap.bundle.min.js"></script>
edit: updated css and bootstrap version
It doesn't look like the alert is affecting anything while it's invisible. The alert has 1rem of margin on the bottom, which calculates out to make the entirety of the alert 90px tall. The available space of the nav by default is less than 90px, so including the alert in that space forces the nav to expand to accommodate the alert. Note the yellow area (margin) in the image.
The reason your nav has a height larger than expected when the alert is missing is because the navbar-brand class has some top and bottom padding, probably coming from bootstrap. Note the purple area (padding) in the image.
Related
I'm working with a project in Blazor.
I'm using a component called "BlazorWheelZoom" (https://github.com/iso8859/BlazorWheelZoom)
This is my first page:
#page "/"
#page "/print"
#using Blazorise
#using LabelPrint.Shared
#using Linak.LabelPrint.Client.Shared.Components
<h3>Print</h3>
<div class="container-lg">
<div class="row">
<div class="d-flex justify-content-center">
<div style="border: thin solid green; width: 510px; height: 510px; padding: 5px;">
<WheelZoom Image="/Img/rotate0.png" width="500" height="500" />
</div>
</div>
.... and so on
For this HTML as you can see above, I get the following output:
The image refuses to move to the left, just as expected. If i zoom in a little bit I can move it a few pixels corresponding to the difference (the part of the image that you cannot see) and then it stops.
See the demo of the creator: https://blazorwheelzoom.azurewebsites.net
But when I add the exact same code to a popup Modal, I can keep moving it to the left.
I have the exact same HTML and CSS, so it must be something with the parent I guess. But I have tried to disable/enable stuff, but without luck. I just want the image to be prevented from moving "out of bounds" if you know what I mean.
This is the HTML in my Modal:
<Modal #ref="LabelPreview">
<ModalContent Centered="true" Size="ModalSize.Large">
<ModalHeader>
<ModalTitle>Show</ModalTitle>
<CloseButton />
</ModalHeader>
<nav class="navbar navbar-light bg-light">
<Button #onclick="() => RotateImage(true)">
<i class="fas fa-redo"></i>
</Button>
<Button #onclick="() => RotateImage(false)">
<i class="fas fa-undo"></i>
</Button>
</nav>
<ModalBody>
<div class="d-flex justify-content-center">
<div class="#($"{rotationClass} frame")">
<WheelZoom Image="#(rotate0)" width="500" height="500" />
</div>
</div>
</ModalBody>
<ModalFooter>
<Button Color="Color.Secondary" Clicked="#DownloadImage">Download</Button>
<Button Color="Color.Primary" Clicked="#HidePreviewModal">OK</Button>
</ModalFooter>
</ModalContent>
The Modal component I'm using is from Blazorise
This gotta be some CSS thing, but I'm about to give up. So hopefully some of you guys can help me.
I need to compress an input type date, so i've tried setting the width to 120px.The problem is that there's a space between the date numbers and the input date icon.
I need to decrease or remove that space:
Is there a way to do that?
My code (I'm using bootstrap 4 btw):
<input type="date">
You can use:
::-webkit-calendar-picker-indicator{
margin-left: 0px;
}
If this is not enough, and you want even less space, just put a negative margin, like in this snippet:
::-webkit-calendar-picker-indicator{
margin-left: -15px;
}
<input type="date" >
Note: This works in Chrome. Firefox (and possibly other browsers) may not show the icon by default.
You can target the icon by using the following css selector: ::-webkit-calendar-picker-indicator
To increase the margin, use:
input[type=date]::-webkit-calendar-picker-indicator {
margin-left: 100px;
}
<input type="date">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
To decrease the space, use a negative margin, or any other option.
Correct way to use icons on <input type="date"
with bootstrap 4
Boostrapt icon calandar : https://icons.getbootstrap.com/icons/calendar/
sample code:
input[type="date"]::-webkit-calendar-picker-indicator {
position : absolute;
left : 0;
margin : 0;
width : 2em;
transform: translateX(-2.5em);
opacity : 0;
}
form { margin:1em }
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css" />
<form>
<div class="form-row align-items-center">
<div class=""> <!-- col-sm-3 my-1-->
<div class="input-group">
<div class="input-group-prepend">
<label for="DteInput" class="input-group-text">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-calendar" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"/>
</svg></label>
</div>
<input type="date" class="form-control" id="DteInput" placeholder="">
</div>
</div>
</div>
</form>
of course, you have to fight a bit for the chrome icon interference
see:
Method to show native datepicker in Chrome
Method to show native datepicker in Chrome
I am using Bootstrap 4's SVG icons in my buttons. I have the code working with the SVG hardcoded into the page's HTML. Now I want to refactor the SVG into a CSS class. I have followed the Bootstrap 4 instructions for creating the CSS class but I cannot work out how to display the icon on my button. I've tried a lot of variations without success.
CSS:
.bi::before {
display: inline-block;
content: "";
background-image: url('data:image/svg+xml,<svg width="2em" height="2em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"><path fill-rule="evenodd" d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z"></svg>');
background-repeat: no-repeat;
background-size: 1rem 1rem;
}
HTML:
<a href="#" class="btn bi" role="button" download></a>
Your help is greatly appreciated.
Well, to make your code work, there is a couple of note you should consider it.
First off, the <path> element within your SVG does not have any closing tag, so it will produce an error in the data attribute and it will prevent the icon to be shown.
To make your SVG responsive friendly it and fill the available space in the container it is better to avoid using width and height directly in the SVG element and use preserveAspectRatio="none" instead.
It is better to encode your SVG element instead of putting it directly within the data:image/svg to provide a valid string format for cross browsing purposes. You can use tools like this for the cause.
According to the above notes, your final code should be something like this:
.bi::before {
content: "";
display: inline-block;
background-image: url('data:image/svg+xml,%3Csvg%20preserveAspectRatio%3D%22none%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22currentColor%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20d%3D%22M.5%209.9a.5.5%200%200%201%20.5.5v2.5a1%201%200%200%200%201%201h12a1%201%200%200%200%201-1v-2.5a.5.5%200%200%201%201%200v2.5a2%202%200%200%201-2%202H2a2%202%200%200%201-2-2v-2.5a.5.5%200%200%201%20.5-.5z%22%20%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20d%3D%22M7.646%2011.854a.5.5%200%200%200%20.708%200l3-3a.5.5%200%200%200-.708-.708L8.5%2010.293V1.5a.5.5%200%200%200-1%200v8.793L5.354%208.146a.5.5%200%201%200-.708.708l3%203z%22%20%2F%3E%3C%2Fsvg%3E');
background-repeat: no-repeat;
width: 2rem;
height: 2rem;
}
<a href="#" class="btn bi" role="button" download></a>
NOTE: You can also create an SVG file in your project and then directly refer to it in your background image property like regular images for easier usage.
You can add an tag inside the or tag and apply the class to it. You can try to do it without the pseudoclass. Also you can adjust the icon in the button adding padding to the button.
the same question here.in my case i used this method (one of others) in my demo with my fastest php framework in the world (i use similar bootstrap buttons to change the language in the page)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="Custa">
<title>Document</title>
<style>
.flcn{ content:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48Y2lyY2xlIGN4PSIyNTYiIGN5PSIyNTYiIHI9IjI1NiIgZmlsbD0iI2Q4MDAyNyIvPjxwYXRoIGZpbGw9IiNmZmRhNDQiIGQ9Ik0xNDAuMSAxNTUuOGwyMi4xIDY4aDcxLjVsLTU3LjggNDIuMSAyMi4xIDY4LTU3LjktNDItNTcuOSA0MiAyMi4yLTY4LTU3LjktNDIuMUgxMTh6bTE2My40IDI0MC43bC0xNi45LTIwLjgtMjUgOS43IDE0LjUtMjIuNS0xNi45LTIwLjkgMjUuOSA2LjkgMTQuNi0yMi41IDEuNCAyNi44IDI2IDYuOS0yNS4xIDkuNnptMzMuNi02MWw4LTI1LjYtMjEuOS0xNS41IDI2LjgtLjQgNy45LTI1LjYgOC43IDI1LjQgMjYuOC0uMy0yMS41IDE2IDguNiAyNS40LTIxLjktMTUuNXptNDU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zIDI1LjV6bS04LjMtMTAwbDguMyAyNS40LTIxLjctMTUuNy0yMS43IDE1LjcgOC4zLTI1LjUtMjEuNy0xNS43aDI2LjhsOC4zLTI1LjYgOC4zIDI1LjZoMjYuOEwyMTIgMTMwLjN6bTAtNzQuN2w4LjMgMjUuNi0yMS43LTE1LjhMMTc3IDgxLjNsOC4zLTI1LjZMMTYzLjUgNDBoMjYuOGw4LjMtMjUuNUwyMDcgNDBoMjYuOEwyMTIgNTUuN3oiLz48L3N2Zz4=); }
/*
generated by me with php $flagencoded= base64_encode($svgimageloadedfrompath);
then with echo,fwrite,content output in some other way I generate
echo '.classname1{ content:url(data:image/svg+xml;base64,'.$flagencoded.');}';
so I got what you reading up
in my case all svg files are from github: flags public domain(free to anyone to use)
*/
p{
width: 30px;
height:30px;
}
</style>
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
</head>
<body>
<div class="pb-3">
<div class="container">
<div class="row">
<div class="col">
<button class="btn btn bg-info" type="submit">
<p class="fles"></p>
</button>
</div>
<div class="col">
<button class="btn btn bg-info" type="submit">
<p class="flfr"></p>
</button>
</div>
<div class="col">
<button class="btn btn bg-info" type="submit">
<p class="flus"></p>
</button>
</div>
<div class="col">
<button class="btn btn bg-info" type="submit">
<p class="flit"></p>
</button>
</div>
<div class="col">
<button class="btn btn bg-info" type="submit">
<p class="flde"></p>
</button>
</div>
<div class="col">
<button class="btn btn bg-info" type="submit">
<p class="flcn"></p>
</button>
</div>
<div class="col">
<button class="btn btn bg-info" type="submit">
<p class="flro"></p>
</button>
</div>
<div class="col">
<button class="btn btn bg-info" type="submit">
<p class="flru"></p>
</button>
</div>
</div>
</div>
</div>
</body>
</html>
This is my first work with css and Bootstrap. As shown in attached image, I want the green color of text TEST to be green to be applied to that all yellow highlighted rectangle. how can I do that? Also, I want to toggle the active color whenever I click on test1 and test2.
My code is as below
<nav class="navbar navbar-dark">
<div class="container-fluid">
<div class="row-fluid">
<nav class="col-md-11">
<span class="navbar-header">
<a href="/test/" class="navbar-item">
<img class="some-class"
src="<myUrl>">
</a>
<a tooltip-placement="bottom" uib-tooltip="${some-text}" class="navbar-brand-test" href="<myUrl>">TEST</a>
</span>
<ul class="nav navbar-nav">
<li class="test1"><a href="<myUrl>" >Test1</a></li>
<li class="test1"><a href='<myUrl>' >Test2</a></li>
</ul>
</nav>
</div>
</div>
</nav>
css for navbar-brand-test, I just updated the existing code:
.navbar-brand-test,
.navbar-brand-test:hover,
.navbar-brand-test:focus {
height: 50px;
line-height: 50px;
font-size: 1.4em;
letter-spacing: 0.05em;
padding: auto;
margin: auto;
color: #fff;
background-color: #5fc17c;
white-space: nowrap;
}
When I did as suggested by TKD21 in the answer below, It worked but as you see in second image, the BG collor filled the logo (yellow part in second image) as well. I want the logo to be separate than that BG color
Finally, below code did a trick. Slightly modified version of the answer by TKD21. Moved logo url below col-md-11 and added div instead of span
<nav class="navbar navbar-dark">
<div class="container-fluid">
<div class="row-fluid">
<nav class="col-md-11">
<a href="/test/" class="navbar-item"><img class="some-class"src="<myUrl>">
</a>
<div class="col-md-1 navbar-header" style="background-color: #5fc17c;">
<a tooltip-placement="bottom" uib-tooltip="${some-text}" class="navbar-brand-test" href="<myUrl>">TEST</a>
</div>
<ul class="nav navbar-nav">
<li class="test1"><a href="<myUrl>" >Test1</a></li>
<li class="test1"><a href='<myUrl>' >Test2</a></li>
</ul>
</nav>
</div>
</div>
</nav>
Now only issue I have is each tab should be active with green color when I click on Test1 or Test2. Will update here when I resolve it
If I understood your question correctly, you want the green background of the text "TEST" to be applied to ALL of the yellow triangle,yes?
If that is indeed the case, consider doing the following:
Change your <span class='navbar-header'> to <span class='col-md-1 navbar-header'> and add a color class or style rule of your choosing
Change your <span class='navbar-header'></span> to <div class='col-md-1 navbar-header'></div> and add a color class or style rule of your choosing
Though the two solutions seem identical, the second is less prone to breaking on window resize.
If you need a bigger green background size, just play around with the col-md-<number> Bootstrap classes.
The results from my testing can be seen here
I created a navbar in Bootstrap and I want to make it a little bit smaller.
I somehow did that, but my content of the navbar is bigger then it should be.
I don't know how to make it smaller to fit in the navbar or should it fit auto?
Code:
<nav class="navbar-default">
<div class="container-fluid" style="padding-left:55px; height:45px;">
<div class="navbar-header">
<a class="navbar-brand" style="margin-bottom: 2px;"><i class="fa fa-facebook-square" aria-hidden="true" style="font-size:23px;" id="fb"></i></a>
</div>
<ul class="nav navbar-nav">
<li><input type="text" class="input-sm" id="usr" style="margin-top: 9px;" placeholder="Pronadjite prijatelje"></li>
<li id="nameprofile"><img src="fb%20profile%20image.jpg" width="25px" height="25px" style="margin-right: 9px;">Ime</li>
<li>Pocetna stranica<span class="badge">2</span></li>
<li id="liprijatelji"><i class="fa fa-users" aria-hidden="true" style="font-size:20px; color:#1d2129;" id="findfriends"></i></li>
<li id="liporuke"><i class="fa fa-comments" aria-hidden="true" style="font-size:20px; color:#1d2129;" id="poruke"></i></li>
</ul>
</div>
</nav>
Text in code is not in English because I don't speak English.
Sorry if I made a mistake.
Ok, guiding myself from the bootstrap tutorials, you would need to have <nav class="navbar navbar-default"> instead of <nav class="navbar-default">. One of the reasons of the unexpected behaviour might be because you´re not adding this class.
Since you are using the .navbar class, then all you need to do is add the following css that overrides the default values of navbar.
.navbar{
min-height: 50px;
height: 50px;
}
If you look at bootstrap defaul CSS the .navbar default values are:
.navbar {
position: relative;
min-height: 50px; //This line is the one that defines the min height, which we overrid in the code above
margin-bottom: 20px;
border: 1px solid transparent;
}
You might also need to add max-height to your css, since the container might grow if your content is bigger than your container.
Here is a working example