PHP - Remove Padding From Navbar Ul Css
Hey guys, I am working on something and keep getting some padding on my css navabar, its pretty simple but I cant figure out where it grabbing the padding from pushing it about 5 pixels to the right.
jsfiddle live preview is a demo and here is a picture of the hover over. Notice the little gray space in between the hovered over Update Profile? I cant seem to find the code anywhere that would cause that. Anyone notice anything in my code? <head> <title>2 Column CSS Layout</title> <style type="text/css"> body { margin: 20px; font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; background-color: #555; } #nav { text-align:center; } /* Begin Navigation Bar Styling */ #nav ul { text-align: center; font-size: 11px; width: 100%; margin: 0; padding: 0; display:inline-block; padding: 0; list-style: none; background-color: #f2f2f2; border-bottom: 1px solid #ccc; border-top: 1px solid #ccc; } #nav li { display:inline-block; } #nav li a { display: block; padding: 8px 15px; text-decoration: none; font-weight: bold; color: #069; border-right: 1px solid #ccc; } #nav li a:hover { color: #c00; background-color: #fff; } /* End navigation bar styling. */ div { text-align:center; } div#page { background-color: white; margin: 0 auto; text-align: left; width: 755px; padding:0px 10px 0 10px; } div#header { border-bottom:1px solid black; height: 30px; line-height: 30px; } div#content { background: none repeat scroll 0 0 none; border:0px solid blue; width:100%; line-height: 500px; min-height:500px; _height:500px } div#footer { border:0px solid red; height:30px; line-height: 30px; border-top:1px solid black; font-size: 9pt; } </style> <body> <div id="page"> <div id="header"> <div style="float: left;">Welcome Admin</div> <div style="float: right;">LOGOUT</div> <div id="nav"> <ul id="nav"> <li><a href="#">Home Page</a></li> <li><a href="#">My Account</a></li> <li><a href="#">Update Profile</a></li> <li><a href="#">Change Avatar</a></li> <li><a href="#">Change Password</a></li> <li><a href="#">Support</a></li> </ul> </div> </div> <div id="content">Content</div> <div id="footer"><div style="float: right;">copyright 2014</div></div> </div> </body> Similar TutorialsFirst problem fixed. My second problem is if the result is 0X.XX,0 or 0X.XX,1 I would like to remove the first 0 The X.XX are numbers, but the 0 is not always there. Can anyone help please Thanks Hello everybody, I have a problem with my site I am making.
http://gmann.gflclan.com/index.php (this is a test site, I am not even near close to being done with it).
The problem I am having is, when I make my browser smaller, the navbar body doesn't move down (expand).
#navbar { width:auto; height: 5%; position:relative; background:url(images/transbg4.png); border-radius:15px 15px 0px 0px; box-shadow: 5px 5px 10px #121212; margin-left: 30%; margin-right: 30%; color: white; text-align: left; }There's the code. I think it has to do with "height: 5%;". Do you guys have any idea on how to fix this. I am learning coding, and sorry if this is a "noob" question. Also, if you want, feel free to give suggestions for the site, I already know it looks horrible but I plan on making it better in the future. Here is the navbar in the PHP file I made: <div id="navbar"> <ul id="nav_links"> <?php $query = "SELECT * FROM `navlist` ORDER BY `lorder` ASC"; $result = mysqli_query($db, $query) or die ('Error with the nav list query! Error: ' . mysqli_error($db)); while ($nav = mysqli_fetch_assoc($result)) { echo '<div class="navlink">'; $target = ''; if($nav['newpage'] == 1) { $target = 'target=_blank'; } else { $target = ''; } echo '<li class="nav_button"><a href="' . $nav['link'] . '" ' . $target . '>' . $nav['name'] . '</a></li>'; echo '</div>'; } ?> </ul> </div>Thanks, Gamemann Hey guys, I am having trouble centering a navbar with css on my template.
Here is a jsfiddle live preview for you.
http://jsfiddle.net/LRS38/
I added text-align:center; to it but it still wont center. I also added a margin:0 auto; but no luck.
Can anyone see what I am doing wrong?
<div id="navigation"> <ul> <li><a href="#">Home</a></li> <li><a href="#">About</a></li> <li class="current"><a href="#">Services</a></li> <li><a href="#">Contact us</a></li> </ul> </div>and #navigation { text-align:center; background-color:#ef6b51; overflow:hidden; } Here is my code:
for($i = 1; $i <= 30; $i++){ $pos1 = mt_rand(1,900); $pos2 = mt_rand(1,100); echo '<div class="itemLootBox Unique fadeIn" onclick="lootItem(this)" style="position:absolute;left:'.$pos1.'px;top:'.$pos2.'px">Lunar Rock</div>'; }The dimensions of that container is: Width: 980px Height: 130px. These correspond with $pos1 and $pos2 respectively. I reduced 980 to 900 for the mt_rand because the boxes look weird when they get positioned to the edge. And my problem is, the divs are being randomly generated, but sometimes overlap others. Is there a way to add a function / if statement so I can check against $pos1, and $pos2 to add spacing so the boxes will never overlap? (They don't have to never overlap, but some type of padding would be way better). Edit: Try to think of it as a grid like system, and each rectangle has it's own box of it's 'own' if you will. Wheres there is a padding around each grid. Not sure how to do this Edited by Monkuar, 07 December 2014 - 12:41 AM. i need to make it so it removes the \ like this <iframe src=\"http://www.rockstargames.com/videos/embed/8001\" width=\"640\" height=\"360\" frameBorder=\"0\" scrolling=\"no\"></iframe> Hi All, I'm sure there is an easy solution for this but I am unable to find it. I am new to PHP and after a little help... the via data is stored in a database in this format... |51.105166,-1.695971|51.011055,-2.1068|50.945233,-2.617664|||| I'm trying to find a way of loosing the last comma if there are 1 or more entries, any ideas guys. What I'm getting is : Code: [Select] var points = [{location: '51.105166,-1.695971'},{location: '51.105166,-1.695971'},]; What I'm after is: Code: [Select] var points = [{location: '51.105166,-1.695971'},{location: '51.105166,-1.695971'}]; Code: [Select] <?php if($via != null){ echo "var points = ["; foreach($via as $point){ if($point != ""){ echo "{location:"; echo " '".$point."'"; echo "},"; } } echo "];\n"; } ?> I'm currently have this code (part of code):
if (strlen($trimmed['title']) > 3 && strlen($trimmed['title']) < 200) { $title = mysqli_real_escape_string($dbc, $trimmed['title']); } else { echo '<div class="alert alert-danger" id="alerta3"> <button type="button" class="close" data-dismiss="alert">×</button> <center><p>Error</p></center> </div>'; $errors=true; } if (strlen($trimmed['description']) > 3 && strlen($trimmed['description']) < 4000) { $description = mysqli_real_escape_string($dbc, $trimmed['description']); } else { echo '<div class="alert alert-danger" id="alerta4"> <button type="button" class="close" data-dismiss="alert">×</button> <center><p>Error</p></center> </div>'; $errors=true; }What should i modify to avoid texts with /n/r? Thanks This is probably very obvious but i gots stuck. I want to to display a list of the members then you select the member and it deletes the member. I do not get a message saying it failed, it just doesn't delete the member. Removemember.php: Code: [Select] <form action='removemember_complete.php' method='POST'> <label>Name:</label> <select name="memberid"> <?php $con = mysql_connect("localhost","slay2day_User","slay2day"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("slay2day_database",$con); $sqlquery="SELECT * FROM `members` Order By name"; $result=mysql_query($sqlquery,$con); while($row=mysql_fetch_array($result)) { echo "<option value='".$row['id']."'>".$row['name']."</option>"; } ?> </select> <br> <input type="submit" value="Remove" /> </form> removemember_complete.php: Code: [Select] <?php $name=$_POST['name']; $con = mysql_connect("localhost","slay2day_User","slay2day"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("slay2day_database",$con); $sql="DELETE FROM members WHERE name = '$name'"; if(mysql_query($sql,$con)) { echo 'Member Removed.<br /><a href="../index.php">Return To Points List</a><br /><a href="removemember.php">Remove More Members</a>'; } else { die('Could not submit: ' . mysql_error()); } mysql_close($con); ?> Thanks in advance. Im trying to rermove ' symbol from a string. Code: [Select] $string2 = str_replace(" ' ", " . ", $string1); give errors How else could i do this? hi phpfreaks I am trying to remove the get variables from my url. the code below works if I echo it out but to try to modify the $_server variable it will not work. Any ideas? Code: [Select] $current_url = explode('?',$_SERVER["REQUEST_URI"]); $_SERVER["REQUEST_URI"]= $current_url[0]; echo $current_url[0]."<br>"; I need permanent redirect. Example url: example.com/something/more/more/1 I always have /something/, so it would be awsome if you could remove /1 only from urls where are /something/ for first path argument. There can be any number of different url segments in between /something/ and /1, those should be kept there, just /1 should be removed. So the redirect path of the example url should be example.com/something/more/more How can I do this? Not sure if this is possible. What I am trying to do is remove a section of text a user posts. ie: go to this url: http://url.com or http://this.domain.org I already have it to strip they <a href="whatever but not sure if I can do the other. Any help would be appreciated. Thanks Hi guys, I need your help. I am using the code below to send email via using with php, however, I can't be able to remove the mailed-by hostname which is something like: server01.domain.com. Here's the screenshot: Here's the code: if(isset($name)) { $name = $_GET['name']; $headers = "From: "-f .$name."@myemail.com"; $to = "myname@myemail.com"; $subject = $type; $message = $comments . ' ' . $rate; $header = "From: Your Name <tester@email.org>\l\n"; $header .= "Reply-To: no answer <myname@myemail.com>\l\n"; $header .= "Return-Path: tester@email.org\l\n"; $header .= "Envelope-from: tester@email.org\l\n"; $header .= "MIME-Version: 1.0\l\n"; $header .= "Content-Type: text/html\l\n"; mail($to, "test", "hello,how r u today? I'm a Noobie", $header); echo "Thank you for sent us your feedback"; When I use the code on above, the mailed-by hostname did not get removed. I want to remove it so I can send email to my clients for update email newsletters, registering form...etc Anyone who know how to remove the mailed-by hostname would be much appreciate. Thanks, Mark Please can someone advise how I remove the | characters from a string? I tried the following but get errors that... Warning: preg_replace() [function.preg-replace]: No ending delimiter '|' Code: [Select] $value = preg_replace("|", "", $value); I'm a noob, tring to reverse engineer some current code. This code is grabbing the current URL: <?php function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } ?> This form is adding "&limit=50" to the URL, to show 25, 50 or 100 results per page: Code: [Select] <form> <select name="link"> <option <? echo "$select25" ?> value="<? echo curPageURL(); ?>&limit=25">25 records per page</option> <option <? echo "$select50" ?> value="<? echo curPageURL(); ?>&limit=50">50 records per page</option> <option <? echo "$select100" ?> value="<? echo curPageURL(); ?>&limit=100">100 records per page</option> </select> </form> The problem is here (I think). This is supposed to flush the old limit before requesting a new one... but right now, I'm getting another one tacked on with each new request: www.website.com/members?sub[]=math&sub[]=science&lev[]=middleschool&limit=25 www.website.com/members?sub[]=math&sub[]=science&lev[]=middleschool&limit=25&limit=50 www.website.com/members?sub[]=math&sub[]=science&lev[]=middleschool&limit=25&limit=50&limit=100 <?php //remove any old limit from query $tmp = array(); foreach ($_GET as $fld => $val) if ($fld != 'limit') $tmp[] = $fld . '=' . $val; $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"] . '?' . implode('&',$tmp); ?> Any ideas? Thanks. ~Wayne This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=328353.0 Hey, i got this code which takes info from mysql: while ($row= mysql_fetch_array($result)) { $title = $row["alertid"]; $title2 = $row["alerttext"]; $title3 = $row["alertdate"]; $bla = "{\"alertid\":\"$title\",\"alerttext\":\"$title2\",\"alertdate\":\"$title3\"},"; echo "$bla"; } it is displayed like this: [{"alertid":"1","alerttext":"text1","alertdate":"date1"},{"alertid":"2","alerttext":"text2","alertdate":"date2"},{"alertid":"3","alerttext":"text3","alertdate":"date3"},] I wanted to ask, how can I remove the last comma, after date3"}, but keep other commas..? My current code (which works): Code: [Select] <?php $body = explode("\n", $body); $body = array_slice($body, 3); $body = implode("\n", $body); ?> Is there a better way of doing this, so I dont have to explode and implode an array just to accomplish this? This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=325974.0 Anyone know how i can remove a querystring from url. Example URL: http://www.mysite.com/?id=1 I am writing a script that needs to read in the ID from the URL. But once have got the information i would like to remove it from the URL and just display http://www.mysite.com but still be able to use the ID to query my database. Any ideas??? |