开发者

html link for line break

开发者 https://www.devze.com 2023-02-03 09:26 出处:网络
Ok the topic I asked here is about \"anchor\" is that correct? Ok this actually works now <a href=\"http://www.mysite.com/index.php?id=363#tips1\">**Development**</a> this is on the

Ok the topic I asked here is about "anchor" is that correct?


Ok this actually works now

<a href="http://www.mysite.com/index.php?id=363#tips1">**Development**</a> this is on the First Site

And then where the Development is: (2nd site) 开发者_如何学Python

<a name="#tips1">**Developer**</a>

Did I miss something here?


Ok this is this first site: http://i197.photobucket.com/albums/aa253/tintingerri/Test/test-4.png

Now if you can see, if you click on the "Development" it will go to the 2nd site. And in this 2nd site, this is where I listed the "Development" and "Consulting" in one page.

Now I would like that if the user click on "Consulting" it would go directly to the "Consulting" text and not to "Development" text first because they are written in one page.

So is this anchor?


I'm not sure I understand what you mean.

<ul>
    <li><a href="#apple">Apple</a></li>
    <li><a href="#banana">Banana</a></li>
    <li><a href="#grapes">Grapes</a></li>
</ul>
<hr />
<p id="apple">This is the Apple section.</p>
<hr />
<p id="banana">This is the Banana section.</p>
<hr />
<p id="grapes">This is the Grapes section.</p>

When you click on a link, it will take you to the section it's linked with via element IDs. The sections can be behind the <hr />.

Linking to another page is similar:

<ul>
    <li><a href="/fruit.html#apple">Apple</a></li>
    <li><a href="/fruit.html#banana">Banana</a></li>
    <li><a href="/fruit.html#grapes">Grapes</a></li>
</ul>

Is this what you meant?

[EDIT]

After clearing the issue in the comments, the solution indeed turns out to be anchors. Page one, say, index.html, will have this code:

<ul>
    <li><a href="/fruit.html#apple">Apple</a></li>
    <li><a href="/fruit.html#banana">Banana</a></li>
    <li><a href="/fruit.html#grapes">Grapes</a></li>
</ul>

While page two, say, fruit.html, will have this code:

<p id="apple">This is the Apple section.</p>
<hr />
<p id="banana">This is the Banana section.</p>
<hr />
<p id="grapes">This is the Grapes section.</p>

You don't have to use <p> tags, of course. You'll probably want to use <div> containers instead:

<div id="apple">
    <p>My apple stuff</p>
</div>
<hr />

etc.


I'm really not sure what you're asking here, but I get the impression it's along the lines of:

If someone clicks the links, how do I show information related to that link on the same page?

Which is relatively easy:

html:

<ul>
    <li><a href="#apple">Apple</a></li>
    <li><a href="#banana">Banana</a></li>
    <li><a href="#grapes">Grapes</a></li>
</ul>

<div id="apple" class="panel">
<p>Apple Stuff</p>
</div>

<div id="banana" class="panel">
<p>Banana Stuff</p>
</div>

<div id="grapes" class="panel">
<p>Grapes Stuff</p>
</div>

css:

.panel {
    display: none;
}

.panel:target {
    display: block;
}

JS Fiddle demo of the above.


I think you are trying to link to another place on your page? For absolute, the following syntax is used: <a href="web address">Link text</a>.

With relative addressing, it is only necessary to use the name of the web page file you are linking to as the value in the href attribute provided that the page containing the link resides in the same folder as the page acting as the link's target. Maybe still this doesnt answer your question?

For the same page, A named anchor inside an HTML document:

<a name="useful on same page">Useful Paragraph</a>

Create a link to the "Useful Paragraph" inside the same document:

<a href="#useful on same page">Useful Paragraph</a>

If I still havent answered the question, please provide more info


With an ul, very simple:

<ul>

<li><a href="#">Apple</a></li>
<li><a href="#">Banana</a></li>
<li><a href="#">Grapes</a></li>

</ul>
0

精彩评论

暂无评论...
验证码 换一张
取 消