- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我很难弄清楚如何将我的图片放在我的段落旁边。目标是在我的文本旁边设置一个图像,不是非常接近而是在同一行上。我怎样才能在 css 中做到这一点?下面是我的 About.js 和 About.css。我的段落包含在一个名为 about-page 的 div 中。我尝试将我的 img 标签放在那个 div 之外,但它会导致错误。它应该看起来像下面的这个草图。
import React from 'react'
import '../CSS/About.css'
import clock from '../clock.jpg'
const About = () => {
return (
<div className="about-page">
<h6 className="about-this-app-header">About This Application</h6>
<p className="description">
Do You Have A Habit of Forgetting Stuff? Don't Worry!!!
<br />
Here's <b>Reminder Me</b> to The Rescue.
</p>
<p className="description">
<b>Reminder Me</b> is a reminder management application
<br />
that lets you send reminders through text message.
<br />
It lets you set a time/duration and a message for your
<br />
reminder. And makes sure that it's sending out right on
<br />
time, not letting you or your friends miss out on the
<br />
important things in life.
</p>
<h6 className="tech-stack-header">Tech Stack</h6>
<h6 className="tech-stack">Front-End: <p className="tech">React, Materialize UI, Font Awesome</p></h6>
<h6 className="tech-stack">
Back-End: <p className="tech">Express.js, Firebase, Node.js, Twilio API</p>
</h6>
<h6 className="link-to">
Link to:
<a
href="https://github.com/jspades93?tab=repositories"
target="_blank"
rel="noopener noreferrer"
className="waves-effect waves-light btn-flat"
>
<i className="fa fa-github" style={{ fontSize: "36px" }}></i>
</a>
</h6>
<div className="clock-image"><img src={clock} alt="clock" /></div>
</div>
);
};
export default About
h6 {
font-weight: bold;
color: #056674;
}
.btn-flat {
color: black;
}
.about-this-app-header {
margin-top: 100px;
margin-left: 170px;
}
.description {
margin-top: 20px;
margin-left: 90px;
}
.tech-stack-header{
margin-top: 25px;
margin-left: 210px;
}
.tech-stack {
margin-left: 90px;
}
.link-to {
margin-left: 35px;
margin-top: 20px;
}
img {
width: 390px;
height: 250px;
float: right;
}
.tech {
display: inline;
vertical-align: top;
color: black;
font-weight: normal;
}
最佳答案
你应该像这个例子一样使用浮点数:
使用 float: left;
用于您的文本和使用 float: right;
为您的形象。
.left {
float:left;
}
.right {
float:right;
}
figure img {
margin:10px;
width: 50%;
}
figcaption {
font-family:sans-serif;
font-weight:bold;
font-size:16px;
padding:10px;
}
.clear {
clear:both;
}
.centered {
margin: auto; /* margin:auto centers the figure element */
width: 50%;
background:#ccc;
text-align:center; /* text-align centers the text and image only - you need margin:auto to center the entire figure */
}
<figure> <img src="https://c1.staticflickr.com/9/8597/29295139165_94394aba37_z.jpg" width="640" height="427" alt="A_Dog Day 2016 at Andy Memorial Skate Park in Burlington, VT" class="left">
<figcaption> This is the caption for a left-floated photo. This element's width is has not been set and it will run the full width of the page. This is the caption for a left-floated photo. This element's width is has not been set and it will run the full width
of the page. </figcaption>
</figure>
<div class="clear"></div>
<figure> <img src="https://c1.staticflickr.com/9/8597/29295139165_94394aba37_z.jpg" width="640" height="427" alt="A_Dog Day 2016 at Andy Memorial Skate Park in Burlington, VT" class="right">
<figcaption> This is the caption for a right-floated photo. This div in between figures with the clear:both property clears the float from the div above it, so the next div can have a different or no float. </figcaption>
</figure>
<div class="clear"></div>
<figure class="centered"><img src="https://c1.staticflickr.com/9/8597/29295139165_94394aba37_z.jpg" width="640" height="427" alt="A_Dog Day 2016 at Andy Memorial Skate Park in Burlington, VT">
<figcaption class="centered-text"> Tip: margin:auto ONLY works if the width property is set, and not set to 100%, so the margins can push the less-than-full-width element into the middle. </figcaption>
</figure>
</div>
关于html - 如何将图像放在网页上的 div 元素旁边?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63843553/
我想在 下面添加按钮标签,但不知道使用什么 CSS 来实现。下图显示了一个可能的场景,“Main_Page”标题和按钮构成了一个单独的 div 的每个部分。我尝试使用 margin-top属性,但想
我的图像不会位于 slider 旁边.. 而只是堆叠在 slider 下方。好像没有空间放置图像,因为 slider 占用了太多空间,但是当我查看代码时,情况似乎并非如此,除非我错过了什么:) Thi
关闭。这个问题需要details or clarity .它目前不接受答案。 想改进这个问题吗? 通过 editing this post 添加细节并澄清问题. 关闭 6 年前。 Improve
我想在文本的左侧放置一个图像,并根据窗口的分辨率保持原样。 这是没有图像的样子:http://prntscr.com/fmky4f 这是我希望它放置后的样子。 https://prnt.sc/fmkk
我创建了一个button,当我点击button然后popup模型显示时,它会隐藏在页面主体旁边,按钮也会隐藏我滚动。我希望当弹出窗口出现时我无法滚动我的页面主体。我使用 Bootstrap 创建了模型
我是一名学生网络开发人员,需要一些帮助。我需要复制这个 wikipedia page尽我所能 我想把 Story 和下面的 div 放在官方 wiki 页面上的位置。 另一个问题是游戏玩法“div”,
需要这项工作的 header 的屏幕截图: 如您所见,菜单位于 Logo 下方。我想要它旁边的菜单,在 Logo 的右侧。我不知道这是否可行,但如果可行,我需要一些帮助,谢谢。 这是所有内容的代码,为
基本上,我们必须有这样的布局,其中图像必须溢出容器,文本填充图像创建的空间(向左偏移)。 我们目前有这样的结构: Some paragraph
我有一个“弹出式”表格,它是一个固定元素。该表有时太高以适应某些屏幕,因此我将 overflow 设置为 auto。然而,滚动条似乎与弹出表格分离,因为父 div 是屏幕的宽度而表格较小。有没有办法让
我有一个带有边框的 div: 表示上面内容的div使用的样式是这样的: const style = { textAlign: "center", mar
如何在各种屏幕尺寸下完美地放置图像? .background-login { background: url(../img/login.png) no-repeat; background-s
我正在尝试在居中的圆形头像旁边的右上角放置一个编辑图标。但是,如果我在行小部件中使用中心小部件,它就不起作用: Row( children: [
首先,感谢您阅读我的问题! 因此,我遇到了一些有关将单元格名称传递到下一个 View 的问题。现在它会传递它,但只会显示最近加载的单元格。 现在的编程方式如下: var passName = "" v
这是网站:www.red-tuxedo.com 我希望“红色燕尾服”文本位于 Logo 旁边,而不是下方,并且我想摆脱贯穿 Logo 的硬性规定。我的 CSS/HTML 技能达不到要求。当我更改文本时
我有一个顶部水平菜单栏,宽度为 100%,居中对齐,位置固定,因此它不会随页面滚动。 但我还想在菜单左侧的菜单内联一个名称(例如名为 test)。 但即使我使用内联 block ,它也会根据左侧的 d
我有一个 4 个链接。我希望他们都在同一行。其中两个在中间,另外两个在右边。我把它们包了两个又两个,但我无法让它工作。 我的 CSS 是这样的: #links_center { } #links_ri
我在 material-ui 中使用 Grid 组件。我无法让网格元素相互堆叠。现在他们正在彼此堆叠。我不确定是什么让它们堆叠在一起。我已经这样做了,所以只有在小屏幕上网格元素才会堆叠在一起,否则每个
我试图在固定宽度的内联 block div 旁边放置一个按钮。但它就在 div 的下面。我试过减少容器的宽度,但这是行不通的。我想在不将类添加按钮放在单独的容器中的情况下完成此操作。该按钮应位于 .i
我在“聊天气泡”旁边有一个用户的图像,但该图像显示在气泡之后。 我如何将图像放在聊天气泡之前并固定在 div 上? 我的代码在这里:http://www.codepen.io/anon/pen/fFx
编辑 #1:这是问题的图片: 编辑 #2:这是我使用品牌类后的图片 编辑#3: 我正在尝试将图像 float 到导航栏旁边。它一直有效,直到我的导航栏宽度达到 100%。然后导航栏位于图像下方。 这是
我是一名优秀的程序员,十分优秀!