首页 \ 问答 \ 定位到相同页面部分的锚点移动得太低(Anchor tag to same page section moves too low)

定位到相同页面部分的锚点移动得太低(Anchor tag to same page section moves too low)

我想要使​​用锚标记从主页的顶部移动到主页的较低部分。 主页的下半部分是一个div,就像另一个页面一样,只是它在同一页面上更低。 它被称为find-vegan-products-page,并有一个表单。 该表单的margin-top为100px,因此它不在find-vegan-products-page表单的顶部。 我希望锚点将用户带到find-vegan-products-page的顶部,显示100px的边距(因此表单不在页面的顶部。但它会转到表单的顶部。我认为这是因为表单上面没有任何内容可以导致100px的上边距向下推送表单。这是我的意思的照片:

在这里输入图像描述

在这里输入图像描述

这是我的代码:

HTML:

<body>
    <div style="margin-bottom: 100px;" class="full_size dimmed">
        <div style="position:fixed; z-index: -1;">
        <video style="position:fixed;" autoplay loop poster="assets/images/home_page/polina.jpg" id="bgvid">
            <!--<source src="polina.webm" type="video/webm">-->
            <source src="assets/videos/polina.mp4" type="video/mp4">
        </video>
        </div>

        <div class="header dim">
            <a href="http://www.w3schools.com" ><h5 id="app-name" class="nav-item clickable white-text medium-text left-text">THE VEGAN REPOSITORY</h5></a>
            <a href="http://www.w3schools.com" ><h5 (click)="clicked()" id="sign-in-button" class="nav-item clickable brand-colour-text medium-text right-text with-border">SIGN UP FREE</h5></a>
            <a href="http://www.w3schools.com" ><h5 class="nav-item clickable white-text medium-text right-text">LOGIN</h5></a>
            <a href="#home_page_footer" ><h5 class="nav-item clickable white-text medium-text right-text" >BLOG</h5></a>
            <a href="#home_page_footer" ><h5 class="nav-item clickable white-text medium-text right-text" >ABOUT</h5></a>

        </div>

        <div id="motto-text" class="vertical-center">
            <h5 class="white-text medium-text">THE VEGAN REPOSITORY</h5>
            <h1 id="main-text" class=" text-center white-text light-text extra-large-text">FIND VEGAN PRODUCTS NEAR YOU</h1>
            <a id="try-now-button" class="with-border clickable" href="#find-vegan-products-page" ><h5  class=" text-center medium-text">TRY NOW</h5></a>
        </div>
    </div>

    <!-- <div id="googleMap" style="height:500px;"></div> -->

    <div id="find-vegan-products-page" style="height:900px;">
        <div class="form-background">



            <form role="form" style="padding: 40px;">
                <div class="form-group">
                    <input type="text" class="form-control input-control" placeholder="Country">
                </div>
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="City">
                </div>
                <div class="checkbox">
                    <label><input type="checkbox"> Remember me</label>
                </div>
                <button type="submit" class="btn btn-default">Submit</button>
            </form>
        </div>
    </div>

</body>

CSS:

.input-control {
    height: 5rem;
    width: 49%;
    display: inline-flex;
    background-color: transparent;
    border: none;
}

.form-background {
    background: rgba(149, 246, 102, .5);
    margin: 100px 100px 0px 100px;
}

如何获取锚点以移动页面,以便表单顶部和屏幕顶部之间有100px的间隔?


I want to use an anchor tag to move from the top of the home page to a lower part of the home page. The lower part of the home page is a div, that is like another page, only it's lower down on the same page. It is called find-vegan-products-page, and has a form on it. The form has a margin-top of 100px, so that it is not at the very top of the form find-vegan-products-page. I want the anchor to take the user to the top of the find-vegan-products-page, displaying the 100px margin (so the form is not at the very top of the page. But it goes instead to the top of the form. I think this is because the form has nothing above it to cause the 100px top-margin to push the form down. Here are photos of what I mean:

enter image description here

enter image description here

Here's my code:

html:

<body>
    <div style="margin-bottom: 100px;" class="full_size dimmed">
        <div style="position:fixed; z-index: -1;">
        <video style="position:fixed;" autoplay loop poster="assets/images/home_page/polina.jpg" id="bgvid">
            <!--<source src="polina.webm" type="video/webm">-->
            <source src="assets/videos/polina.mp4" type="video/mp4">
        </video>
        </div>

        <div class="header dim">
            <a href="http://www.w3schools.com" ><h5 id="app-name" class="nav-item clickable white-text medium-text left-text">THE VEGAN REPOSITORY</h5></a>
            <a href="http://www.w3schools.com" ><h5 (click)="clicked()" id="sign-in-button" class="nav-item clickable brand-colour-text medium-text right-text with-border">SIGN UP FREE</h5></a>
            <a href="http://www.w3schools.com" ><h5 class="nav-item clickable white-text medium-text right-text">LOGIN</h5></a>
            <a href="#home_page_footer" ><h5 class="nav-item clickable white-text medium-text right-text" >BLOG</h5></a>
            <a href="#home_page_footer" ><h5 class="nav-item clickable white-text medium-text right-text" >ABOUT</h5></a>

        </div>

        <div id="motto-text" class="vertical-center">
            <h5 class="white-text medium-text">THE VEGAN REPOSITORY</h5>
            <h1 id="main-text" class=" text-center white-text light-text extra-large-text">FIND VEGAN PRODUCTS NEAR YOU</h1>
            <a id="try-now-button" class="with-border clickable" href="#find-vegan-products-page" ><h5  class=" text-center medium-text">TRY NOW</h5></a>
        </div>
    </div>

    <!-- <div id="googleMap" style="height:500px;"></div> -->

    <div id="find-vegan-products-page" style="height:900px;">
        <div class="form-background">



            <form role="form" style="padding: 40px;">
                <div class="form-group">
                    <input type="text" class="form-control input-control" placeholder="Country">
                </div>
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="City">
                </div>
                <div class="checkbox">
                    <label><input type="checkbox"> Remember me</label>
                </div>
                <button type="submit" class="btn btn-default">Submit</button>
            </form>
        </div>
    </div>

</body>

CSS:

.input-control {
    height: 5rem;
    width: 49%;
    display: inline-flex;
    background-color: transparent;
    border: none;
}

.form-background {
    background: rgba(149, 246, 102, .5);
    margin: 100px 100px 0px 100px;
}

How do I get the anchor to move the page so that there is a 100px gap between the top of the form and the top of the screen?


原文:https://stackoverflow.com/questions/35053141
更新时间:2023-12-09 21:12

最满意答案

通过使用ip套接字作为“代理”,Socat可用于创建网络串行端口。 这是可以用于我们要创建的每个端口的命令:

sudo socat ip:localhost:222 pty,raw,echo=0


Socat can be used for creating a network o serial port by using a ip socket as a "broker". This is the command that can be used for each port that we want to create:

sudo socat ip:localhost:222 pty,raw,echo=0

相关问答

更多
  • 不一定是答案 但需要这个空间来添加一个例子。 您是否尝试使用Qt函数来确定可用的端口? 这是我用来查找USB串口的函数示例(如果需要,循环使用c ++ 11可以转换回来)... QList QSerialComs::getUsbSerialPortsList() { QList usbSerialPorts; for (auto serialPortInfo: QSerialPortInfo::availablePorts()) { ...
  • 您可能希望调整这个来自socat手册页的示例: socat PTY,link=/var/run/ppp,rawer INTERFACE:hdlc0 避免了pppd需要串行设备的问题,因此可能无法在网络设备所代表的同步线路上工作。 socat创建一个PTY来使pppd满意,绑定到网络接口hdlc0,并可以在两个设备之间传输数据。 然后在设备/ var / run / ppp上使用pppd。 在此示例中,接口是同步线(OS将其视为HDLC接口)。 pppd使用(默认情况下)类似HLDC的帧,因此将原始数据从p ...
  • 尝试 socat -v /dev/ttyAMA0 tcp-connect:localhost:10001 更多信息,请使用帮助: socat -h try socat -v /dev/ttyAMA0 tcp-connect:localhost:10001 for more, use help: socat -h
  • (我的第一种方法不正确,所以我修改) 我从来没有使用过socat ,但是如果它有-v log.txt选项我有一个可能的解决方案,因为我看到-v选项它也将结果打印到stderr。 我假设您希望将日志文件发送到log.txt,剪切前10行并删除所有\r字符。 在支持进程替换的bash上 ,可以这样做: socat -v ... 2> >(awk 'NR>10 {gsub("\r","");print}'>log.txt) (注意两个>标记之间的空间!!!) 这将创建一个进程,并且>(...)返回一个像/dev ...
  • tcp连接的一端需要侦听端口(您启动的第一个端口),第二端连接到端口。 对于第一方做: socat tcp-listen:8080 pty,link=/dev/virtualport0 对于第二方做: socat pty,link=/dev/virtualcom0 tcp:IP-of-other-machine:8080 忘记netcat,你不需要它。 One side of the tcp connection needs to be listening on the port (the first ...
  • 我用socat工具使用下面的命令实现了串口到以太网的转换。 sudo socat TCP-L:33888 GOPEN:/dev/ttyS1,ispeed=4800,ospeed=4800,b4800,raw,echo=0 I achieved the serial to ethernet conversion using below command with socat tool. sudo socat TCP-L:33888 GOPEN:/dev/ttyS1,ispeed=4800,ospeed=480 ...
  • 谢谢您的帮助。 我现在已经解决了,可以很好地沟通。 Socat确实是一个复杂的工具。 这是我的最终设置: sudo socat -U -d -d -d /dev/tty.usbserial,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,raw,echo=0,crtscts=0 FILE:tnc-start.hex 'ixon'启用XON / XOFF流量控制,'ixoff'启用发送/停止字符的发送,而有趣的是'echo'不会打 ...
  • 在每个设备上运行(即vb01 , vb1和vb2 ): sudo ip route add 224.0.0.0/4 dev eth1 解决了这个问题。 在物理环境中它没有这样做。 不知道为什么我们必须像这样在虚拟环境中运行它。 vagrant@vb0:~$ route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 10. ...
  • 通过使用ip套接字作为“代理”,Socat可用于创建网络串行端口。 这是可以用于我们要创建的每个端口的命令: sudo socat ip:localhost:222 pty,raw,echo=0 Socat can be used for creating a network o serial port by using a ip socket as a "broker". This is the command that can be used for each port that we want to ...
  • 2016年2月10日更新: 我在ORSSerialPort github问题列表中与创建者armadsen讨论了情况: 我认为基本方法是在InternalSerialPort和SerialPort中“交换”初始化程序,以便路径初始化程序是指定/必需的初始化程序,IOKit初始化程序是可选的。 已经如此(正如您所注意到的)路径(不是io_object_t)在内部用于获取文件描述符以及对端口的读/写。 换句话说,我希望这不是一个非常复杂的变化。 在此之后,我做了一个概念验证实现,它适用于“仅有filedescr ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)