当前位置: 首页 > 知识库问答 >
问题:

如何通过HTML/CSS使wordpress自定义帖子类型上的图片具有响应性

蔺德曜
2023-03-14

我是一个新手,有深入的工作,包括Wordpress

超文本标记语言

<?php 
/*
Template Name: About
*/
?>
<?php get_header(); ?>

<div class="about" style="">
    <h1>Why?</h1>
</div>

<div class="about">
    Many may ask the question "Why". Questions such as; "Why is this website relevant?", "Why do I need to know this?" or "Why does this topic even matter?"
    Many of those questions can be anwsered in different ways, with different attitudes and opinions, yet the only importance this website offers is Knowledge.
    The access of clear and ordered catagories of famous people from the actors all the way up to our goverment officials whom represent us, the United States citizens, the opportunity for individuals that may have this disability to understand that it does not make you less from anyone else, and that it simply gives you the power to express who you are and reach milestones in your lifetime that many "ordinary" people don't.
</div>

<div class="about" style="">
    <h1>General Statistics</h1>
</div>

<div class="about">
    <img src="<?php the_field('data_graphic');?>"/>
</div>  

<main role="main" class="col-md-3">
<!-- section -->
    <section>
        <?php if (have_posts()): while (have_posts()) : the_post(); ?>
            <!-- article -->
            <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

                <?php the_content(); ?>

                <br class="clear">
            </article>
            <!-- /article -->

        <?php endwhile; ?>
        <?php else: ?>
            <!-- article -->
            <article>
                <h2><?php _e( 'Sorry, nothing to display.', 'html5blank' ); ?></h2>
            </article>
            <!-- /article -->

        <?php endif; ?>

        </section>
        <!-- /section -->
    </main>

    <?php //get_sidebar(); ?>

<?php get_footer(); ?>

**CSS**

.about img {
  max-width: 100%%;
  vertical-align: bottom;
  margin-left: 150px;
}

如果有人能帮我解决这个问题,我将不胜感激。

共有2个答案

霍建柏
2023-03-14

您的图像需要填充其容器的100%。

.about img {
  width: 100%;
  vertical-align: bottom;
  margin-left: 150px;
}
元叶秋
2023-03-14

我喜欢这样:

.about img{
    max-width:100% !important;
    height:auto;
    display:block;
}

注意:这是为了响应图像,我删除了位置规则,因为您可以自行调整

 类似资料:
  • 本文向大家介绍WordPress 注册自定义帖子类型,包括了WordPress 注册自定义帖子类型的使用技巧和注意事项,需要的朋友参考一下 示例 假设您有一个图书馆网站,并且想要一个名为Books的自定义帖子类型。可以注册为 如此简单,您现在就注册了一个自定义帖子类型。 该代码段可以放在主题functions.php文件中,也可以放在插件结构中。

  • 本文向大家介绍WordPress 3.0中的自定义帖子类型,包括了WordPress 3.0中的自定义帖子类型的使用技巧和注意事项,需要的朋友参考一下 本文与WordPress 3.0相关。此处发布的许多代码在以前的版本中将不起作用,并且某些信息可能会在较新的版本中更改。 WordPress已经在系统中内置了五种不同的内容类型。 帖子 这是标准的内容类型,通常是博客安装中使用最多的内容。帖子往往会

  • 我试图为自定义帖子类型创建一个页面,但我无法真正实现。以下是我正在尝试的全部内容- 自定义帖子类型注册的functions.php片段 我使用名为单Tutorial.php的模板为这个自定义帖子类型模板。此外,在我的帖子显示中,我使用the_permalink()链接到帖子。 现在考虑一个标题为Test3的帖子现在在我的仪表板上,我看到它的PyMalink AS。 当我回显我得到的_permali

  • 我已经创建了一个WordPress自定义帖子类型,然后我创建了REST API自定义endpoint来让所有帖子正常工作。然后,我创建了另一个自定义endpoint,通过ID获取单个帖子。例如http://localhost:8888/WordPress/WP-JSON/LC/v1/cars/120 我已经创建了一些帖子,每次我将路线末端的ID更改为118或116时,它都会显示最新的post-ID

  • 我创建了一个名为制造商的自定义帖子类型,并添加了大量帖子和类别。单个帖子页面工作,但类别/存档页面不显示任何帖子。 制造商被分成不同的类别,我需要显示每个类别中所有帖子的存档。我去工厂的时候 http://localhost/category/manufactures/ge-speedtronic/ 这就是令人困惑的地方。我为自定义帖子类型“制造商”使用的类别也显示在我的其他自定义帖子类型和默认帖

  • 我对Magento很陌生。我想在Magento中输入WordPress post和自定义post类型。为此,我安装了Magento WordPress集成扩展。我成功地从WordPress中获取帖子,我在Magento根目录中安装了WordPress,使用的数据库与Magento使用的数据库相同。对于自定义帖子类型,我还购买了帖子类型 现在,我的问题是,如何将自定义帖子类型从WordPress导入