當前位置:首頁 » 網頁前端 » 前端給標簽設置圓角
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

前端給標簽設置圓角

發布時間: 2022-03-30 21:42:07

❶ 網頁中如何添加圓角的div標簽

Div切圓角的實現原理:
1,首先使用P標簽,第一行距Div的邊距為一個數值(假設為3px;);
2,第二個p標簽在第一個的下一行,距Div的邊距為第一行的減去一個像素數值(假設為2px;);
3,依次實現,直到最後一個p標簽的值為1px;
4,第一行全顯示,後面的只顯示兩頭的一個像素即可。
5,再配合中間的DIV顯示兩頭的線框,即可實現
實現代碼:
<!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=gb2312"
/>
<title>Div圓角實現</title>
<style
type="text/css">
.one
{
display:block;
overflow:hidden;
height:1px;
margin:0
4px;
border-left:1px
solid
#B2D0EA;
border-right:1px
solid
#B2D0EA;
background:#B2D0EA;
}
.two
{
display:block;
overflow:hidden;
height:1px;/*線的高度為1px*/
margin:0
3px;/*距離外層DIV的左右邊距各3px*/
border-left:1px
solid
#B2D0EA;/*只顯示線的左邊的1px*/
border-right:1px
solid
#B2D0EA;/*只顯示線的右邊的1px*/
background:#B2D0EA;/*配合內層Div的顏色變化,*/
}
.three
{
display:block;
overflow:hidden;
height:1px;
margin:0
2px;
border-left:1px
solid
#B2D0EA;
border-right:1px
solid
#B2D0EA;
background:#EDF7FF;
}
.four
{
display:block;
overflow:hidden;
height:1px;
margin:0
1px;
border-left:1px
solid
#B2D0EA;
border-right:1px
solid
#B2D0EA;
background:#EDF7FF;
}
.rou/*DIV只顯示左右的邊框,顏色和p標簽的一致*/
{
border-left:1px
solid
#B2D0EA;
border-right:1px
solid
#B2D0EA;
}
.rou2
{
border-left:1px
solid
#B2D0EA;
border-right:1px
solid
#B2D0EA;
background:#EDF7FF;
}
</style>
<!--Div切圓角的實現原理:
1,首先使用P標簽,第一行距Div的邊距為一個數值(假設為3px;);
2,第二個p標簽在第一個的下一行,距Div的邊距為第一行的減去一個像素數值(假設為2px;);
3,依次實現,直到最後一個p標簽的值為1px;
4,第一行全顯示,後面的只顯示兩頭的一個像素即可。
5,再配合中間的DIV顯示兩頭的線框,即可實現
-->
</head>
<body>
<div>
<!--<p
class="one"></p>-->
<p
class="two"></p>
<p
class="three"></p>
<p
class="four"></p>
<div
class="rou2">
標題欄
</div>
<div
class="rou">
內容頁!
</div>
<p
class="four"></p>
<p
class="three"></p>
<p
class="two"></p>
<!--<p
class="one"></p>-->
</div>
</body>
</html>

❷ Javascript圓角Div問題

div.style.border.radius="10px";

改為
div.style.borderRadius="10px"; //請注意大小寫

第二個問題的解決方法也同上。

❸ html img可以定義圓角嗎

可以啊,如果不好觀察,可以把<img>設置一個背景色background: green;再設置圓角 border-radius: 10px;

如果在img外面有框架,如<div>,其也要設置border-radius: 10px;才可以把img設置成圓角。

❹ HTML中fieldset標簽設置圓角時如何兼容IE瀏覽器

fieldset標簽在不同瀏覽器顯示效果是不同的。


在IE6、IE7、IE8、IE9下fieldset的padding值為0,firefox5、chrome13下左右內邊距約為12px。當把legend設為width:100%時,IE6、IE7出現水平滾動條,且legend與fieldset內其它內容沒有對齊。解決方法為legend在IE6、IE7單獨設置margin:0 -7px。


參考樣式:

fieldset{border:0none;background-color:red;padding:0;}
legend{width:100%;background-color:green;padding:0;*margin:0-7px;}


建議還是直接css寫。

❺ input輸入框怎樣做成圓角的

使用工具:

HBuilder.exe

代碼:

<!DOCTYPEhtml>
<html>
<head>
<metacharset="utf-8"/>
<title></title>
</head>
<body>

<inputtype="text"value="輸入框圓角"style="border-radius:6px;">

</body>
</html>

❻ 在html中怎樣設置超鏈接的背景是圓角的而不是默認矩形的

給超鏈接的元素設置border-radius: Xpx;
X的數值大小決定圓角大小。

❼ html5中button怎麼把邊框怎麼弄成圓角

在HTML中把塊的邊框做成圓角需要利用css的border-radius屬性。

操作步驟:

1、打開Adobe Dreamweaver CC 2015。

❽ 在HTML里如何實現圓角矩形

HTML沒有實現矩形的標簽,可以藉助CSS來完成。使用CSS3的border-radius屬性,即可完成圓角矩形。

border-radius屬性的具體用法如下:
border-radius 屬性是一個簡寫屬性,用於設置四個 border-*-radius 屬性。

默認值:0

繼承性:no

版本:CSS3

JavaScript 語法:object.style.borderRadius="5px"

語法
border-radius: 1-4 length|% / 1-4 length|%;

(注釋:按此順序設置每個 radii 的四個值。如果省略 bottom-left,則與 top-right 相同。如果省略 bottom-right,則與 top-left 相同。如果省略 top-right,則與 top-left 相同。)

值 描述 測試

length 定義圓角的形狀。 測試
% 以百分比定義圓角的形狀。 測試
例子 1
border-radius:2em;

等價於:
border-top-left-radius:2em;
border-top-right-radius:2em;
border-bottom-right-radius:2em;
border-bottom-left-radius:2em;

例子 2
border-radius: 2em 1em 4em / 0.5em 3em;

等價於:
border-top-left-radius: 2em 0.5em;
border-top-right-radius: 1em 3em;
border-bottom-right-radius: 4em 0.5em;
border-bottom-left-radius: 1em 3em;