Html 我的CSS列不会相邻
我在我的网站上有两个css栏:右栏是25%,左栏是75%。但是,现在它没有显示右栏,左栏占了100%,如果我尝试在左栏中放一些东西,它会放在页面底部。我改变了一件不相关的事情,我甚至不记得是什么,现在整个事情都不起作用了。我需要修理什么 我的基本html:Html 我的CSS列不会相邻,html,css,Html,Css,我在我的网站上有两个css栏:右栏是25%,左栏是75%。但是,现在它没有显示右栏,左栏占了100%,如果我尝试在左栏中放一些东西,它会放在页面底部。我改变了一件不相关的事情,我甚至不记得是什么,现在整个事情都不起作用了。我需要修理什么 我的基本html: <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/g
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-175481126-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-175481126-1');
</script>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
font-family: Tahoma, Geneva, sans-serif;
background-color: #333;
}
li {
float: left;
border-right: 1px solid #bbb;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
/* Change the link color to #111 (black) on hover */
li a:hover {
background-color: #111;
color: white;
text-decoration:none;
}
/* for buttons*/
.paging {
background-color: #333;
border: none;
color: white;
padding: 8px 14px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
font-family: Tahoma, Geneva, sans-serif;
}
button:hover {
background-color: #111;
}
.register {
float: right;
}
.paging {
background-color: #333;
border: none;
color: white;
padding: 8px 14px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
font-family: Tahoma, Geneva, sans-serif;
}
button:hover {
background-color: #111;
}
/* title */
.title {
color: black;
padding: 10px;
text-align: center;
font-size: 40px;
font-family: Tahoma, Geneva, sans-serif;
Color: black;
text-decoration: none;
}
/* descriptions */
.description {
color: black;
padding: 15px;
font-family: Tahoma, Geneva, sans-serif;
text-align: left;
font-size: 13px;
}
/* embedd url */
.iframe-container{
position: relative;
width: 100%;
padding-bottom: 56.25%;
height: 0;
margin-left: auto; /* Automatic margin from left */
margin-right: auto; /* Automatic margin from right */
}
.iframe-container iframe{
position: absolute;
top:0;
left: 0;
width: 100%;
height: 100%;
}
/* make columns */
.ads {
float: right;
width: 25%;
padding-right: 3%;
padding-left: 3%;
background-color: #E4E9ED;
}
}
.videos {
float: left;
width: 75%;
padding-right: 10%;
padding-left: 10%;
}
.banner {
float: left;
width: 100%;
height: 5%;
background-color: red;
color: white;
text-align: center;
}
/* header */
.header {
background-color: #F1F1F1;
text-align: center;
padding: 20px;
font-family: Tahoma, Geneva, sans-serif;
}
</style>
<html>
{% load static %}
<link rel="shortcut icon" type="image/png" href="{% static 'images/favicon.ico' %}"/>
<div class="header">
<a href="/">
<img src="https://i.ibb.co/5Rqps7F/logo-black.png" alt="Computer Man">
</a>
</div>
<ul>
<li class="all"><a href="/">All videos</a></li>
<li class="stam"><a href="/stam">Stam videos</a></li>
<li class="music"><a href="/music">Music videos</a></li>
<li class="news"><a href="/news">News videos</a></li>
<li class="contact"><a href="/contact">Contact</a></li>
<li class="register"><a href="/register">Login/Register</a></li>
</ul>
<div class="banner">
<text align="center">We are still developing our site, so we may not be able to update videos as often as we want</text>
</div>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
window.dataLayer=window.dataLayer | |[];
函数gtag(){dataLayer.push(参数);}
gtag('js',新日期());
gtag(“配置”、“UA-175481126-1”);
保险商实验室{
列表样式类型:无;
保证金:0;
填充:0;
溢出:隐藏;
字体系列:塔荷马,日内瓦,无衬线;
背景色:#333;
}
李{
浮动:左;
右边框:1px实心#bbb;
}
李阿{
显示:块;
颜色:白色;
文本对齐:居中;
填充:14px 16px;
文字装饰:无;
}
/*悬停时将链接颜色更改为#111(黑色)*/
李娜:停下来{
背景色:#111;
颜色:白色;
文字装饰:无;
}
/*按钮*/
.传呼{
背景色:#333;
边界:无;
颜色:白色;
填充:8px 14px;
文本对齐:居中;
文字装饰:无;
显示:内联块;
字体大小:16px;
字体系列:塔荷马,日内瓦,无衬线;
}
按钮:悬停{
背景色:#111;
}
.登记{
浮动:对;
}
.传呼{
背景色:#333;
边界:无;
颜色:白色;
填充:8px 14px;
文本对齐:居中;
文字装饰:无;
显示:内联块;
字体大小:16px;
字体系列:塔荷马,日内瓦,无衬线;
}
按钮:悬停{
背景色:#111;
}
/*头衔*/
.头衔{
颜色:黑色;
填充:10px;
文本对齐:居中;
字体大小:40px;
字体系列:塔荷马,日内瓦,无衬线;
颜色:黑色;
文字装饰:无;
}
/*描述*/
.说明{
颜色:黑色;
填充:15px;
字体系列:塔荷马,日内瓦,无衬线;
文本对齐:左对齐;
字体大小:13px;
}
/*嵌入url*/
.iframe容器{
位置:相对位置;
宽度:100%;
垫底:56.25%;
身高:0;
左边距:自动;/*自动左边距*/
右边距:自动;/*自动右边距*/
}
.iframe容器iframe{
位置:绝对位置;
排名:0;
左:0;
宽度:100%;
身高:100%;
}
/*列*/
.广告{
浮动:对;
宽度:25%;
右:3%;
左:3%;
背景色:#E4E9ED;
}
}
.视频{
浮动:左;
宽度:75%;
右:10%;
左:10%;
}
.横幅{
浮动:左;
宽度:100%;
身高:5%;
背景色:红色;
颜色:白色;
文本对齐:居中;
}
/*标题*/
.标题{
背景色:#f1f1;
文本对齐:居中;
填充:20px;
字体系列:塔荷马,日内瓦,无衬线;
}
{%load static%}
我们仍在开发我们的网站,所以我们可能无法更新视频,因为我们想经常
我的网页html:
{% include 'base.html' %}
<style>
.{{ category }} {
background-color: grey;
}
</style>
<div class="row">
<div class="videos">
{% autoescape off %}
<h1 class="title"> {{ video_.title }} </h1>
{% ifnotequal video_.tag 'none' %}
<small align = left> {{ video_.tag }} </small>
{% endifnotequal %}
<div class="iframe-container"><p align="center"> {{ video_.url }}</p></div>
<div class="description"> {{ video_.description }} </div>
<hr/>
{% endautoescape %}
</div>
</div>
<div class="row">
<div class="ads">
{% for ad in ad_item %}
{% ifequal ad.redirect 'False' %}
<img src="{{ ad.pic }}"></img>
{% endifequal %}
{% ifnotequal ad.redirect 'False' %}
<a href="{{ ad.redirect }}"><img src="{{ ad.pic }}"></img></a>
{% endifnotequal %}
{% endfor %}
</div>
</div>
{%include'base.html%}
.{{category}{
背景颜色:灰色;
}
{%autoescape off%}
{{视频标题}
{%ifnotequal视频\标记“无”%}
{{视频{.tag}
{%endifnotequal%}
{{video.url}
{{视频描述}
{%endautoescape%}
{ad_项%中的ad为%0}
{%ifequal ad.redirect'False%}
{%endifequal%}
{%ifnotequal ad.redirect'False%}
{%endifnotequal%}
{%endfor%}
你可以在tachlis.herokuapp.com上看到这个网站,你会看到所有的东西都是一列,笑脸图片都在底部,而不是在页面的右侧
注意:这是针对django web应用程序的,因此可能有几行没有意义。只需将您的
视频
和广告
div
放在同一行,而不是放在不同的行
<div class="row">
<div class="videos">...</div>
<div class="ads">...</div>
</div>
...
...
以前,当您有两个不同的
行时,视频
类占第一行的75%,而广告
类占第二行的25%只要把你的视频
和广告
放在同一行,而不是放在不同的行
<div class="row">
<div class="videos">...</div>
<div class="ads">...</div>
</div>
...
...
以前,当您有两个不同的行
时,视频
类占第一行的75%,而广告
类占第二行的25%您忘记了使用display:flex创建父级代码>。注意,您还需要一些其他的flex样式来实现您的布局创建正确列的css,但它仍然不工作。我是不是误解了“创建家长”的含义?把整个事情都写进一个小盒子里谢谢你!您忘记使用display:flex代码>。注意,您还需要一些其他的flex样式来实现您的布局创建正确列的css,但它仍然不工作。我是不是误解了“创建家长”的含义?把整个事情都写进一个小盒子里谢谢你!我还必须添加“display:flex;”给父母。谢谢@PiggyPlex和@shadow lad!我还必须添加“display:flex;”给父母。谢谢@PiggyPlex和@shadow lad!