gpt4 book ai didi

html - 向

添加新内容时图像移动

转载 作者:太空狗 更新时间:2023-10-29 16:34:27 24 4
gpt4 key购买 nike

这里是第一个网站(请注意)!我的问题是我试图将我的内容(下面有服务链接的飞鱼绘画和维护)全部放在 h1 类别中而不移动图像!当我添加服务 href 链接时,我真的希望这两个图像(左侧和右侧)分别位于左上角和右上角。有任何想法吗?这是我的代码:

.round1 {
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
width: 70px;
height: 70px;
}

.round2 {
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
width: 70px;
height: 70px;
}

.linkto {
color: white;
font-size: 60%;
font-family: Arial;
}

.linkto:hover {
color: blue;
}

body {
padding: 20px 20px 20px 20px;
}

h1 {
color: white;
border: 6px solid black;
border-radius: 25px;
text-align: center;
font-family: Forte;
font-weight: bold;
background-color: black;
font-size: 180%;
padding-bottom: -50px;
}
<h1>
Flying Fish Painting &amp Maintenance</br>

<img class="round1" src="https://flyingfishpainting.files.wordpress.com/2013/04/flying_fish_logo_hressmall.png?w=300&h=291" align=left>

<img class="round2" src="https://flyingfishpainting.files.wordpress.com/2013/04/flying_fish_logo_hressmall.png?w=300&h=291" align=right>

<a class="linkto" href="C:\Users\CE User\Desktop\services.html">Services</a>
</h1>

最佳答案

首先,您可以将内容放在单独的 div 中,然后使用 flex-box 对齐它们,而不是将所有内容都塞进 H1 标签中。为什么不在 H1 标签中?它适用于 headings

实现目标的方法有很多种,这只是其中一种

/*
More about box-sizing:
https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
https://www.paulirish.com/2012/box-sizing-border-box-ftw/
*/

html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}

.wrapper {
background: black;
border-radius: 25px;
text-align: center;
padding: 1rem;
margin: 0 auto;
display: flex;
justify-content: center;
/* could be any number you want */
max-width: 780px;

}

.image-wrapper {
flex-basis: 70px;
}

img {
max-width: 100%;
}

h1 {
text-align:center;
font-family:Forte;
font-weight:bold;
color: white;
margin: 0 1rem 0 1rem;
}

a {
color: white;
text-decoration: none;
font-size: 1.5rem;
font-family:Arial;
}

a:hover { color: blue }
<div class="wrapper">
<div class="left image-wrapper">
<!-- removed the align attribute -->
<img src="https://flyingfishpainting.files.wordpress.com/2013/04/flying_fish_logo_hressmall.png?w=300&h=291">
</div>
<div>
<h1> Flying Fish Painting &amp Maintenance</h1>
<a class ="linkto" href="C:\Users\CE User\Desktop\services.html">Services</a>
</div>
<div class="right image-wrapper">
<img src="https://flyingfishpainting.files.wordpress.com/2013/04/flying_fish_logo_hressmall.png?w=300&h=291">
</div>
</div>

关于html - 向 <h1> 添加新内容时图像移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46986228/

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