请注意,我不知道HTML,我正在尝试学习这个。所以说,我有一个页面,我正在为我的女朋友圣诞节做。我想让我在页面右侧的文字更大,并且只扩展300px的数量,以便更改的图片位于其左侧,您无需向下滚动查看全部图片。
<!DOCTYPE html>
<html>
<Head>
<title>Heather I Love You!</title>
</head>
<body style= background-color:#A8A8A8>
<!========This is the header===========>
<div id="header" style= "background-color:#00FF33;" >
<h1><p id="hheader"></p></h1></div>
<!=============The side bar that will allow a list of where she Wants to go==========>
<div align="right"><i><p id="phrases" style="text-height="50" width:300px></p></i></div>
<div id="Menu" Style="background-color:#3A75D4;height:300px;width:125px;float:left;">
<div align="center"><img id="cur_pic" height="400" src="pictures/cake.jpg" /></div>
<button type="button" onclick="ChangeHead()">Next Picture</button><br>
<!--Functions-->
<Script>
function ChangeHead(){
var g = document.getElementById("hheader");
var x = "Heather this is a series of Pictures, Videos, and Poems to show you the love that I have for you!";
var boys = "Here are some pictures of us and the boys";
var cake = document.getElementById("cur_pic");
var fam = "I Love spending the time that we get together, even when I have a Broken foot";
var poems = document.getElementById("phrases");
var cakepoem = "Here are some of my favorite times that I have with you. Doing the date Night is a great time that I really enjoy with you. I cant wait until we can spend a week together in North Carolina, yes we'll be with your mother, but the best part about it will be that we will be together!";
var boyspoem = "Jenner and Watson are a big Part of our life, Jenner says momma I love you and can I have some food?";
var fampoem = "Honey, when I see this picture of you and the kids, well, it shows me all the love that you have for me and the family.";
if (g.innerText == fam) {
g.innerHTML = x;
cake.src = "pictures/cake.jpg"; poems.innerHTML = cakepoem ;
} else if (g.innerText == x) {
g.innerHTML = boys;
cake.src = "pictures/jenner wanting to pee.jpg"; poems.innerHTML = boyspoem;}
else {
g.innerHTML = fam;
cake.src = "The Family and Friends/H_Jules_bre_at_zoo.jpg";poems.innerHTML = fampoem;
}
};
ChangeHead();
</Script>
</body>
</Html>
'
答案 0 :(得分:0)
这应该让你开始:
通过在头部添加style
标记,可以将Css包含在您的代码中:
<style type="text/css">
/* css goes here */
</style>
这是一个糟糕的代码,但它会为你准备好元素。
要学习HTML,请转到此处:http://www.w3schools.com/html/ Css:http://www.w3schools.com/css/default.asp
w3c学校并不是最好的资源,但它拥有大部分的基础知识,对于初学者来说很容易理解。
此外,对于javascript,您只想在需要时动态加载内容。在大多数情况下,您可以将内容粘贴到html中,然后在需要时进行更改。 Javascript非常适合。但是,如果您想要更简单的界面,请查看jquery。
祝你好运!两年前我做了很多这件事。图片浏览器在圣诞节使用我对女朋友的基本理解。现在我是一名专业的php开发人员!