小编Sud*_*man的帖子

如何将页面内容拉伸并将页脚粘贴到页面底部?

我一直试图让这个我该死的布局工作了很长时间,而且它的超级fr.我是CSS的新手,所以请轻松一点,但我查了很多关于粘性页脚和拉伸内容等的文章等,我仍然无法让它工作.最小高度对我没什么用!

这是我希望我的网站在没有足够内容填充页面时的样子.

当内容让你滚动时,这就是我想要的样子.

这是html代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome to SilmanServer!</title>
<link href="./main.css" rel="stylesheet" type="text/css" />

</head>

<body>

<div id="pageHeader"> 
<h1>SilmanServer</h1>
<p>Aaron Silman's Personal Home Server </p>
</div>

<div id="navigation">
    <ul>
        <li><a href="./index.html">Home</a></li>
        <li><a href="./blog.html">Blog</a></li>
        <li><a href="./projects.html">Projects</a></li>
        <li><a href="./about.html">About Me</a></li>
        <li><a href="./contact.html">Contact</a></li>
    </ul>
</div>


<div id="main">

<div>
<h2>What the hell?</h2>
    <p>
    This the project I embarked on around June of 2012 with an old computer that I had …
Run Code Online (Sandbox Code Playgroud)

css height layout footer sticky-footer

0
推荐指数
1
解决办法
7751
查看次数

为什么我的countlines函数总是返回0?

所以我正在为一个简单的日历应用程序创建一个程序,该应用程序从input.csv文件中读取输入(它是一个带有两列的文本文件,使用逗号和每个命令的新行分隔).

我想要做的第一件事是计算输入文件中的行数,它作为命令行中的第三个参数传递,所以我可以创建一个数组来分别保存每一行,但函数countLines总是返回0!

项目代码:

#include<iostream>
#include<string>
#include<fstream>
using namespace std;


//Prototypes
int countLines (ifstream& countfiles);


int countLines(ifstream& countfile)
//counts number of lines in file passed to function
{
   string line;
   int numberOfLines;

   numberOfLines = 0;

   //reads through each line until end of file
   while(getline(countfile, line))
   {
       numberOfLines++;
   }

   return numberOfLines;
}


int main (int argc, char* argv[])
{

    if(argc != 3) cout << "Usage: calendar.out datafile inputfile";

    //Create input streams to both files
    ifstream apptsfp;
    ifstream inputfp;

    //Open streams to both …
Run Code Online (Sandbox Code Playgroud)

c++

0
推荐指数
1
解决办法
163
查看次数

我不太明白为什么我得到关于矢量的这个错误

我的程序有两个输入文件,其中一个是命令列表.该文件的每一行都是一个新命令,所以我想将这个文件解析成一个数组.我被告知在动态增长时使用向量,这样就不需要函数来计算文件中的行数,然后使用该数据来创建数组.

以下是我的程序:

#include<iostream>
#include<string>
#include<fstream>
#include<vector>
using namespace std;


//Prototypes
int parseLines(ifstream& countfile);


vector<string> parseLines(ifstream& countfile)
//counts number of lines in file passed to function
{
   string line;
   vector<string> lines;
   int numberOfLines;

   //reads through each line until end of file putting each line in a sperate entry of the vector
   while(getline(countfile, line))
   {
       lines.push_back(line);
   }

   return lines;
}


int main (int argc, char* argv[])
{

        int i;

    if(argc != 3) cout << "Usage: calendar.out datafile inputfile";

    //Create input streams to …
Run Code Online (Sandbox Code Playgroud)

c++

-1
推荐指数
1
解决办法
2600
查看次数

标签 统计

c++ ×2

css ×1

footer ×1

height ×1

layout ×1

sticky-footer ×1