Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 制作一个按钮,每边都有一个带有CSS的括号_Html_Css_Button - Fatal编程技术网

Html 制作一个按钮,每边都有一个带有CSS的括号

Html 制作一个按钮,每边都有一个带有CSS的括号,html,css,button,Html,Css,Button,我很想知道如何创建一个带有CSS的按钮,它的每一面都有“括号”。要澄清的是,不仅仅是通过键入括号获得的括号,还有更大的括号,如以下所示: 您可以使用带有内容属性的前和后伪选择器: 按钮{ 字体大小:15px; 字体大小:粗体; 背景:无; 边界:无; 空白:nowrap; } 按钮::之前{ 内容:“[”; 字号:1.5em; } 按钮::之后{ 内容:“]”; 字号:1.5em; } button.bigtext{ 字号:80px; } 一些文本 一些文本要实现这一点,您可以做一些事情 第

我很想知道如何创建一个带有CSS的按钮,它的每一面都有“括号”。要澄清的是,不仅仅是通过键入括号获得的括号,还有更大的括号,如以下所示:


您可以使用带有
内容
属性的
伪选择器:

按钮{
字体大小:15px;
字体大小:粗体;
背景:无;
边界:无;
空白:nowrap;
}
按钮::之前{
内容:“[”;
字号:1.5em;
}
按钮::之后{
内容:“]”;
字号:1.5em;
}
button.bigtext{
字号:80px;
}
一些文本


一些文本
要实现这一点,您可以做一些事情

第一个也是最简单的:在Photoshop中创建一个按钮背景,并将其用作按钮背景

第二:键入所需的方括号和按钮文本,然后为各个部分设置样式

HTML:


这些都是我能想到的直截了当的方法,非常简单快捷。

我不确定我是否理解了这个问题。在它周围放一个括号。下面的例子

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252"><title>Title Here </title>
</head>
<body>
<br>
<center>Your Title</center>
<br>
Some Text Data Here 
<style type="text/css">
#modernbricksmenu { padding: 0; width: 100%; background: transparent; voice-family: ''}''; voice-family: inherit; } 
#modernbricksmenu ul { font: bold 11px Arial; margin:0; margin-left: 40px; /*margin between first menu item and left browser edge*/ padding: 0; list-style: none; } 
#modernbricksmenu li {   display: inline; margin: 0 2px 0 0; padding: 0; text-transform:uppercase; }
#modernbricksmenu a { float: left; display: block; color: white; margin: 0 1px 0 0; /*Margin between each menu item*/ 
padding: 5px 10px; text-decoration: none; letter-spacing: 1px; background-color: black; /*Default menu color*/ border-bottom: 1px solid white; } 
#modernbricksmenu a:hover { background-color: gray; /*Menu hover bgcolor*/ } 
#modernbricksmenu #current a { /*currently selected tab*/ background-color: #D25A0B; /*Brown color theme*/  border-color: #D25A0B; /*Brown color theme*/  } 
#modernbricksmenuline { clear: both; padding: 0; width: 100%; height: 5px; line-height: 5px; background: #D25A0B; /*Brown color theme*/  } 
#myform { /*CSS for sample search box. Remove if desired */ float: right; margin: 0; padding: 0; } 
#myform .textinput { width: 190px; border: 1px solid gray; } 
#myform .submit { font: bold 11px Verdana; height: 22px; background-color: lightyellow; } </style> 
<div id="modernbricksmenu"> <ul> <li style="margin-left: 1px">
<a href="page.com" title="SomePage">   Home</a></li> <li>                         
<a href="page.com" title="SomeOther">  New</a></li> <li id="current">            
<a href="page.com" title="AnotherOne"> Revised</a></li> <li>                         
<a href="page.com" title="StilMore">   [Tools]</a></li> <li>                         
<a href="page.com" title="GoAway">     Forums</a></li> </ul>
</div>
<div id="modernbricksmenuline">&nbsp;</div> 
</body>
</html>

标题在这里

你的头衔
这里有一些文本数据 #modernbricksmenu{padding:0;宽度:100%;背景:透明;语音系列:'}';语音家族:继承;} #modernbricksmenu ul{font:bold 11px Arial;边距:0;左边距:40px;/*第一个菜单项和左侧浏览器边缘之间的边距*/填充:0;列表样式:无;} #modernbricksmenu li{显示:内联;边距:0 2px 0 0;填充:0;文本转换:大写;} #modernbricksmenu a{浮动:左;显示:块;颜色:白色;边距:0 1px 0;/*每个菜单项之间的边距*/ 填充:5px 10px;文本装饰:无;字母间距:1px;背景颜色:黑色;/*默认菜单颜色*/边框底部:1px纯白;} #modernbricksmenu a:悬停{背景色:灰色;/*菜单悬停bgcolor*/} #modernbricksmenu#当前a{/*当前选择的选项卡*/背景色:#D25A0B;/*棕色主题*/边框色:#D25A0B;/*棕色主题*/} #modernbricksmenuline{清除:两者;填充:0;宽度:100%;高度:5px;线条高度:5px;背景:#D25A0B;/*棕色主题*/} #myform{/*示例搜索框的CSS。如果需要,请删除*/float:right;margin:0;padding:0;} #textinput{宽度:190px;边框:1px实心灰色;} #提交{字体:粗体11px Verdana;高度:22px;背景色:浅黄色;}

这里提供了一种方法,您可以编辑包含框阴影的括号的大小、厚度和长度

。括号{
宽度:200px;
高度:50px;
盒影:镶嵌0px 0px 0px 5px黑色;
背景:白色;
位置:相对位置;
}
.按钮{
高度:50px;
宽度:80%;
位置:绝对位置;
排名:0;
左:50%;
转化:translateX(-50%);
边界:无;
背景:白色;
字号:1.6em;
字体大小:粗体;
}

按钮

我不想更改我的模板,所以我想出了一个纯CSS解决方案。 它也适用于所有背景

.btn{
位置:相对位置;
边界:无;
背景:无;
填充:8px 24px;
}
.btn::之前,
.btn::之后{
位置:绝对位置;
排名:0;
底部:0;
宽度:8px;
边框:2倍实心#000;
内容:“;
}
.btn::之前{
左:0;
右边框宽度:0;
}
.btn::之后{
右:0;
边框左宽度:0;
}

Buttton
+1,用于使用伪类选择器,但我认为OP正在寻找更大括号的东西,根据他的帖子。我认为,如果他只是试图增加支架的尺寸,他会在这个解决方案中遇到一些垂直对齐问题,但没有什么是无法克服的。@scarabaeus,谢谢你的评论!我用一个大字体的例子稍微修改了代码:)没问题!我认为他在寻找相对文本更大的括号。。。但这只是一个猜测。别浪费你的时间为我把事情搞定。也许OP可以接受您提出的解决方案。(虽然,我很想看到你能解决这个问题。)非常感谢你的回复!我还没有机会尝试,但会在未来几天。你检查答案了吗?非常感谢你的回复!我还没有机会尝试您的解决方案,但是使用括号字符似乎不会让我对括号的大小/形状有太多的控制。不过,我将在接下来的几天内尝试给出的所有解决方案。非常感谢您的回复!我希望有一个纯CSS的解决方案,让我最大限度地控制厚度/大小等。我将在未来几天内尝试列出的解决方案。鲁迪,非常感谢您的回复。这几乎正是我所需要的。如果这是一个幼稚的问题,请原谅,但是是否仍然可以通过.button中包含的文本来确定.bracket DIV的大小?这将允许我将此解决方案应用于任何按钮,无论其中有多少文本。我阅读了其他一些关于根据内容调整父DIV大小的文章,但没有取得任何进展。这可能吗?
p {
    font-size: 20px;
}
.large {
    font-size: 40px;
}
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252"><title>Title Here </title>
</head>
<body>
<br>
<center>Your Title</center>
<br>
Some Text Data Here 
<style type="text/css">
#modernbricksmenu { padding: 0; width: 100%; background: transparent; voice-family: ''}''; voice-family: inherit; } 
#modernbricksmenu ul { font: bold 11px Arial; margin:0; margin-left: 40px; /*margin between first menu item and left browser edge*/ padding: 0; list-style: none; } 
#modernbricksmenu li {   display: inline; margin: 0 2px 0 0; padding: 0; text-transform:uppercase; }
#modernbricksmenu a { float: left; display: block; color: white; margin: 0 1px 0 0; /*Margin between each menu item*/ 
padding: 5px 10px; text-decoration: none; letter-spacing: 1px; background-color: black; /*Default menu color*/ border-bottom: 1px solid white; } 
#modernbricksmenu a:hover { background-color: gray; /*Menu hover bgcolor*/ } 
#modernbricksmenu #current a { /*currently selected tab*/ background-color: #D25A0B; /*Brown color theme*/  border-color: #D25A0B; /*Brown color theme*/  } 
#modernbricksmenuline { clear: both; padding: 0; width: 100%; height: 5px; line-height: 5px; background: #D25A0B; /*Brown color theme*/  } 
#myform { /*CSS for sample search box. Remove if desired */ float: right; margin: 0; padding: 0; } 
#myform .textinput { width: 190px; border: 1px solid gray; } 
#myform .submit { font: bold 11px Verdana; height: 22px; background-color: lightyellow; } </style> 
<div id="modernbricksmenu"> <ul> <li style="margin-left: 1px">
<a href="page.com" title="SomePage">   Home</a></li> <li>                         
<a href="page.com" title="SomeOther">  New</a></li> <li id="current">            
<a href="page.com" title="AnotherOne"> Revised</a></li> <li>                         
<a href="page.com" title="StilMore">   [Tools]</a></li> <li>                         
<a href="page.com" title="GoAway">     Forums</a></li> </ul>
</div>
<div id="modernbricksmenuline">&nbsp;</div> 
</body>
</html>