need help, i have here my code for my navbar with some php codes, one problem is the texts is aligning to the right . and i cant find the solution to this. i cant attach the css . ill attach it later after i post this . thanks a lot for those who can help me :)
<h1>HTML</h1>
<div class="container">
<nav class="navbar navbar-custom" role="navigation">
<div class="navbar-header">
<button type ="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="login_success.php"><img src="litrato/seal.png" HEIGHT="20" WIDTH="20" BORDER="0"></a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li >HOME </li>
<li class="active">CABECS </li>
<li>CON </li>
<li>COE </li>
<li>CASE </li>
<li>BED </li>
</ul>
<form class="navbar-form navbar-left" role="search" action='' method='post'>
<div class="form-group">
<input type="text" class="form-control" placeholder="Search" name='cisearch'>
</div>
<button class="btn btn-default glyphicon glyphicon-search" name='searchcabecs'></button>
</form>
<?php
include('connect.php');
if(isset($_POST['searchcabecs'])){
echo "<div style=' position:absolute; z-index:1; top:100%; left:21%; height:400%; width:50%; overflow: scroll; overflow-x: hidden; background-color:FFFFFF;'>";
echo"<table border=1 style='position:absolute; z-index:1; top:0%; left:0%; height:2%; width:100%; background-color:FFFFFF; border:2px solid yellow; border-radius: 3px; '>";
echo "<tr><td>RESULT :<button onclick=\"window.location.href='cabecs.php';\" style=' color:red; float:right;'>x</button></td></tr>";
$csearch = $_POST['cisearch'];
$search = mysql_query("SELECT * FROM addtopic where add_topic LIKE '%$csearch%' AND department = 'CABECS' ");
while($rows = mysql_fetch_array($search))
{
echo "<tr>";
echo "<form method='GET' id='view' action= 'view.php' >";
echo "<input type='hidden' name='supporttype' />";
echo "<td><div style='width:700px; height:100px; word-break: break-all; white-space: normal;'><p style='float:left;'></br>TOPIC: <input type='submit' value='$rows[add_topic]' style='background: #ffffff url(litrato/transparent.png); outline: FFFFFF; background-size: 60px auto; background-size: 100%; border:0; border: none; width:100%; height:100%;'>"."<input type='text' name='topic_id' value='$rows[topic_id]' hidden><input type='text' name='name' value='$name' hidden> <input type='text' name='addtopic' value='$rows[add_topic]' hidden>"."</a></p></div></td>";
echo "</form></tr>";
}
echo "</table></div>";
}
?>
<ul class="nav navbar-nav navbar-right">
<p class="navbar-text navbar-left">Signed in as <?php echo $name?></p>
<li>About Us </li>
<li class="dropdown">
<ul class="dropdown-menu" role="menu">
<li>View Profile</li>
<li>Edit Profile</li>
<li class="divider"></li>
<li>Log Out</li>
</ul>
</li>
</div>
</ul>
</div>
</nav>
</div>
Probably a text-align or float in the CSS
Related
I try to make a proper navbar with bootstrap.
I tried to make a logo in the center and the rest on the left and on the right.
The current solution is unclean and I ask you for an adivce, how to fix it.
Problem: It's not the same length to the left/right object from the logo AND the logo is not perfect centered.
[Navbar][1]
Current html:
<nav class="navbar navbar-expand-sm navbar-dark bg-dark fixed-top">
<div class="container">
<button class="navbar-toggler" data-toggle="collapse" data-target="#navbarMenu">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarMenu">
<ul class="navbar-nav mr-auto">
<li class="nav-item">Status</li>
<li class="nav-item">Download</li>
<li class="nav-item">Teamspeak</li>
<li class="nav-item">Teamspeak</li>
</ul>
<a class="navbar-brand" href="#">
<img src="/img/helmet.png" height="100" with="50" alt="">
</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item">Teamspeak Bot</li>
<li class="nav-item">Travel</li>
<li class="nav-item">Plex</li>
<li class="nav-item">Contact</li>
</ul>
</div>
</div>
</nav>
CSS
.collapse.navbar-collapse ul{
margin: auto;
}
.navbar-brand {
position: absolute;
top: 0;
left: 50%;
text-align: center;
margin: auto;
font-size: 36px;
}
.bg-dark {
background:transparent !important;
background-image: url("/img/navbar.png") !important;
min-height: 70px;
}
You can use pull-right class to align the items to the right, but it need few more modifications to work correctly.I have created a clean solution with the links that you provided.Enjoy!
body { background-color: blueviolet !important; }
.navbar {
position: relative;
top:10px;
}
.brand {
position: absolute;
left: 50%;
margin-left: -50px !important;
display: block;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js#1.16.0/dist/umd/popper.min.js"></script>
<!--If you want to add background image add it to the class below-->
<div class="container-fluid"><!--add this line-->
<div class="row"><!--add this line-->
<div class="col-md-12"><!--add this line-->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="brand" style="margin: 0; float: none;" href="#">
<!--add logo source-->
<img src="icon.png" alt="logo" title="logo" height="100" with="50" />
</a>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">Status</li>
<li class="nav-item">Download</li>
<li class="nav-item">Teamspeak</li>
<li class="nav-item">Teamspeak</li>
</ul>
<ul class="navbar-nav pull-right">
<li class="nav-item">Teamspeak Bot</li>
<li class="nav-item">Travel</li>
<li class="nav-item">Plex</li>
<li class="nav-item">Contact</li>
</ul>
</div>
</div>
</nav>
</div><!--add this line-->
</div><!--add this line-->
<!--New Row for the main content-->
<div class="row">
<div class="col-md-12">
<!--Main content-->
</div>
</div>
</div><!--add this line-->
Change class on second tag to ml-auto since the right side pane must be aligned with margin on the left. This should fix it.
<nav class="navbar navbar-expand-sm navbar-dark bg-dark fixed-top">
<div class="container">
<button class="navbar-toggler" data-toggle="collapse" data-target="#navbarMenu">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarMenu">
<ul class="navbar-nav mr-auto">
<li class="nav-item">Status</li>
<li class="nav-item">Download</li>
<li class="nav-item">Teamspeak</li>
<li class="nav-item">Teamspeak</li>
</ul>
<a class="navbar-brand" href="#">
<img src="/img/helmet.png" height="100" with="50" alt="">
</a>
<ul class="navbar-nav ml-auto"> <!-- change here -->
<li class="nav-item">Teamspeak Bot</li>
<li class="nav-item">Travel</li>
<li class="nav-item">Plex</li>
<li class="nav-item">Contact</li>
</ul>
</div>
</div>
</nav>
I want it to be like this, the alignment but different info from database:
It shows like this:
<?php
include_once('connection.php');
$sql = "SELECT * FROM tblstdpro
ORDER BY StdID DESC limit 0, 8";
$result = mysqli_query($conn,$sql);
$count = 0;
while($row = mysqli_fetch_array($result)){
$StudentID="<a href='ProfileRecords.php?id=".$row['StdID']."'>".$row['StdID']."</a>";
$StdName="<a href='ProfileRecords.php?id=".$row['StdID']."'>" . $row['Fname'] . ' ' . $row['Lname'] . "</a>";
?>
<!-- Select distinct stdname, stdimage from tblstdpro order by stdid desc -->
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
</button>
<button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i>
</button>
</div>
</div>
<!-- /.box-header -->
<div class="box-body no-padding">
<ul class="users-list clearfix">
<li>
<img src="<?php echo $row['StdImage'];?>" width="125px" alt="Student Image">
<a class="users-list-name" href="#"><?php echo "$StdName" ?></a>
<span class="users-list-date"><?php echo "$StudentID" ?></span>
</li>
</li>
<?php
} ?>
</ul>
<!-- /.users-list -->
</div>
<!-- /.box-body -->
<div class="box-footer text-center">
View All Users
</div>
<!-- /.box-footer -->
</div>
<!--/.box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
Please show me the code I should add.
I think you need to apply css to ul so that li items are displayed in line and not in a column. This is what I have come up with. Hope this helps..
<style>
/***Student list***/
ul#stdList{
width:fit-content;
margin:15px auto 10px auto;
overflow:hidden;
}
ul#stdList li{
letter-spacing:.05em;
color:#0a93cd;
display:block;
float:left;
font:24px arial;
padding:7px 7px;
margin:0px 4px;
text-align:center;
}
ul#stdList li:hover{
border-color:#444;
}
.img-circle {
border-radius: 50%;
}
</style>
HTML:
<ul class="users-list clearfix" id="stdList">
<li>
<img class="img-circle" src="images/std2.jpg" width="125px" alt="Student Image"><br/>
<a class="users-list-name" href="#">Name</a>
<span class="users-list-date">Student Id</span>
</li>
<li>
<img class="img-circle" src="images/std3.jpg" width="125px" alt="Student Image"><br/>
<a class="users-list-name" href="#">Name</a>
<span class="users-list-date">Student Id</span>
</li>
<li>
<img class="img-circle" src="images/std4.jpg" width="125px" alt="Student Image"><br/>
<a class="users-list-name" href="#">Name</a>
<span class="users-list-date">Student Id</span>
</li>
<li>
<img class="img-circle" src="images/std5.jpg" width="125px" alt="Student Image"><br/>
<a class="users-list-name" href="#">Name</a>
<span class="users-list-date">Student Id</span>
</li>
</ul>
Look closely to the position of your while block. You're not looping a single user (the li element), but a whole bunch of code before and after that. Amongst others the general toolbar buttons, and the whole list itself.
I am trying to show Result in search box using ajax and php, everything is working fine but the problem is occurring in displaying the result, it simply breaks the navbar.
this i the nav-bar code
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<div class="col-sm-6 col-md-6">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" onkeyup="showresult(this.value)" name="q" autocomplete='off'>
<div id="livesearch"></div>
<div class="input-group-btn"><button class="btn btn-default"><i class="glyphicon glyphicon-search"></i></button>
</div>
</form>
</div>
<ul class="nav navbar-nav navbar-right">
/*code Reducted */
<li> <span class="glyphicon glyphicon-shopping-cart"></span> Shopping Cart</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
can anyone help me how to display the result as of google
may be i am missing some thing, i am still learning.
So ok i try hard with google and get a answer
#livesearch
{
position: absolute;
width: auto;
background: white;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
max-height: 200px;
overflow-y: auto;
border: 1px solid gray;
/*This is relative to the navbar now*/
left: 0;
right: 0;
top: 40px;
}
this helps me to solve the problem
I am pretty new to Bootstrap and php.
I want my navigation to have a centered brand with logo and the links to different pages left and right next to the logo. Then I want to have social media icons on the top right.
In the mobile view I want a different order of menu items. the brand with logo on the top and the social media at the bottom.
Does this make any sense? Here is my code so far. I have no idea how I can use the navwalker on this custom menu.
<a class = "navbar-brand visible-xs" href = "<?php echo esc_url(home_url()); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/logo.png" alt="logo">" width="50">
</a><!-- /navbar-brand visible-xs -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button> <!-- /navbar-toggle -->
</div> <!-- /navbar-header -->
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right hidden-xs social ">
<li><i class="fa fa-lg fa-facebook"></i></li>
<li><i class="fa fa-lg fa-instagram"></i></li>
<li><i class="fa fa-lg fa-500px"></i></li>
</ul><!-- /hidden-xs social -->
<ul class="nav navbar-nav navbar-center">
<li>HOME</li>
<li>PORTFOLIO</li>
<li class="dropdown hidden-xs"><img id="logo-navbar-middle" src="C:\Users\Carolin_2\Desktop\nicole\logonew.png" width="50"</img></li>
<li>LEISTUNGEN</li>
<li>KONTAKT</li>
</ul><!-- /navbar-nav -->
<ul class="nav navbar-nav navbar-center visible-xs social nav-pills">
<li><i class="fa fa-lg fa-facebook"></i></li>
<li><i class="fa fa-lg fa-instagram"></i></li>
<li><i class="fa fa-lg fa-500px"></i></li>
</ul><!-- /visible-xs social -->
</div> <!-- /navbar-collapse-->
</div><!-- /container fluid-->
CSS Code
/* === NAVBAR ===*/
.navbar{
background-color: black;
margin-bottom: 0;
border: 0;
}
.navbar-inverse .navbar-nav>li>a{
text-align: center;
color: white;
display: inline-block;
float:none;
vertical-align: top;
}
#media (min-width: 768px){
.navbar-nav{
float:none;
margin: 0 auto;
display: table;
table-layout: fixed;
}
}
.navbar .navbar-collapse {
text-align: center;
}
.navbar-inverse .navbar-toggle -.icon-bar{
color: white;
}
Can anybody help me or give me some advice?
Best,
Carolina
I am using a script in my header.php to display how many users are registered (for example it says 79447 PLAYERS), but I want it to say 79,447 players instead. How would I go about adding commas? I've tried a few methods but failed.
<?php
include('session.php');
?>
<style>
.navbar {
font-family: 'Numans', sans-serif;
text-transform: uppercase;
}
.navbar-inverse {
background: #00aa00;
}
.dropdown-menu li a:hover, .dropdown-menu-default li a:hover {
color: #00aa00;
}
.dropdown-menu {
min-width: 100%;
border-radius: 0px;
}
.navbar .navbar-form .form-control-wrapper .form-control, .navbar .navbar-form .form-control {
text-transform: uppercase;
}
.nav>li>a>img {
max-width: 20px;
margin-right: 4px;
}
</style>
<div class="navbar navbar-inverse">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-inverse-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://epicmc.us">EPICMC</a>
</div>
<div class="navbar-collapse collapse navbar-inverse-collapse">
<ul class="nav navbar-nav">
<li>HOME</li>
<?php $remote_api = file_get_contents('http://epicmc.us/api.php?task=total'); $remote_job = json_decode($remote_api); echo '<li>'; echo ''; echo substr($remote_job->amount,0,75); ?> PLAYERS</li>
<li class="dropdown">
</ul>
</li>
</ul>
<form class="navbar-form navbar-left" action ="stats.php" method="GET"><input type="text" name="player" class="form-control col-lg-8" autocomplete="off" placeholder="USERNAME"></form>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">
<img src="https://minepic.org/avatar/20/<?php echo strtoupper($_SESSION['login_user']); ?>">
<?php if(isset($_SESSION['login_user'])){
echo "HOWDY, ";
echo strtoupper($_SESSION['login_user']);
} else {
Echo "HOWDY, GUEST";
}?><b class="caret"></b></a>
<ul class="dropdown-menu">
<?php if(isset($_SESSION['login_user'])){
echo '<li>ACCOUNT</li>';
echo '<li>NOTIFICATIONS <span class="badge">0</span></li>';
echo '<li>LOGOUT</li>';
} else {
echo '<li>LOGIN</li>';
}?>
</ul>
</li>
</ul>
</div>
</div>
From the code snippet it looks like the number of users is in the variable $remote_job->amount
echo number_format($remote_job->amount);
http://php.net/manual/en/function.number-format.php