Web Development Questions That Don't Need Their Own Thread v2
3,079 replies, posted
How to make div's moveable in dreamweaver? i can't move div's :(
I'm having a simple but yet annoying problem with my CSS nav. menu. I've set these up hundreds of times, I must be missing something obvious.
If you take a look at:
[url]http://www.meikledesign.co.uk/host/grate/[/url]
The HOME button should be in a "current" state(same as hover). I've set-up the CSS as I usually do, but it just won't apply the current state.
CSS:
[code]
#nav {
display:block;
width:642px;
height:100px;
font-size:20px;
}
#nav ul {
margin:0px;
display:inline;
list-style:none;
text-align:left;
}
#nav li a {
display:block;
float:left;
width:139px;
height:78px;
padding:20px 0px 0px 20px;
text-decoration:none;
color:#FFF;
}
a#home {background-image:url(images/_buttons/home.png); border-right:1px solid #333; border-left:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333; border-radius:5px 0px 0px 5px; -moz-border-radius:5px 0px 0px 5px; -webkit-border-radius:5px 0px 0px 5px;}
a#home:hover , .currentHome {background-image:url(images/_buttons/home_mo.png)}
a#top {background-image:url(images/_buttons/topten.png); border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
a#top:hover , .currentTop {background-image:url(images/_buttons/topten_mo.png); color:#FFF; border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
a#vote {background-image:url(images/_buttons/vote.png); border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
a#vote:hover , .currentVote {background-image:url(images/_buttons/vote_mo.png); color:#FFF; border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
a#forums {background-image:url(images/_buttons/forums.png); border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333; border-radius:0px 5px 5px 0px; -moz-border-radius:0px 5px 5px 0px; -webkit-border-radius:0px 5px 5px 0px;}
a#forums:hover , .currentForums {background-image:url(images/_buttons/forums_mo.png); color:#FFF; border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
[/code]
HTML:
[code]
<div id="nav">
<ul>
<li><a href="#" id="home" title="Home" class="currentHome">Home</a></li>
<li><a href="#" id="top" title="Top 10 Servers">Top 10</a></li>
<li><a href="#" id="vote" title="Vote For Servers">Vote</a></li>
<li><a href="#" id="forums" title="The GRate Forums">Forums</a></li>
</ul>
</div>
[/code]
[QUOTE=Meekal;32819433]I'm having a simple but yet annoying problem with my CSS nav. menu. I've set these up hundreds of times, I must be missing something obvious.
If you take a look at:
[url]http://www.meikledesign.co.uk/host/grate/[/url]
The HOME button should be in a "current" state(same as hover). I've set-up the CSS as I usually do, but it just won't apply the current state.
-code snip-[/QUOTE]
from what I understand of CSS, [B]#nav li a[/B] is much more specific selector than [B].currentHome[/B] alone. I'm pretty sure if you change it to [B]#nav li a.currentHome[/B], you'll get the desired effect:
[css=26,28,30,32]
#nav {
display:block;
width:642px;
height:100px;
font-size:20px;
}
#nav ul {
margin:0px;
display:inline;
list-style:none;
text-align:left;
}
#nav li a {
display:block;
float:left;
width:139px;
height:78px;
padding:20px 0px 0px 20px;
text-decoration:none;
color:#FFF;
}
a#home {background-image:url(images/_buttons/home.png); border-right:1px solid #333; border-left:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333; border-radius:5px 0px 0px 5px; -moz-border-radius:5px 0px 0px 5px; -webkit-border-radius:5px 0px 0px 5px;}
a#home:hover , #nav li a.currentHome {background-image:url(images/_buttons/home_mo.png)}
a#top {background-image:url(images/_buttons/topten.png); border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
a#top:hover , #nav li a.currentTop {background-image:url(images/_buttons/topten_mo.png); color:#FFF; border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
a#vote {background-image:url(images/_buttons/vote.png); border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
a#vote:hover , #nav li a.currentVote {background-image:url(images/_buttons/vote_mo.png); color:#FFF; border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
a#forums {background-image:url(images/_buttons/forums.png); border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333; border-radius:0px 5px 5px 0px; -moz-border-radius:0px 5px 5px 0px; -webkit-border-radius:0px 5px 5px 0px;}
a#forums:hover , #nav li a.currentForums {background-image:url(images/_buttons/forums_mo.png); color:#FFF; border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
[/css]
[editline]16th October 2011[/editline]
Of course I could be wrong
[editline]16th October 2011[/editline]
[url]http://stackoverflow.com/questions/4072365/css-understanding-the-selectors-priority-specificity/4072434#4072434[/url]
yeah I think I'm right
[QUOTE=Ac!dL3ak;32819988]from what I understand of CSS, [B]#nav li a[/B] is much more specific selector than [B].currentHome[/B] alone. I'm pretty sure if you change it to [B]#nav li a.currentHome[/B], you'll get the desired effect:
[css=26,28,30,32]
#nav {
display:block;
width:642px;
height:100px;
font-size:20px;
}
#nav ul {
margin:0px;
display:inline;
list-style:none;
text-align:left;
}
#nav li a {
display:block;
float:left;
width:139px;
height:78px;
padding:20px 0px 0px 20px;
text-decoration:none;
color:#FFF;
}
a#home {background-image:url(images/_buttons/home.png); border-right:1px solid #333; border-left:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333; border-radius:5px 0px 0px 5px; -moz-border-radius:5px 0px 0px 5px; -webkit-border-radius:5px 0px 0px 5px;}
a#home:hover , #nav li a.currentHome {background-image:url(images/_buttons/home_mo.png)}
a#top {background-image:url(images/_buttons/topten.png); border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
a#top:hover , #nav li a.currentTop {background-image:url(images/_buttons/topten_mo.png); color:#FFF; border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
a#vote {background-image:url(images/_buttons/vote.png); border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
a#vote:hover , #nav li a.currentVote {background-image:url(images/_buttons/vote_mo.png); color:#FFF; border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
a#forums {background-image:url(images/_buttons/forums.png); border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333; border-radius:0px 5px 5px 0px; -moz-border-radius:0px 5px 5px 0px; -webkit-border-radius:0px 5px 5px 0px;}
a#forums:hover , #nav li a.currentForums {background-image:url(images/_buttons/forums_mo.png); color:#FFF; border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
[/css]
[editline]16th October 2011[/editline]
Of course I could be wrong
[editline]16th October 2011[/editline]
[url]http://stackoverflow.com/questions/4072365/css-understanding-the-selectors-priority-specificity/4072434#4072434[/url]
yeah I think I'm right[/QUOTE]
Thank you! Zing for you.
[QUOTE=Meekal;32819433]I'm having a simple but yet annoying problem with my CSS nav. menu. I've set these up hundreds of times, I must be missing something obvious.
If you take a look at:
[url]http://www.meikledesign.co.uk/host/grate/[/url]
The HOME button should be in a "current" state(same as hover). I've set-up the CSS as I usually do, but it just won't apply the current state.
CSS:
[code]
#nav {
display:block;
width:642px;
height:100px;
font-size:20px;
}
#nav ul {
margin:0px;
display:inline;
list-style:none;
text-align:left;
}
#nav li a {
display:block;
float:left;
width:139px;
height:78px;
padding:20px 0px 0px 20px;
text-decoration:none;
color:#FFF;
}
a#home {background-image:url(images/_buttons/home.png); border-right:1px solid #333; border-left:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333; border-radius:5px 0px 0px 5px; -moz-border-radius:5px 0px 0px 5px; -webkit-border-radius:5px 0px 0px 5px;}
a#home:hover , .currentHome {background-image:url(images/_buttons/home_mo.png)}
a#top {background-image:url(images/_buttons/topten.png); border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
a#top:hover , .currentTop {background-image:url(images/_buttons/topten_mo.png); color:#FFF; border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
a#vote {background-image:url(images/_buttons/vote.png); border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
a#vote:hover , .currentVote {background-image:url(images/_buttons/vote_mo.png); color:#FFF; border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
a#forums {background-image:url(images/_buttons/forums.png); border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333; border-radius:0px 5px 5px 0px; -moz-border-radius:0px 5px 5px 0px; -webkit-border-radius:0px 5px 5px 0px;}
a#forums:hover , .currentForums {background-image:url(images/_buttons/forums_mo.png); color:#FFF; border-right:1px solid #333; border-top:1px solid #333; border-bottom:1px solid #333}
[/code]
HTML:
[code]
<div id="nav">
<ul>
<li><a href="#" id="home" title="Home" class="currentHome">Home</a></li>
<li><a href="#" id="top" title="Top 10 Servers">Top 10</a></li>
<li><a href="#" id="vote" title="Vote For Servers">Vote</a></li>
<li><a href="#" id="forums" title="The GRate Forums">Forums</a></li>
</ul>
</div>
[/code][/QUOTE]It's your CSS. The definition for the hover state should be:
a#home:hover, a#home.currentHome
not
a#home:hover, .currentHome
[QUOTE=StinkyJoe;32541642]WAMP's Apache comes with mod_rewrite disabled by default. Look for 'LoadModule mod_rewrite.so' or something similar in your apache's httpd.conf file, and uncomment it, then restart WAMP and you're good to go.[/QUOTE]
sorry for the reeallly late reply, and thanks a lot for your help so far!
it doesn't work on my home PC :( everything works fine on USBwebserver at school, i just had to follow your steps and it worked, but at home it keeps failing. WAMP gives a 404 when navigating to a different page, and so does usbwebserver. I can't figure out what's causing this, or I'm just missing something really obvious..
[QUOTE=zzlawlzz;32799427]config file
[php]
$dsn = 'mysql:host='.$config['db']['host'].';dbname='.$config['db']['db'];
$pdo_user = $config['db']['username'];
$pdo_pass = $config['db']['password'];[/php]
The other file
[php] function POSTchanged($type,$data,$dsn,$pdo_user,$pdo_pass) {
$dbh = new PDO($dsn,$pdo_user,$pdo_pass);
if(!empty($data) {
$stmt = $dbh->prepare("SELECT * FROM user WHERE ".$type."=:data");
$stmt->bindParam(':data', $data, PDO::PARAM_STR);
$stmt->execute();
} else {
$stmt = $dbh->prepare("SELECT * FROM user WHERE ".$type."=:data");
$stmt->bindParam(':data', NULL, PDO::PARAM_STR);
$stmt->execute();
}
}
[/php]
Shouldnt this work?[/QUOTE]
:tinfoil:
[editline]17th October 2011[/editline]
My teacher thinks java and JavaScript is same, but I have no idea how to explain it since i don't know java.
How should I explain.
(I said you have to compile java and not JavaScript :v:)
how can I change the file icon for sublime text files? Every time I see that stupid piece of paper with a tiny sublime text logo I rage
-nevermind0
[QUOTE=Sprite;32830918]Can PHP send POST data to a website?
I want to make a page that gets HTML from another website. But the only way I can get the proper HTML that i want is if POST data is sent.
I'm using CURL. don't ask me how this function works, I just use it
[code]
function includeFile($url) { $curl = curl_init();
// Setup headers - I used the same headers from Firefox version 2.0.0.6
// below was split up because php.net said the line was too long. :/
$header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
$header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$header[] = "Cache-Control: max-age=0";
$header[] = "Connection: keep-alive";
$header[] = "Keep-Alive: 300";
$header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$header[] = "Accept-Language: en-us,en;q=0.5";
$header[] = "Pragma: ";
// browsers keep this blank.
$referers = array("google.com", "yahoo.com", "msn.com", "ask.com", "live.com");
$choice = array_rand($referers);
$referer = "http://" . $referers[$choice] . "";
$browsers = array("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008092510 Ubuntu/8.04 (hardy) Firefox/3.0.3", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20060918 Firefox/2.0", "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)");
$choice2 = array_rand($browsers);
$browser = $browsers[$choice2];
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, $browser);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_REFERER, $referer);
curl_setopt($curl, CURLOPT_AUTOREFERER, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
curl_setopt($curl, CURLOPT_MAXREDIRS, 7);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
$data = curl_exec($curl);
if ($data === false) {
$data = curl_error($curl);
}
// execute the curl command
curl_close($curl);
// close the connection
return $data;
// and finally, return $html
}
[/code][/QUOTE]
Set the action of the post form to the url of the website you want it to be send to, and it should, maybe, not so sure, work.
Had an issue for ages and I couldn't figure it out. Anyway, whilst driving home from college I thought of the answer! God knows why it came to me then, but it just did!
Anyway the code which solved my problem was;
[CODE]$(document).ready(function(){
$('#Welcome').fadeIn(600);
});[/CODE]
Could someone show me how I'm supposed to put this together? Its a SRCDS server query script. I'm new to PHP. I've tried to put it together but it's not working.
[code]
/* SOURCE ENGINE QUERY FUNCTION, requires the server ip:port */
function source_query($ip){
$cut = explode(":", $ip);
$HL2_address = $cut[0];
$HL2_port = $cut[1];
$HL2_command = "\377\377\377\377TSource Engine Query\0";
$HL2_socket = fsockopen("udp://".$HL2_address, $HL2_port, $errno, $errstr,3);
fwrite($HL2_socket, $HL2_command);
$JunkHead = fread($HL2_socket,4);
$CheckStatus = socket_get_status($HL2_socket);
if($CheckStatus["unread_bytes"] == 0)return 0;
$do = 1;
while($do){
$str = fread($HL2_socket,1);
$HL2_stats.= $str;
$status = socket_get_status($HL2_socket);
if($status["unread_bytes"] == 0){
$do = 0;
}
}
fclose($HL2_socket);
$x = 0;
while ($x <= strlen($HL2_stats)){
$x++;
$result.= substr($HL2_stats, $x, 1);
}
// ord ( string $string );
$result = str_split($result);
$info['network'] = ord($result[0]);$char = 1;
while(ord($result[$char]) != "%00"){$info['name'] .= $result[$char];$char++;}$char++;
while(ord($result[$char]) != "%00"){$info['map'] .= $result[$char];$char++;}$char++;
while(ord($result[$char]) != "%00"){$info['dir'] .= $result[$char];$char++;}$char++;
while(ord($result[$char]) != "%00"){$info['description'] .= $result[$char];$char++;}$char++;
$info['appid'] = ord($result[$char].$result[($char+1)]);$char += 2;
$info['players'] = ord($result[$char]);$char++;
$info['max'] = ord($result[$char]);$char++;
$info['bots'] = ord($result[$char]);$char++;
$info['dedicated'] = ord($result[$char]);$char++;
$info['os'] = chr(ord($result[$char]));$char++;
$info['password'] = ord($result[$char]);$char++;
$info['secure'] = ord($result[$char]);$char++;
while(ord($result[$char]) != "%00"){$info['version'] .= $result[$char];$char++;}
return $info;
}
[/code]
[code]
if( !function_exists('str_split') ){
function str_split($string, $split_length=1){
$array = array();
$len = strlen($string);
do{
$part = '';
for ($j = 0; $j < $split_length; $j++){
$part .= $string{$i};
$i++;
}
$array[] = $part;
}
while ($i < $len);
return $array;
}
}
[/code]
[code]
$q = source_query('202.89.33.158:27016');
echo "network: ".$q['network']."<br/>";
echo "name: ".$q['name']."<br/>";
echo "map: ".$q['map']."<br/>";
echo "dir: ".$q['dir']."<br/>";
echo "desc: ".$q['description']."<br/>";
echo "id: ".$q['appid']."<br/>";
echo "players: ".$q['players']."<br/>";
echo "max: ".$q['max']."<br/>";
echo "bots: ".$q['bots']."<br/>";
[/code]
Need some help with videos. I'm making my first website just as a small personal thing.
I have a videos page where I put up videos that I make, and I'm wondering what is the best way to do this. I have just embedded the videos off of YouTube, but I was thinking of having it sort of like,
the latest video is displayed at the top, and older releases are showed in rows of 3 beneath it, but I can't get the middle video to correctly display in the middle without fucking up the third video.
How can I fix this?
[QUOTE=Over-Run;32832824]Need some help with videos. I'm making my first website just as a small personal thing.
I have a videos page where I put up videos that I make, and I'm wondering what is the best way to do this. I have just embedded the videos off of YouTube, but I was thinking of having it sort of like,
the latest video is displayed at the top, and older releases are showed in rows of 3 beneath it, but I can't get the middle video to correctly display in the middle without fucking up the third video.
How can I fix this?[/QUOTE]
It depends all on your css. Posting the template would help.
[QUOTE=Over-Run;32833045]Hah CSS, I'm really not that far into it yet, I'm just going through all the tutorials on W3Schools, but I'll post the code. Let me know what I should be fixing up.
[/QUOTE]
I'm pretty sure even w3schools advises not to use tables but rather css.
Learn css, it's pretty easy after you take a look at some templates, it will most likely fix your centering issue too.
[QUOTE=mobrockers2;32833137]I'm pretty sure even w3schools advises not to use tables but rather css.
Learn css, it's pretty easy after you take a look at some templates, it will most likely fix your centering issue too.[/QUOTE]
Ah, well I will look at the tutorials on W3 and see if I can learn it a bit more, since I only know basics. Anybody here have any tips or anything on how I could get the header image in the CSS file and all? And get it displayed for every new link
[QUOTE=Over-Run;32833045]stuff[/QUOTE]
tables make your website load very sssssssllllllllllllllloooooooooooooowwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
use divs and spans
for css IDs are shown with #
and CLASSes are shown with .
ie
<div id="blah" /> would be div#blah
and <div class="blah" /> would be div.blah
I sort of understand you, could you use an example from the code I have which could help me understand it a bit more?
[QUOTE=Over-Run;32833596]I sort of understand you, could you use an example from the code I have which could help me understand it a bit more?[/QUOTE]
Instead of <p align=center> you'd have for example <div id="videos"> in your html, and in your css you'd have: #videos { width: 800px; margin: 0, auto, 0, auto; }
This would set the width of your videos section to 800px, and would center them because the auto means that it automatically calculates the left and right margin and evenly distributes it on both sides.
Great that's starting to make sense now, I did it to the videos though and now the 3 at the bottom that I wanted side by side horizontally are all aligned to the left and stacked vertically.
[QUOTE=Over-Run;32834634]Great that's starting to make sense now, I did it to the videos though and now the 3 at the bottom that I wanted side by side horizontally are all aligned to the left and stacked vertically.[/QUOTE]
That's because of the width probably, make it wider and it should fit.
No lucky I put width up to 8000 and nothing happened looked the same!
I'm pretty sure we have
[html]<!DOCTYPE html>
<html>
<head></head>
<body>
<h1>Hello World</h1>
</body>
</html>[/html]
[css]body { color:black; }[/css]
[php]
<?php
sleep(6);
?>[/php]
yup
[editline]heh[/editline]
plus, you can do this!
[php=3]
<?php
sleep(6);
?>
[/php]
[QUOTE=Over-Run;32835493]No lucky I put width up to 8000 and nothing happened looked the same![/QUOTE]
Might be because of the iframes, I don't know how iframes work.
Is there a search engine that searches forums?
not that searches for discussions int he forums. but just contains a huge... ... ... ...
googlin: "forum index"
nevermind
"http://www.theforumfinder.org/"
[editline]18th October 2011[/editline]
I need a stupid fast browser that isn't chrome or firefox
It needs to be STUPID STUPID fast.
Like i need this browser to have nothing outside of display and cookies. no favoriting, no tracking, just raw speed.
any has?
[QUOTE=Sprite;32835716]I need a stupid fast browser that isn't chrome or firefox
It needs to be STUPID STUPID fast.
Like i need this browser to have nothing outside of display and cookies. no favoriting, no tracking, just raw speed.
any has?[/QUOTE]
[url]http://sparkbrowser.com/[/url]
[QUOTE=Notebook;32836590][url]http://sparkbrowser.com/[/url][/QUOTE]
I remember that.
:wink:
[QUOTE=Sprite;32835716]
I need a stupid fast browser that isn't chrome or firefox
It needs to be STUPID STUPID fast.
Like i need this browser to have nothing outside of display and cookies. no favoriting, no tracking, just raw speed.
any has?[/QUOTE]
Safari
[editline]18th October 2011[/editline]
You can use session to store data that can be used on functions :v:
Gonna try Google this at the moment, but does anyone know of a good website template which is like fmylife.com? Basically, just a REALLY simple system where you post stuff, and people either give it a thumbs up or a thumbs down, and that's it.
Sorry, you need to Log In to post a reply to this thread.