0

I have a some words that I want display in the footer, I want 2 words to be left aligned and rest to be right aligned.

I have my code something like this:

<div class="footer">
    MyWebsite             <!--This should be left aligned-->

    <!--Things below should be right aligned-->
    <a href="">Contact Me</a>
    <a href="">Help</a>
    
</div>

I want it to be displayed in a single line not to distribute in two different lines. Any way to do this by Html/css?

3
Contributors
8
Replies
10
Views
5 Years
Discussion Span
Last Post by jalarie
1

<div class="footer">
<span style="float:left;">MyWebsite</span> <!--This should be left aligned-->

<!--Things below should be right aligned-->
<span style="float:right;">
<a href="">Contact Me</a>
<a href="">Help</a>
</span>

</div>

0
<html>
</head>
	<style type="text/css">
	.footer{
	width:600px;background:#e3eeff;border:1px solid orange;
	}
</style>
</head>

<body>

<div class="footer">
<div style="float:left;">MyWebsite</span> <!--This should be left 

aligned-->

<!--Things below should be right aligned-->
<div style="float:right;">
<a href="">Contact Me</a>
<a href="">Help</a>
</div>

</div> 
</body>
</html>
0

Thanks jalarie and tqmd1 both works for me. But I preferred method given by jalarie as it allows me to use span tag within other html tags but when I do so with div it gives error. Also tqmd1, the code written by you contain 2-3 errors.

Anyways, thanks a lot guys :)

0

Please tell us what errors you facing there.
Let us try to sort out.

0

Please tell us what errors you facing there.
Let us try to sort out.

It is when if I write something like this:

<div class="footer">
    <p>
        <div style="float:left">
            Hello World
        </div>
    </p>   <!-- this closing tag will give error that it cannot find starting <p> tag -->
</div>
0

It works fine for me here in IE8.
What browser you are using?

It may be working fine, but coding in Netbeans it show it as a error. So I think, may be it is not the standard way to code. Not sure

0

You can not properly put a "div" tag within a "p" tag. The "p" is in-line but the "div" is block level. IE sometimes gives a good result for bad code.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.