CSS如何在固定位置导航栏

时间:2016-11-06 00:41:04

标签: css navigation navbar

我有一个固定位置的导航栏。 导航栏的高度为50px

我想在导航栏下放一些文字,但我不知道如何。

2 个答案:

答案 0 :(得分:1)

在你的css flie中添加这一行:

body { padding-top: 50px; }

或:

.some-text { padding-top: 50px; }

答案 1 :(得分:1)



<?php

$users = [
    ['tipoinsertom' => 'Jonatan'],
    ['tipoinsertom' => 'jeff'],
    ['tipoinsertom' => 'joe'],
];

?>

<form method="POST">

<?php foreach($users as $user): ?>
    <input type="checkbox" name="tipoinsertos[]" value="<?= $user['tipoinsertom']; ?>"> <?= $user['tipoinsertom']; ?> 
<?php endforeach; ?>

    <input type="submit" value="Submit"/>
</form>

<?php

// returns an intance of PDO
// https://github.com/jpuck/qdbp
$dbh = require __DIR__.'/tipoin_Dxa05i_A.pdo.php';


if( !empty( $_POST['tipoinsertos'] ) ){
    // prepare the query once
    $query = "INSERT INTO barrasinternas (tipoinsertos ) VALUES (:tipoinsertos )";
    $sth = $dbh->prepare($query);

    // iterate through list
    foreach($_POST['tipoinsertos'] as $tipoinsertos){
        $sth->execute(['tipoinsertos' => $tipoinsertos]);
    }

    // success
    echo "&iexcl;A&ntilde;adida Exitosamente!";
    $dbh = null;
}
&#13;
.navbar {
  position: fixed;
  height:50px;
  width:100%;
  background: #333;
}
.contents-under {
  padding-top: 50px;
}
&#13;
&#13;
&#13;