我使用了多个绘有边框的组件.是否有任何简单的方法可以为组件添加边距,以便边框不会彼此如此接近?
我正在使用breakurl包和带有pdfLatex和BibTeX的hyperref包来引用一个url.网址正在破坏,但不是根据我的边缘.我有什么方法可以让网址识别我的边距或强制换行?提前致谢.
码:
__CODE__可能是一种排列__CODE__;-)
任何帮助表示赞赏,不,这不是作业 - 个人兴趣:-)
如果我只为我的textview设置边距,那就是线性布局,一切正常.如果我只为我的textview设置重力,它就有效.但是如果我设置了两个属性(重力和边距),重力仍然保留,边缘设置成功.
我的代码用于设置两个不按预期工作的属性:
tv2=new TextView(this);
tv2.setText("Text");
LinearLayout.LayoutParams para=new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT );
para.setMargins(0, 10, 0, 10); //left,top,right, bottom
tv2.setLayoutParams(para);
tv2.setGravity(android.view.Gravity.CENTER_HORIZONTAL);
Run Code Online (Sandbox Code Playgroud)
我必须在代码中构建我的布局,不能使用xml文件.
如果a <div>或任何其他元素跟随a <img>,则它们之间会出现~3px的空格 - 即使margins它们为零.
<img src="example-fractal-art.png">
<div>What is with that gap?<div>
Run Code Online (Sandbox Code Playgroud)
这是一些CSS的样子.

现在很容易display: block进入CSS并解决问题.但为什么会这样呢?没有计算的边距,填充,边框或类似的东西.
浏览器在做什么?有人甚至称它为"神奇".
我正在使用Bootstrap作为项目的CSS框架我和我的朋友正在研究(因此D&D主题).我有一个页面,我们正在显示特定用户的D&D字符.当在页面上显示这些字符时,每行应该有四个字符(span4在行 - 流体中).问题是从第二行开始有一个奇怪的缩进(参见attatched fiddle).
我一直在Chrome中使用"Inspect component",但我似乎无法得到导致这种情况的原因.
希望我有点解释这个问题:)
主要的"容器"(基本上是)粘贴在下面:
<div class="container"><div class="row">
<div class="span12">
<h3 class="mycharacters">My characters</h3>
<a class="btn btn-success btn-small pull-right">
<i class="icon-plus-sign icon-white"></i> Add character
</a>
</div>
<div class="span12" id="actor_result"><div class="row-fluid">
<div class="span4 well well-small"><div class="media"><a class="pull-left" href="#"><img class="media-object img-circle actor" src="http://placehold.it/64x64"></a><div class="overflow-media-body media-body"><div class="btn-group pull-right"><button class="btn btn-mini dropdown-toggle" data-toggle="dropdown"><span class="icon-cog"></span></button><ul class="dropdown-menu"><li><a href="actor_edit_owner?id=1"><i class="icon-pencil"></i> Edit
</a></li><li><a href=""><i class="icon-picture"></i> Change avatar</a></li><li><a href=""><i class="icon-trash"></i> Delete</a></li></ul></div><h4 class="media-heading">Davius</h4><div><i class="icon-heart"></i><strong> Health: </strong>17/20hp</div><br><br></div><div><i class="icon-fire"></i><strong> Effects: </strong></div><div class="actor-text">Mumblecore bushwick sed, nulla id street art dolore …Run Code Online (Sandbox Code Playgroud) 我有一个小问题,我希望我的页脚留在屏幕的底部position: absolute.但我margin: auto把它放在屏幕中间不再工作了.
HTML:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='Type=text/html; charset=utf-8'>
<link rel="shortcut icon" href="../IMAGES/favicon.ico">
<title>TEST</title>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../css/stylesheet.css">
</head>
<body>
<div id="header">
<div id="logo">
<img src="../IMAGES/logo.png" />
</div>
<div id="logotitel">
Den Allerstrafste "Ful-Ambi" Live-Band van groot Antwerpen en omstreken!
</div>
</div>
<div id="nav">
<div id="links">
<a href="index.php"><div class="link">Home</div></a>
<a href="wie.php"><div class="link">Wie is wie</div></a>
<a href="fotos.php"><div class="link">Foto's</div></a>
<a href="repertoire.php"><div class="link">Repertoire</div></a>
<a href="links.php"><div class="link">Links</div></a>
<a href="contact.php"><div class="link">Contact</div></a>
</div>
</div>
<div class="clear"></div>
<div …Run Code Online (Sandbox Code Playgroud) 我的问题只是以div为中心.
目前,我只有一个简单的html文件.我不知道为什么margin: 0 auto不工作.
这是我的html的布局:
<style type="text/css">
#header {
width: 100%;
margin: 0 auto 20px auto;
height: 50px;
background-color: #0F6;
}
#navigation {
width: auto;
float: right;
margin: 0 auto;
display: inline-block;
}
#content {
background-color: #936;
margin: 0 auto;
width: 960px;
position: relative;
min-width: 720px;
max-width: 960px;
}
footer {
background-color:#0F6;
width: 100%;
height: 200px;
}
body {
background-image: url(images/dark_wall.png);
}
</style>
</head>
<body>
<div id="header">
<div id="navigation">This is the nav</div>
</div>
<div id="content">
<div id="content_top">
</div> …Run Code Online (Sandbox Code Playgroud) 我想以编程方式将边距设置为View.这是我的XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llAttendeeList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#000000">
<ListView
android:id="@+id/attendeelistview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:listSelector="#F6CECE" >
</ListView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
当我的按钮onClick调出弹出窗口视图时的方法:
private void openPopUp() {
LayoutInflater layoutInflater = (LayoutInflater) getActivity()
.getBaseContext().getSystemService(
context.LAYOUT_INFLATER_SERVICE);
View popupView = layoutInflater.inflate(R.layout.event_attendee_pop,
null);
llAttendeeList = (LinearLayout) popupView
.findViewById(R.id.llAttendeeList);
attendeeListView = (ListView) popupView.findViewById(R.id.attendeelistview);
LayoutParams params = new LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT
);
params.setMargins(10, 10, 10, 0);
popupView.setLayoutParams(params);
final PopupWindow popupWindow = new PopupWindow(popupView,
LayoutParams.WRAP_CONTENT, 350);
popupWindow.setOutsideTouchable(true);
popupWindow.setBackgroundDrawable(new BitmapDrawable());
popupWindow.setTouchInterceptor(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_OUTSIDE) …Run Code Online (Sandbox Code Playgroud) 我正在寻找一种方法来使用jquery添加任何数字的边距.它应该是这样的:
<div class="mr5">Add this text margin-right = 5px</div>
<div class="ml15">Add this text margin-left = 15px</div>
<div class="mt6">Add this text margin-top = 6px</div>
<div class="mb4">Add this text margin-bottom = 4px</div>
Run Code Online (Sandbox Code Playgroud)
等等 ...
<div class="m4">Add this text margin = 4px</div>
<div class="p4">Add this text padding = 4px</div>
...
Run Code Online (Sandbox Code Playgroud)
是否可以创建jquery代码来执行此操作?也许这样做是为了填充.
想法: 它可以在引导中使用太像添加自动填充,边缘或甚至font-size与fs18添加字体大小:18像素
谢谢
我希望有人能帮助我.
我想在多个堆叠的浮动元素周围包装文本,但是当我向第二个元素添加负边距时,文本不会播放球(见下文)...
有没有人有解决方案可以帮助我这个?
提前致谢!
到目前为止我在这里做了什么:
<style>
.elements {
float:left;
padding:10px;
width:50%;
background:#039;
color:#fff;
font-family:Arial, Helvetica, sans-serif;
color:#fff;
padding:50px;
box-sizing:border-box;
margin-right: 20px;
position: relative;
}
#element-two {
margin-top:-50px;
background:#900;
margin-left:30px;
}
</style>
<div id="post">
<div id="element-one" class="elements">Element 1</div>
<div id="element-two" class="elements">Element 2</div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam id dictum odio. Interdum et malesuada fames ac ante ipsum primis in faucibus. Vivamus vitae leo dictum, <br>
<br>
<br>
porttitor augue ut, accumsan nunc. Phasellus at malesuada orci, quis …Run Code Online (Sandbox Code Playgroud)