即使经过我用css和html编写的许多行之后,css行为仍然让我感到惊讶 - 这是一种糟糕的方式.
我正在为一个朋友组建一个示例网站,向他展示如何构建他的布局,但Firefox 3.0.5和IE8在我的#header,#content和#footer-div之间创造了边缘.如果我在IE7模式下切换,边距消失.
CSS:
html, body {
background-color: #fff;
margin: 0;
padding: 0;
width: 100%;
}
#page {
background-image: url('bg_gradiant.png');
background-repeat: repeat-y;
width: 950px; /* 770px + 2 * 90px; */
margin: 0 auto;
padding-left: 90px;
}
#header {
width: 770px;
margin: 0;
padding: 0;
}
#header #row1 {
background-color: #9ab3ba;
height: 50px;
}
#header #row2 {
background-color: #517279;
height: 50px;
}
#content {
width: 770px;
background-color: #d7e9ed;
}
#footer {
background-color: #5eb6cc;
width: 770px;
height: 150px;
} …Run Code Online (Sandbox Code Playgroud) 考虑以下代码:
<p style="margin: 30px 0; padding: 0;">Some text some text some text some text some
text some text some text some text</p>
<p style="margin: 30px 0; padding: 0;">Some text some text some text some text some
text some text some text some text</p>
<input type="button" value="Button" style="margin: 30px 0; padding: 0; float: right;"/>?????????????????????????????????????????????????????????
Run Code Online (Sandbox Code Playgroud)
30px预期在最后p和之间的边距,input但有60px边距。显然边距崩溃不起作用。如何修复 CSS 规则,input同时保持在顶部input产生30px垂直边距的能力?
好.我最近对这个网站做了一些更新.
http://annberingerart.com/index.php
在进行一些小的更改后,似乎索引页面上的图像的边距和填充已更改.我希望在所有图像之间在垂直和水平方向上具有相等的填充以及一致的边距.
另外,我在安装了Safari 5的朋友的MAC上查看了该网站,并且整个包装器的大小似乎缩小了,因为它不能像我之前那样包含它的子项.
你可以看一下firebug中的CSS,因为在这里发布400多行CSS会很漫长.
任何和所有的批评都是受欢迎的,但我主要想知道如何解决这个问题.
#top-menu ul.menu li {
background: url(img/back-top-menu2.png);
width: 70px;
height: 37px;
cursor: pointer;
float: left;
text-align: center;
}
#top-menu ul.menu li:hover {
background: url(img/back-top-menu.png);
}
#top-menu ul.menu li a {
color: #fff;
text-decoration: none;
list-style-type: none;
text-align: center;
margin-left: 20px;
margin-top: 20px;
}
Run Code Online (Sandbox Code Playgroud)

如何制作保证金榜首?
我一直在为这一个寻找解决方案.
我有4个NSTextFields(实际上是一些自定义操作的子类),它们都共享相同的X位置.
问题是,有些人有不同的风格(浅色,普通,粗体),可能有不同的尺寸.
会发生的是,即使X原点相同,第一个字母总是有一些(始终不同的)左边距.
请参见图片:https://dl.dropbox.com/u/1977230/Screen%20Shot%202012-12-11%20at%2017.55.58.png
我想确保所有行都从同一点开始,比如从左边开始100px.
知道如何覆盖那个奇怪的填充吗?
干杯
我正在开发我的第一个Android应用程序,我想构建一个包含两个连续图像的主菜单,然后构建一个带有某些标签的TabWidget。我正在使用Android 2.3。
我不知道为什么,但是,在图像之间,似乎出现了一些看起来很难看的空白...我一直在试图修改paddin和margin,但是没有用...有人知道会发生什么吗?
这是我的代码:
<?xml version="1.0" encoding="utf-8"?>
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- android:background="#000000" -->
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView android:id="@+id/TwiceBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/twice_bar"
android:scaleType="fitStart"
/>
<ImageView
android:id="@+id/Banner_publicidad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/banner_publicidad"
android:scaleType="fitStart" />
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</TabHost>
Run Code Online (Sandbox Code Playgroud)
在此先感谢您的帮助!
我想要做的是有一个<div>具有container类和固定宽度,拿着<div>用block类,以防止其他内容侵犯任何不均匀的空白区域,然后两个列(<div>的)并排侧内block,并成为50%的宽度block.
当我创建这个时,我得到的是第一个块之后的边距,这是我不想要的.我希望街区收紧,没有利润.
我在这里有一个例子,我到目前为止,如果代码:
<html>
<head>
<title>Columns</title>
<style>
div {
margin: 0;
padding: 0;
}
.container {
background: #DDD;
width: 1200px;
margin: 0 auto;
padding: 2% 0;
}
.block {
background: #555;
width: 100%;
display: block;
}
.col {
width: 49%;
display: inline-block;
background: #333;
}
</style>
</head>
<body>
<div class="container">
<div class="block">
<div class="col left">
<h1>Left</h1>
</div>
<div class="col right">
<h1>Right</h1>
</div>
</div>
</div> …Run Code Online (Sandbox Code Playgroud) 我有以下页面与一些HTML/CSS:http://jsfiddle.net/Hf6dB/1/
由于某种原因,屏幕顶部工具栏的按钮右边缘.左边,上边和下边的边距都可以,因为容器有一个填充,但边距在哪里?
也是在页面的真实版本中,你在小提琴上看不到,因为没有图标,我在每个菜单条目中都有类似的问题:
<li>
<div class="draggable">
<input id="tb-btn-search" title="Search" type="button">
<p>Search</p>
</div>
</li>
Run Code Online (Sandbox Code Playgroud)
当鼠标离开按钮时,其<p>宽度可以使用CSS过渡从0变为2.由于某种原因,当宽度<p>为零时,图标不再居中,因为在这里,还有一个额外的边距来自任何地方.
这是否与内联块显示属性的使用有关?
谢谢你的帮助!
我试图在使用移动屏幕时通过CSS中的媒体查询删除我在nav-link元素中添加的边距mt-2,但无法实现.我可能错误地调用了这个类.
@media (max-width: 991px) {
.nav-link hovtext p-1 mt-2 a{
margin: 0;
}
}Run Code Online (Sandbox Code Playgroud)
<div class=" col-xs-12 col-sm-8 col-md-4 d-flex clearfix">
<nav class="nav flex-column footerstyle">
<a class="nav-link hovtext p-1 mt-2" href="#">Términos de uso</a>
<a class="nav-link p-1" href="#">Políticas de privacidad</a>
<a class="nav-link p-1" href="#">Socios</a>
<a class="nav-link p-1" href="#">Confianza y Seguridad</a>
</nav>
</div>Run Code Online (Sandbox Code Playgroud)
如何在kotlin中更改textview的边距和填充?我试过这个:
val maskot_names = maskot_row.findViewById<TextView>(R.id.maskot_name)
maskot_names.text=maskot_names_list.get(position)
// showing "???" if maskot_names is empty
if(maskot_names.text=="")
{
maskot_names.text="???"
maskot_names.paddingTop(16f)
}
Run Code Online (Sandbox Code Playgroud) margin ×10
css ×6
html ×3
android ×2
padding ×2
bootstrap-4 ×1
cocoa ×1
css3 ×1
html-lists ×1
image ×1
imageview ×1
inline ×1
input ×1
kotlin ×1
nstextfield ×1
objective-c ×1
responsive ×1
textview ×1