CSS代码文字段落设置

html-css018

CSS代码文字段落设置,第1张

解决:

这样就好了。

Css

<style type="text/css">

.one{

font-size:10px

color:#FF0000

font-weight:bold

}

.two{

font-size:18px

color:#00FF00

text-decoration:underline

}

.three{

font-size:18px

color:#0000FF

text-decoration:overline

}

</style>

Html

<p class="one">加油、努力</p>

<p class="two">加油、努力</p>

<p class="three">加油、努力</p>

呵呵。

首先这种段落用<p>更合理,而不是用<h2>

然后,你行内样式文字居中对齐了,上面两行差不多长能对齐,最下面一行短这么多,当然对不齐。

text-align:center的center改成left

给你举个例子:

<script language="javascript">

function show_div(){

var obj_div=document.getElementById("starlist")

obj_div.style.display=(obj_div.style.display=='none')?'block':'none'

}

function hide_div(){

var obj_div=document.getElementById("starlist")

obj_div.style.display=(obj_div.style.display=='none')?'block':'none'

}

</script>

<a href="javascript:show_div()" >显示/展开</a>

<div id="starlist">

内容<br/>

内容<br/>

内容<br/>

内容<br/>

</div>

这样就可以实现

追问

用jQuery实现,该怎么实现?就是不能弹出的那种,就要一个点击了之后就在下方显示的那种,谢谢!

回答

<!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/htmlcharset=gbk" />

<title>StripingTable</title>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

<script type="text/javascript">

<!--

$(document).ready(function(){ })

function changeDisplay(){

var helloDivObj = $("#helloDiv")

var buttonObj = $("#btnDisplay")

var val = buttonObj.attr("value")

if(val=="隐藏"){

helloDivObj.hide()

buttonObj.attr("value","显示")

}else{

helloDivObj.show()

buttonObj.attr("value","隐藏")

}

}

-->

</script>

</head>

<body>

<input id="btnDisplay" type="button" value="隐藏" onclick="changeDisplay()"/>

<div id="helloDiv">

Hello,everyone<p></p>

Hello,everytwo<p></p>

Hello,everythree<p></p>

</div>

</bdoy>

</html>