[HTML & CSS] Help!

TrueJewix

Member
Aug 9, 2012
332
21
Hello so i've made this "Box" and im trying to move it in middle of the page. but it won't let me. So please help me ASAP

Thats the box that im trying to move.

thats the HTML code.

Thats the CSS code.

So help please! Thanks.
 

TrueJewix

Member
Aug 9, 2012
332
21
I'm not very good with coding but <center> might do it? Someone correct me if I'm wrong which is most likely.
It worked thanks. now i can continue.

margin:0 auto; into your Box CSS should work.
Although, it's only working on newer browsers.
<center> HTML tags works on ALL browsers, but looks a bit less professional at the same go.
It Worked. Thanks so much, Now i may continue with the project it turned out like this like i wanted it to be :)

I need another help sorry for this post.i know i already double posted so this counts?

Okay ive made this box and its in the middle of the page so i want a line in the middle of the box

example of what im talking about :
how do i make that in Html and CSS?
 
Last edited by a moderator:

Dzetki

The Prodigal Son Returns
Jul 16, 2010
990
220
<hr /> tag can create a line for you, although I'm not sure what you'd need such a line for?
If you want the line in a specific size, width, height or color, you can do

hr {
height:2px;
width:100%;
color: #FF0000; //Or red
}
in your CSS
Although, I'm not sure why you want it in the middle of the box?
 

Dzetki

The Prodigal Son Returns
Jul 16, 2010
990
220
There's a few ways to approach this. You could make a seperate box such as this;

.line-box {
background-color: transparent;
width: 100%;
height: 10px;
border-bottom: 1px solid red;
}

Then comes a box for the image/whatever else you want in it.
.overline-box {
background-color: red;
width:100px;
height:100px;
margin-top: 1%; //Play around till it fits onto the line as you want it
overflow: hidden;
}

At least something around those parts should work.
The other way is to create a background image that fits the sizes you want, but that wouldn't be responsive to all screen resolutions.
Let me know if it works.
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
<center> is deprecated as of HTML5.

Try this (I'm against internal CSS styling, but I can't be arsed making two files and doing the <link /> tag, you can do that yourself.):

HTML:
<!DOCTYPE html>
<html>
<head>
    <title>lol</title>
    <style type="text/css">
    body {
        background: gray;
    }
   
    div.container {
        margin: 0 auto;
        width: 960px;
    }
   
    div.profilebox {
        background: #ffffff;
        padding: 20px;
        border-radius: 3px 6px 9px 12px;
        height: 20px;
        width: 200px;
    }
    </style>
</head>

<body>
    <div class="container">
        <div class="profilebox"></div>
    </div>
</body>
</html>
 

Brackson

卍卍卍卍卍卍卍卍卍卍卍
Jun 20, 2013
262
46
Thanks but how do i wirte something in the "box"
I'm going to assume that you mean writing actual text inside the box on your html page.

Do this.
HTML:
<html>
<body>
<div id="durkadurk"> <!-- your div name -->
    <p>dont drop pls</p> <!-- text that goes in the box -->
</div>
</body>
</html>
 

TrueJewix

Member
Aug 9, 2012
332
21
the menu `Topbar`i made but its was just hard to make that rounded corner `cirlce` box.
and by the code you guys are giving me im learning from it.
and i started coding like 3 months .
 

TrueJewix

Member
Aug 9, 2012
332
21
So, is the problem fixed?

Also, for the circle box.
Well not really i wanted the text inside of the box not outside of the box.

Im creating a website. Just to test my coding knowledge So the more i learn the more i accomplish
 
Last edited:

Users who are viewing this thread

Top