導航:首頁 > 萬維百科 > 網頁設計中如何放大文字

網頁設計中如何放大文字

發布時間:2021-02-27 04:01:30

1、dreamwear網頁設計怎麼吧字體放大


把<!--  -->去掉這個表html注釋代碼,不被執行的,所以你寫在裡面的代碼沒執行,字體大小改動對呀類名下的font-size:字型大小,就好了!

2、製作html網頁,放大文字。用簡單易懂的方式,新手求教,謝謝

難點在於點擊前如何獲取當前字體大小,這樣才能在此基礎上通過數學加法來放大,示例如下(按一次放大,字型大小 +4px)

<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="utf-8">
<title>獲取文字大小</title>
<style>
body {font:normal 16px/1.8 tahoma;}
#textWrap {width:600px; margin:60px auto;}
</style>
</head>
<body>
<input type="button" value="放大文字" onclick="zoomInFontSize()">  
    <div id="textWrap">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt error labore, dolorum voluptatum doloremque omnis dolorem nemo porro beatae, incint.
    </div>
    <script>
function zoomInFontSize() {
var obj = document.getElementById('textWrap'),
curSize = '';  // 當前字體大小

// 創建一個容器,來測算當前字體大小
var getFontSize = function() {
var oDiv = document.createElement('div');
oDiv.innerHTML = 'ABC測試';  // 寫入任意字元
oDiv.style.lineHeight = 1;
oDiv.style.position = 'absolute';
oDiv.style.top = '-9999em';
document.body.appendChild(oDiv);
return oDiv.offsetHeight;
};

if (obj.style.fontSize == '') {
curSize = getFontSize();
} else {
curSize = parseInt(obj.style.fontSize, 10);
}

curSize += 4;
if (curSize > 100) {
alert('不能再大了');
} else {
obj.style.fontSize = curSize + 'px';
}
}
    </script>
</body>
</html>

3、網頁製作高手請進在網頁中怎樣讓小圖片點擊以後放大(

不是高手只會簡單的,像我這樣js只會一點的,可以想到如下辦法:

直接css做,一張小圖片一張大圖片,當滑鼠過去的時候小圖片換大圖片

js做,寫一個onclick事件,點擊的時候改變圖片的width,height屬性就是了

直接在網上去找高手們分享的js插件,稍微修改一下就可以運用在自己的網頁了

4、中文網頁製作中的加粗加大的字體有哪些?

自己下載文鼎字型檔和方正字型檔在裡面找
這是最常用的字型檔~

5、有誰可以告訴我web網頁製作中通過三個按鈕控制頁面上的一段文字放大,縮小,恢復到原始大小的代碼?

先下載jquery-1.2.6.pack.js,包含到文件中

<div class="fsize">
<h3><em>Enlarge</em><span>Font-size:12px</span><strong>Small</strong></h3>
<div>
<p>

Andy Moor – Fake Awake (Eco mix) (Anjunabeats)
Humate – Love Stimulation (Glenn Morrison & Bruce Aisher mix) (Poker Flat

</p>
</div>
</div>

<div class="fsize">
<h3><em>Enlarge</em><span>Font-size:12px</span><strong>Small</strong></h3>
<div>
<p>

Andy Moor – Fake Awake (Eco mix) (Anjunabeats)
Humate – Love Stimulation (Glenn Morrison & Bruce Aisher mix) (Poker Flat

</p>
</div>
</div>

樣式CSS:

.fsize{ border:1px solid #444; margin:10px; height:auto;}
.fsize div p{ line-height:1.5em; padding:10px;}
.fsize h3{ font-size:12px; font-weight:500; height:24px; text-align:right; padding:0 10px; line-height:24px; background:#f0f0f0; display:block;}
.fsize h3 em,
.fsize h3 strong{ font-weight:500; color:#c00; font-style:normal; cursor:pointer;}
.fsize h3 em,
.fsize h3 span{ float:left; margin-right:6px; text-align:left;}

腳本JS:

<!--先要鏈接上JQ庫 我們這個例子是基於Jquery的-->

<script type="text/javascript" src="jquery-1.2.6.pack.js"></script>

下面是腳本:

$(document).ready(function(){
//字體變大 class為.fsize 的h3 下的 em 元素被點擊時:
$(".fsize h3").find("em").click(function(){

//算出h3 下面的 div 中的 p 的字型大小
var size=parseInt( $(this).parent().next("div").find("p").css("font-size"),10);

//最大為22號字
if(size<22)
{

//字型大小累加2
size+=2;

//用h3中的span 標簽顯示當前字型大小
$(this).next("span").html("Font-size:"+size+"px");

//重新定義調整過的字型大小
$(this).parent().next("div").find("p").css({"font-size":size+"px"});
}else
{

//大於22號時提示這已經是最大了
$(this).next("span").html("This is the MAX font-size already!");
}
})
//字體變小原理與變大基本相同 注意size 應該是局部變數每次都要算
$(".fsize h3").find("strong").click(function(){
var size=parseInt( $(this).parent().next("div").find("p").css("font-size"),10);

//最小為12

if(size>12)
{
size-=2;
$(this).prev("span").html("Font-size:"+size+"px");
$(this).parent().next("div").find("p").css({"font-size":size+"px"})
}else
{

//提示當前已經是最小
$(this).prev("span").html("This is the MIN font-size already!");
}
})
//離開時仍然顯示字型大小
$(".fsize").mouseout(function(){
var size=$(this).find("div").find("p").css("font-size");
$(this).find("h3 span").html("Font-size:"+size);
})

})

6、網頁設計中把字體放大居中換顏色怎麼弄?為什麼我這樣寫不行?不好意思 啊。我是新手。謝謝了,大神幫忙

應該是這樣 <p align="center"><font size="8" color="red"><b>街頭文化</b></p>

7、網頁設計中一段話第一個字加大怎麼設計

用這個 :first-letter

8、HTML頁面如何設計,使圖片文字都按解析度自動縮放? 主要是圖片要自動縮放 謝謝

圖片可對寬復高使用百分百如`width:30%`;文字制可用rem為單位而不是固定像素的px,再根據解析度修改根元素html標簽的font-size的(媒體查詢),如此rem會根據其大小同步進行變化.媒體查詢的使用方法見:網頁鏈接

9、html怎麼改變字體大小和顏色

可以用css改變字體的大小和顏色。

1、新建html文件,在body標簽中添加文字,這里以p標簽內容為「演示文本」為例,這時網頁將會顯示字體默認大小和顏色:

2、在head標簽中添加style標簽給頁面設置css樣式,選擇p標簽,字體大小用的是「font-size」屬性,屬性值為字體大小,這里以「30px」為例,這時「演示文本」字體將會變大:

3、選擇p標簽,字體顏色用的是「color」屬性,屬性值為顏色,這里以紅色「red」為例,這時「演示文本」字體將會變成紅色:

與網頁設計中如何放大文字相關的知識