这是我的HTML代码,我想将文本“ GIMME YOUR NAME”更改为白色。
我需要使用什么CSS选择器来更改此文本颜色。
class
这是我尝试过的
struct travelInfo
{
double miles, liters;
double mpg() const;
void getUserInput(const string &prompt);
void displayResult(const string &name) const;
};
void userInstruction(travelInfo &car1, travelInfo &car2);
void displayResult(const travelInfo &car1, const travelInfo &car2);
int main()
{
travelInfo car1, car2;
char keepGoing;
do
{
userInstruction(car1, car2);
displayResult(car1, car2);
//Allows for repeating
cout << "Do you wish to keep going? (y/n) \n";
cin >> keepGoing;
}
while (keepGoing == 'y' || keepGoing == 'Y');
system("pause");
return 0;
}
static const double LPG = 0.264179;
double travelInfo::mpg() const
{
return miles / (liters * LPG);
}
void travelInfo::getUserInput(const string &prompt)
{
cout << prompt << " \n" << endl;
cin >> liters;
cin >> miles;
}
void travelInfo::displayResult(const string &name) const
{
cout << name << " used: " << liters << " liters of fuel \n";
cout << name << " drove: " << miles << " miles \n";
cout << name << " gets: " << mpg() << " miles per gallon \n";
}
void userInstruction(travelInfo &car1, travelInfo &car2)
{
car1.getUserInput("Please enter the liters of gasoline consumed as well as the miles travelled for Car 1.");
cout << endl << endl;
car2.getUserInput("Do the same for Car 2.");
}
void displayResult(const travelInfo &car1, const travelInfo &car2)
{
double mpg1 = car1.mpg(), mpg2 = car2.mpg();
car1.displayResult("Car 1");
cout << endl;
car2.displayResult("Car 2");
cout << endl;
if (mpg1 == mpg2)
{
cout << "Both cars have the same fuel efficiency. \n" << endl;
}
else if (mpg1 > mpg2)
{
cout << "Car 1 has better fuel efficiency. \n" << endl;
}
else
{
cout << "Car 2 has better fuel efficency. \n" << endl;
}
}
答案 0 :(得分:1)
它不是.input
而是input
,因为点选择器.
选择类而不是元素。
所以您的代码如下:
input[type=text]{
color:white}