gpt4 book ai didi

css - 无法让我的元素符号列表正确显示

转载 作者:行者123 更新时间:2023-11-28 03:56:27 25 4
gpt4 key购买 nike

我正在使用一个包含国家和旗帜列表的小型应用程序。该列表最初使用的是常规元素符号图标,但我也想包括旗帜。应用程序中有 2 个区域会影响列表,第一个是 index.php 文件(这是我更改代码以选择标志图像的地方。该文件的全部内容如下:

jQuery(document).ready(function($) {
$("li").click(function() {
parent.addLanguageCode();
var b = $('.arrowchat_trayclick').attr('id');
b = b.substr('30');

var info = $(this).attr('id');
if (info != b) {
$('.goog-te-combo', top.document).val(info);
parent.changeLanguage();

$('#arrowchat_applications_button_' + b).click();
$('#arrowchat_applications_button_' + b + ' img').attr('src', '{$base_url}images/' + info + '.png');
$('#arrowchat_app_link_' + b + ' img').attr('src', '{$base_url}images/' + info + '.png');
$.cookie('arrowchat_language_app', info);
}
});
});
html,
body {}

.small {
font-weight: bold;
}

.translate_ul ul {
float: left;
width: 100%;
margin: 0;
padding: 0;
list-style: none;
}

.translate_ul li {
text-align: left;
float: left;
width: 102px;
margin: 0;
height: 20px;
background-position: 0 -1px;
background-repeat: no-repeat;
padding: 0 0 0 1.5em;
cursor: pointer;
}

.translate_container {
background-color: #fffff;
color: #333;
font-weight: normal;
font-family: 'lucida grande', tahoma, verdana, arial, sans-serif;
font-size: 11px;
padding: 15px 10px;
padding-bottom: 0px;
text-align: left;
}

.translate_container a {
color: #11648F;
}

.translating {
display: none;
}
<!--

<?php #PHP bits from the op, left here but useless for a snippet

require_once(dirname(__FILE__)."/config.php");

// Gets the folder path without filename
function GetFileDir($php_self) {
$filename2 = "";
$filename = explode("/", $php_self);
for( $i = 0; $i < (count($filename) - 1); ++$i ) {
$filename2 .= $filename[$i].'/';
}
return $filename2;
}

$base_url = GetFileDir($_SERVER['PHP_SELF']);

echo <<<EOD
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>

<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link type="text/css" rel="stylesheet" media="all" href="{$base_url}includes/css/style.css" />

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="{$base_url}includes/js/jquery.cookie.js" type="text/javascript"></script>
<script src="{$base_url}includes/js/functions.js" type="text/javascript"></script>

<div style="width:100%;margin:0 auto;margin-top: 0px;height:300px" class="translate_ul">

<div class="translate_container" style="height:300px;">

<ul class="languages" style="height: 300px;">
<li id="af"><img src="/arrowchat/applications/translate/images/af.png" alt="af" />Afrikaans</li>
<li id="sq"><img src="/arrowchat/applications/translate/images/sq.png" alt="sq" />Albanian</li>
<li id="ar"><img src="/arrowchat/applications/translate/images/ar.png" alt="ar" />Arabic</li>
<li id="be"><img src="/arrowchat/applications/translate/images/be.png" alt="be" />Belarusian</li>
<li id="bg"><img src="/arrowchat/applications/translate/images/bg.png" alt="bg" />Bulgarian</li>
<li id="ca"><img src="/arrowchat/applications/translate/images/ca.png" alt="ca" />Catalan</li>
<li id="zh-CN"><img src="/arrowchat/applications/translate/images/zh-CN.png" alt="zh-CN" />Chinese (Simple)</li>
<li id="zh-TW"><img src="/arrowchat/applications/translate/images/zh-TW.png" alt="zh-TW" />Chinese (Traditional)</li>
<li id="hr"><img src="/arrowchat/applications/translate/images/hr.png" alt="hr" />Croatian</li>
<li id="cs"><img src="/arrowchat/applications/translate/images/cs.png" alt="cs" />Czech</li>
<li id="da"><img src="/arrowchat/applications/translate/images/da.png" alt="da" />Danish</li>
<li id="nl"><img src="/arrowchat/applications/translate/images/nl.png" alt="nl" />Dutch</li>
<li id="en"><img src="/arrowchat/applications/translate/images/en.png" alt="en" />English</li>
<li id="et"><img src="/arrowchat/applications/translate/images/et.png" alt="et" />Estonian</li>
<li id="tl"><img src="/arrowchat/applications/translate/images/tl.png" alt="tl" />Filipino</li>
<li id="fi"><img src="/arrowchat/applications/translate/images/fi.png" alt="fi" />Finnish</li>
<li id="fr"><img src="/arrowchat/applications/translate/images/fr.png" alt="fr" />French</li>
<li id="gl"><img src="/arrowchat/applications/translate/images/gl.png" alt="gl" />Galician</li>
<li id="de"><img src="/arrowchat/applications/translate/images/de.png" alt="de" />German</li>
<li id="el"><img src="/arrowchat/applications/translate/images/el.png" alt="el" />Greek</li>
<li id="ht"><img src="/arrowchat/applications/translate/images/ht.png" alt="ht" />Haitian Creole</li>
<li id="iw"><img src="/arrowchat/applications/translate/images/iw.png" alt="iw" />Hebrew</li>
<li id="hi"><img src="/arrowchat/applications/translate/images/hi.png" alt="hi" />Hindi</li>
<li id="hu"><img src="/arrowchat/applications/translate/images/hu.png" alt="hu" />Hungarian</li>
<li id="is"><img src="/arrowchat/applications/translate/images/is.png" alt="is" />Icelandic</li>
<li id="id"><img src="/arrowchat/applications/translate/images/id.png" alt="id" />Indonesian</li>
<li id="ga"><img src="/arrowchat/applications/translate/images/ga.png" alt="ga" />Irish</li>
<li id="it"><img src="/arrowchat/applications/translate/images/it.png" alt="it" />Italian</li>
<li id="ja"><img src="/arrowchat/applications/translate/images/ja.png" alt="ja" />Japanese</li>
<li id="ko"><img src="/arrowchat/applications/translate/images/ko.png" alt="ko" />Korean</li>
<li id="lv"><img src="/arrowchat/applications/translate/images/lv.png" alt="lv" />Latvian</li>
<li id="lt"><img src="/arrowchat/applications/translate/images/lt.png" alt="lt" />Lithuanian</li>
<li id="mk"><img src="/arrowchat/applications/translate/images/mk.png" alt="mk" />Macedonian</li>
<li id="ms"><img src="/arrowchat/applications/translate/images/ms.png" alt="ms" />Malay</li>
<li id="mt"><img src="/arrowchat/applications/translate/images/mt.png" alt="mt" />Maltese</li>
<li id="no"><img src="/arrowchat/applications/translate/images/no.png" alt="no" />Norwegian</li>
<li id="fa"><img src="/arrowchat/applications/translate/images/fa.png" alt="fa" />Persian</li>
<li id="pl"><img src="/arrowchat/applications/translate/images/pl.png" alt="pl" />Polish</li>
<li id="pt"><img src="/arrowchat/applications/translate/images/pt.png" alt="pt" />Portuguese</li>
<li id="ro"><img src="/arrowchat/applications/translate/images/ro.png" alt="ro" />Romanian</li>
<li id="ru"><img src="/arrowchat/applications/translate/images/ru.png" alt="ru" />Russian</li>
<li id="sr"><img src="/arrowchat/applications/translate/images/sr.png" alt="sr" />Serbian</li>
<li id="sk"><img src="/arrowchat/applications/translate/images/sk.png" alt="sk" />Slovak</li>
<li id="sl"><img src="/arrowchat/applications/translate/images/sl.png" alt="sl" />Slovenian</li>
<li id="es"><img src="/arrowchat/applications/translate/images/es.png" alt="es" />Spanish</li>
<li id="sw"><img src="/arrowchat/applications/translate/images/sw.png" alt="sw" />Swahili</li>
<li id="sv"><img src="/arrowchat/applications/translate/images/sv.png" alt="sv" />Swedish</li>
<li id="th"><img src="/arrowchat/applications/translate/images/th.png" alt="th" />Thai</li>
<li id="tr"><img src="/arrowchat/applications/translate/images/tr.png" alt="tr" />Turkish</li>
<li id="uk"><img src="/arrowchat/applications/translate/images/uk.png" alt="uk" />Ukrainian</li>
<li id="vi"><img src="/arrowchat/applications/translate/images/vi.png" alt="vi" />Vietnamese</li>
<li id="cy"><img src="/arrowchat/applications/translate/images/cy.png" alt="cy" />Welsh</li>
<li id="yi"><img src="/arrowchat/applications/translate/images/yi.png" alt="yi" />Yiddish</li>
</ul>

<div class="translating">
{$translate_language[0]}
</div>

<div style="clear:both"></div>

</div>

</div>

然后有一个 css 文件,我已经弄乱了几个小时但没有成功:

我的列表输出看起来像附图

how list currently looks

我想做的就是让国家名称位于旗帜的右侧,但到目前为止我所做的一切都没有成功。

谁能帮帮我?

亲切的问候

最佳答案

好的,所以,这就是我解决您的问题的方法,请在此处输入:https://embed.plnkr.co/H110p2/

首先。忘掉花车,它们几乎被弃用了。我从你的 CSS 中删除了它们。只有在少数情况下是必要的,而不是为了这个。

其次。查看 index.html,我将每个国家/地区的名称都包裹在 <p> 中这样我就可以在 css 中更轻松地处理它们。

三、查看css文件,首先我清理了.translate_ul li填充并将其设置为 0。然后我为 <li> 中的图像创建了一个处理程序。元素以及 <p>元素。然后我使用属性 display: inline-block在这两个元素中,这告诉导航器它们一个接一个地对齐,属性:vertical-align: middle , 说我希望它们在彼此的中间对齐。最后,我在 <p> 的左侧添加了一个小边距。美学元素。

.translate_ul li {
text-align: left;
width: auto;
margin: 0;
height: 20px;
background-position: 0 -1px;
background-repeat: no-repeat;
padding: 0 0 0 0;
cursor: pointer;
}

.translate_ul li p{
display:inline-block;
vertical-align:middle;
margin-left:5px;
}
.translate_ul li img{
display:inline-block;
vertical-align:middle;
width:16px;
}

我希望这对你有用。

关于css - 无法让我的元素符号列表正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43428816/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com