Frontend Development

Need help with css

Submitted by Carpesir, , Thread ID: 14177

Thread Closed
Carpesir
3,4-Methylendioxy-N-methylamphetamin
Prime
Level:
0
Reputation:
87
Posts:
1.78K
Likes:
64
Credits:
18
10-12-2015, 02:12 PM
This post was last modified: 10-12-2015, 02:22 PM by Carpesir
#1
Hi,

I am currenlty working on getting the skelet for my website done. Now I am facing a problem.
I have a line that says

"While you're here, make sure to visit my profile :^)"

on my page. Right next to it, I want to have a link to my NBB profile in a green box.

My current code for it:



Code:
#boxlink {display:block;font-weight:700;color:white;background-color:#98bf21;width:100px;text-align:center;padding:4px;text-decoration:none}

#paragraph2 {color:white;font-family:"Lucida Console", Times, Serif;text-align:left;}

<p id="paragraph2">While you're here, make sure to visit my profile :^)  <a id="boxlink" href="nulledbb.com/profile/3190">Carpesir on NulledBB</a></p>





But for some reason the text box with the link appears down under what <p id="para2">

How to fix ?

Full code:

Code:
<!DOCTYPE html>
<html>
<title>Carpesir - Enter the rabbit hole</title>
<head>
<style>
body {background:black;}

ul {display:block;color:white;background-color:#98bf21;width:170px;padding:4px;font-family:"Lucida Console", Times, Serif;text-align:left;list-style-type:none;margin:0;}
a:link {color:black;text-decoration:none;font-family:"Lucida Console", Times, Serif;}
a:visited {color:white;text-decoration:none;font-family:"Lucida Console", Times, Serif;}
a:hover {background-color:#7A991A;color:yellow;text-decoration:underline;font-family:"Lucida Console", Times, Serif;}
a:active {background-color:#7A991A;color:blue;text-decoration:none;font-family:"Lucida Console", Times, Serif;}

#boxlink {display:block;font-weight:700;color:white;background-color:#98bf21;width:100px;text-align:center;padding:4px;text-decoration:none}
#anavbar {color:white;}
#aokiforsomereason {color:#7A991A}

h1 {color:red;text-align:center;}

#paragraph1 {color:blue;font-family:"Lucida Console", Times, Serif;text-align:center;}
#h2 {color:yellow;font-family:"Lucida Console", Times, Serif;text-align:left;}
#paragraph2 {color:white;font-family:"Lucida Console", Times, Serif;text-align:left;}
</style>
</head>
<body>
<h1>Welcome to Carpesir's site. As you see, this site is WorkInProgress.</h1>
<p id="paragraph1">I'm Carpesir from NulledBB. If you're here, I'm guessing you already know me.</p>
<p id="paragraph2">While you're here, make sure to visit my profile :^)  <a id="boxlink" href="nulledbb.com/profile/3190">Carpesir on NulledBB</a></p>
<h2 id="h2">Please take a look at the navigation bar:</h2>
<ul>
<li><a id="anavbar" href="mydomain.com/index.html">Home</a></li>
<li><a id="anavbar" href="nulledbb.com">NulledBB</a></li>
<li><a id="anavbar" href="nulledbb.com">Carpesir@NBB</a></li>
<li><a id="aokiforsomereason" href="nulledbb.com">Aoki for some reason</a></li>
</ul>
</ul>
</body>
</html>

RE: Need help with css

Aoki
retired
Level:
83
Reputation:
348
Posts:
7.89K
Likes:
2.3K
Credits:
1.7K
10-12-2015, 02:18 PM
#2
How about code tags?

RE: Need help with css

Carpesir
3,4-Methylendioxy-N-methylamphetamin
Prime
Level:
0
Reputation:
87
Posts:
1.78K
Likes:
64
Credits:
18
OP
10-12-2015, 02:21 PM
#3
10-12-2015, 02:18 PM
Wrote:
How about code tags?

Added now, sorry

RE: Need help with css

Never
Fulltime Member
Level:
0
Reputation:
30
Posts:
1.14K
Likes:
45
Credits:
1.04K
11-12-2015, 12:35 AM
This post was last modified: 11-12-2015, 12:38 AM by Never
#4
that css is so messy oh my god

Also:
display:block on #boxlink

Should be removed.
Works then.
nvr

RE: Need help with css

Carpesir
3,4-Methylendioxy-N-methylamphetamin
Prime
Level:
0
Reputation:
87
Posts:
1.78K
Likes:
64
Credits:
18
OP
11-12-2015, 09:59 AM
#5
11-12-2015, 12:35 AM
Never Wrote:
that css is so messy oh my god

Also:
display:block on #boxlink

Should be removed.
Works then.

I am pretty new to HTML/CSS, any tips especially for this code to make it less messy?

Also, thanks a lot! It really fixed it (:

RE: Need help with css

Never
Fulltime Member
Level:
0
Reputation:
30
Posts:
1.14K
Likes:
45
Credits:
1.04K
11-12-2015, 11:53 AM
This post was last modified: 11-12-2015, 11:53 AM by Never
#6
11-12-2015, 09:59 AM
Carpesir Wrote:
11-12-2015, 12:35 AM
Never Wrote:
that css is so messy oh my god

Also:
display:block on #boxlink

Should be removed.
Works then.

I am pretty new to HTML/CSS, any tips especially for this code to make it less messy?

Also, thanks a lot! It really fixed it (:

I guess it comes down to preference, I learned to write it like this:
Code:
html element {
background color: #fff;
border: 1 px solid black;
etc..
}

Next thing {
....
}
Is alot less messy if you ask me.
nvr

RE: Need help with css

Carpesir
3,4-Methylendioxy-N-methylamphetamin
Prime
Level:
0
Reputation:
87
Posts:
1.78K
Likes:
64
Credits:
18
OP
11-12-2015, 12:03 PM
#7
11-12-2015, 11:53 AM
Never Wrote:
11-12-2015, 09:59 AM
Carpesir Wrote:
11-12-2015, 12:35 AM
Never Wrote:
that css is so messy oh my god

Also:
display:block on #boxlink

Should be removed.
Works then.

I am pretty new to HTML/CSS, any tips especially for this code to make it less messy?

Also, thanks a lot! It really fixed it (:

I guess it comes down to preference, I learned to write it like this:
Code:
html element {
background color: #fff;
border: 1 px solid black;
etc..
}

Next thing {
....
}
Is alot less messy if you ask me.

True it's less messy, but it makes the code really long :c

RE: Need help with css

Never
Fulltime Member
Level:
0
Reputation:
30
Posts:
1.14K
Likes:
45
Credits:
1.04K
11-12-2015, 03:02 PM
#8
11-12-2015, 12:03 PM
Carpesir Wrote:
11-12-2015, 11:53 AM
Never Wrote:
11-12-2015, 09:59 AM
Carpesir Wrote:
11-12-2015, 12:35 AM
Never Wrote:
that css is so messy oh my god

Also:
display:block on #boxlink

Should be removed.
Works then.

I am pretty new to HTML/CSS, any tips especially for this code to make it less messy?

Also, thanks a lot! It really fixed it (:

I guess it comes down to preference, I learned to write it like this:
Code:
html element {
background color: #fff;
border: 1 px solid black;
etc..
}

Next thing {
....
}
Is alot less messy if you ask me.

True it's less messy, but it makes the code really long :c

Readable > short
nvr

RE: Need help with css

maxxhacker
Newbie
Level:
0
Reputation:
0
Posts:
18
Likes:
0
Credits:
0
18-12-2015, 05:28 PM
#9
how to learn css! ! can somene tell me

RE: Need help with css

AAA
Offline
Level:
0
Reputation:
73
Posts:
834
Likes:
110
Credits:
582
18-12-2015, 05:43 PM
#10
P tags are block element by default... you need inline block there! Now you can put that box float:right; next to paragraph

https://jsfiddle.net/5jkdxjyx/
[Image: XhhKTdF.png]

Users browsing this thread: 1 Guest(s)