Jump to content

LeonLatex

Members
  • Posts

    393
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by LeonLatex

  1. I'm posting this here on CSS, although some probably think it should be posted on HTML. Regardless... I have a problem with two DIV boxes. One is a top DIV containing background images, and the other is a DIV box with a navigation bar. They are set inside <HEADER> and <NAV> These two DIV boxes are controlled by CSS. Both HTML and CSS are pasted below. Otherwise, the background image is scaled with CSS and: background:url("../images/topbg.png") no-repeat; background-size: contain; /*Makes the background scaling.*/ The problem is that the navigation bar is placed at the very top of the page and behind the background image so that it does not appear where it should; below top DIV and the background image. No matter what I do, it doesn't help. So I wonder: What am I doing wrong? /* CSS Document */ .big_div { margin: auto; position: fixed; width: 100%; height: 249px; background:url("../images/topbg.png") no-repeat; background-size: contain; /*Makes the background scaling.*/ } .nav_div { margin: auto; background-color: #fdfdfd; width: 100%; height: 40px; font-size: 15px; text-align: center; color: blue; } <body class="body_main"> <HEADER class="big_div"> <div class="big_div"></div> </HEADER> <NAV> <div class="nav_div"> <a id='nav-members' href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Hjem</a> <a id='nav-register' href='<?=$HOST?>register.php' class='w3-bar-item w3-button'>Registrering</a> <a id='nav-members' href='<?=$HOST?>members.php' class='w3-bar-item w3-button'>Medlemmer</a> <a id='nav-members' href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Hjem</a> <a id='nav-invoice' href='<?=$HOST?>invoice.php' class='w3-bar-item w3-button'>Faktura</a> <a id='nav-login' href='<?=$HOST?>login.php' class='w3-bar-item w3-button w3-right'><?=$log_btn?></a> </div> <div><?php include '../templates/welcome.html.php'; ?></div></MAIN> <FOOTER> <div><?php include '../templates/footer.html.php'; ?></div> </FOOTER> </body> </html>
  2. I'm putting together a script that includes the use of the controller __DIR__ In that regard, I'm wondering about a few things. Parts of the page are stored in a directory under the www directory. These are included and templates. I save the files in these folders because I want to make them not directly accessible via the browser. But now I see a problem that can occur since I use dir. Won't __DIR__ create a URL, which in turn will make the files inaccessible, that is, they will be perceived as trying to access the files via browser (hope you understand what I mean). Would it be better to use for example include alone? (for example, do not write include __DIR__ but only include) Ang. __DIR__ then I wonder about another thing too: Does __DIR__ indicate the path from the root of the www directory (what some of the old trotters call the public directory), or is it from the directory in which the file in which the __DIR__ controller is used?
  3. On a page that I have put together, I have two DIVs at the top. One is for the background image at the top of the web page and is made scalable with CSS, and the 2nd is for a navigation bar. The problem is with the navigation bar. I want these two DIV's to nest inside each other. They do this as well, as long as the window is not minimized. Therefore. It is displayed correctly as long as the window is full size. When you minimize or scale down the resolution, these two DIVs slide apart so that there is a gap and a space is created between them. I don't want it. What have I done wrong? HTML and CSS are below. HTML Dokument <body> <HEADER> <NAV> <MAIN> <div class="big_div"> <NAV> <div class="nav_div"> <a id='nav-members' href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Hjem</a> <a id='nav-members' href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Registrering</a> <a id='nav-members' href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Medlemmer</a> <a id='nav-members' href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Båtplass</a> <a id='nav-members' href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Faktura</a> </div> </HEADER> </NAV> </MAIN> </body> <html> CSS Document .big_div { position: fixed; margin: auto; margin-top:0px; width: 100%; height: 250px; background:url("../images/topbg.png") no-repeat; background-size: contain; /*Makes the background scaling*/ padding-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; font-size: 14pt; } .nav_div { position: fixed; background-color: #fefefe; margin: auto; margin-top: 250px; width: 100%; height: 40px; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; vertical-align: middle; font-size: 12px; text-align: center; color: blue; }
  4. Thanks for your answers Kicken. This problem started to get so huge for me, so everything was tried in desperation. There were quotes overall sometimes 🤪
  5. Of course. My fault. In the heat of.... Here it is: 14:42:15 CREATE TABLE 'test''.'articletext' ( 'id' INT NOT NULL AUTO_INCREMENT, 'articleheading' TEXT NULL, 'articletext' TEXT NULL, 'articleauthor' TEXT NULL, 'articledate' DATE NULL, PRIMARY KEY ('id')) Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''test_db'.'articletext' ( 'id' INT NOT NULL AUTO_INCREMENT, 'articlehea' at line 1 0.000 sec
  6. It seems like that because I have tried so much. Thanks for the link. I will check it out.
  7. I need help to solve a problem I can't get rid of. I get this error: Unable to connect to the database server: SQLSTATE[HY000] [2005] Unknown MySQL server host '$host' (2) So, the error check works, it writes out the error message. The problem is I can't find the problem/error in the script. I hope you could be so kind and find it for me. I am VERY sure my user details are correct. Is every reference to variables correct, for instance? Could you be kind and tell me where and what to do? <?php $host = 'mysqlhost.no'; //Default database host. $dbname = 'mydatabasename'; //Default database name. $username = 'myusername'; //Default database username. $password = 'mysecretpassword'; //Default database password. try { $pdo = new PDO('mysql:host=$host;dbname=$dbname;charset=utf8', '$username', '$password'); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); return $db; } catch (PDOException $e) { $output = 'Unable to connect to the database server<X>: ' . $e->getMessage(); ' in ' .$e->getFile() . ':' . $e->getline(); }
  8. I am getting an error in MySQL Workbench when I want to CREATE Table. I am getting an Error, but can't find it anywhere. Can you? CREATE TABLE 'test'.'articletext' ( 'id' INT NOT NULL AUTO_INCREMENT, 'articleheading' TEXT NULL, 'articletext' TEXT NULL, 'articleauthor' TEXT NULL, 'articledate' DATE NULL, PRIMARY KEY ('id'));
  9. So, what's the difference between UTF8 and UTF8mb4?
  10. I have been looking for a kind of documentation. But I haven't been able to find it. And by the way... I have used the browser developer tools, but there is so hard to read this without line spaces and it is so much, and it is so unmanageable. I just have to use more time on this, something I don't have too much of..... Thanks any way Kicken😊 PS. I thank you for the link to the documentation. There it was a link to "w3CSS Downloads I haven't seen before. I will use some time on those pages and see what it contains.
  11. I set up a site a long time ago where I depended on the site being 100% scalable. Due to the web page's content and placement of content boxes/DIV's. I eventually found out because time pressure that the easiest thing was to set up the page using w3 schools class on all DIV's. Then I got text and other content to scale according to all screen resolutions, in all directions. I am trying to find out how, for example, the CSS for <div class="w3-container"> is put together. I've learned to set up CSS that works like that, or like that. But the problem is that my CSS doesn't work as smooth and fine as the <div class="w3-container"> or other elements such as <header class="w3-container"> IS there anyone here who can tell me where I can find all the data for how W3 schools' div and header class are set up? Or if you can tell me somewhere where I can find the source for how w3 schools' classes are set up/combined?
  12. Yes, I know. So, like you, I hope, like you say Gizmola, he's just taking a break and a vacation.
  13. Has anybody seen or talked to Barand lately? The last time was talking to him was about the 19th. or 20th. march. That was the last time I saw him online too. I know he lives alone and is 74 years old, and these days and at his age, you never know. I like the man and feel a little worried for him.
  14. Strider64, after kicken and I get some help from another one who came in and commented, then I saw what you tried to tell me. I have changed and using your connection now. Thank you so much, and sorry for misunderstanding you.
  15. Yes, I see it now after you told me. Thank you for a very clear answer kicken. (another medal for you)
  16. Strider, I am not sure what you meant with your answer. Your code does exactly the same as mine. My code works well, that was not the problem. I was wondering something. You'll figure it out if you read my opening posting one more time. Anyway, thanks for trying. I think you misunderstood me.
  17. Here is my DB connection: <?php try { $pdo = new PDO('mysql:host=mysqlserver.no;mydbname=mydb', 'myusername', 'mypassword'); $output = 'Database connection established.'; } catch (PDOException $e) { $output = 'Unable to connect to the database server: ' . $e->getMessage(); } When it comes to error and connection check, or I start at the other end..: I know the error check works. I print both to screen. Checked it by entering both correct and incorrect passwords. So I'm sure it works, but does it only work on the user details, or will it work on other errors as well? For example, if there is no connection with the DB server, if it is on a separate server, for example?
  18. Yes, I know, you have told me the solution to this problem before, but now I got the same problem. My header bar is moving up and down when scrolling. I am using position: sticky; but it still goes up and down. What is the problem? div.header_container { background-color: #033333; position: sticky; height: 83px; width: 100%; padding-top: 0px; margin-top: 0px; } div.logo_bar { background-color: #033333; width: 100%; height: 47px; } div.logo_div { background-image: url("../images/logo_bg_original.png"); width: 300px; height: 35px; margin-top: 0px; } div.menu_bar { font-size: 13px; font-weight: bold; background-color: #ffffff; width: 100%; } div.menu_div { background-color: #ffffff; width: 100%; }
  19. Edt: I was thinking that block 3 would overwrite the values in block 2 since it is read later,
  20. Yes, of course. I was thinking that block 3 would overwrite the values in block 3 since it is read later, but now I see that there is different values in those two blocks. So, the case is closed. Thanks 😊
  21. Strider, can you please tell me why you set up block 2 and 3 like this? : .logo-div, .translate-div { display: inline-block; vertical-align: middle; } .logo-div { background-color: red; color: #fff; text-align: left; Both blocks have a reference to "logo-div". Why? I ask before I try because I want to understand what I am doing when doing it. Will the result not be determined by what is written in block 3 regardless of what is written in block 2 because block 3 is read after block 2? I mean: Therefore, the values for. logo-div in block 2 are overridden by the values of block 3 for ". logo-div" no matter what. I'm just asking because I got a little confused now. I have never set up CSS like this before, and I didn't know you could do it this way. Therefore, I need an explanation.
  22. Thanks to all of you. I will look into it and all the advice you are giving me. There has been a downtime of about 10 hours on the server, and I didn't have a copy on this site locally, so I haven't been able to work on the site. Again, thank you so much 😊
  23. I've lost my way, and now I can't find the right solution again. I've managed to do this before, but now I can't find the right combination. I have 1 DIV that contains two other DIVs. One is on the left side, and one is on the right side. The right side is the google translate drop down menu. The right one is a div that contains the logo and company name. The problem is that the DIV for the google translate dropdown menu stays at the top, while the DIV for the logo is placed on the line below. Which "display: inline" option should I go for each individual DIV when i want them aligned left and right on the same line?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.